64Zbit.com
Tech is way, WAY interesting

Transferable skills - Chris Coyier

At a macro level, you learn programming concepts that are largely transferable regardless of language. The syntax may differ, but the core ideas are still the same. This can include things like: data-structures (arrays, objects, modules, hashes), algorithms (searching, sorting), architecture (design patterns, state management) and even performance optimizations (e.g. eager vs lazy evaluation, memoization, caching, lazy-loading etc). These are concepts you’ll use so frequently that knowing them backwards can have a lot of value.

At a micro level, you learn the implementation of those concepts. This can include things like: the language you use (JavaScript, Python, Ruby, etc), the frameworks you use (e.g. React, Angular, Vue etc), the backend you use (e.g. Django, Rails, etc), and the tech stack you use (e.g. Google App Engine, Google Cloud Platform, etc). There involve details that can be valuable to gain expertise in to be effective, but are not always transferable.

Software Engineering – The Soft Parts

Link to the original article


JSON Feed

JSON Feed

I ran across this today and liked the idea so I added it to this Pelican site thanks to Andrew Heiss and his JSONFeed Pelican plug-in. GitHub - andrewheiss/pelican_json_feed: Pelican plugin to add a JSON Feed file to your site

json logo

Manton Reece and Brent Simmons — have noticed that JSON has become the developers’ choice for APIs, and that developers will often go out of their way to avoid XML. JSON is simpler to read and write, and it’s less prone to bugs.

So we developed JSON Feed, a format similar to RSS and Atom but in JSON. It reflects the lessons learned from our years of work reading and publishing feeds.

JSON Feed


Python - Multithreaded Programming

The Threading Module The newer threading module included with Python 2.4 provides much more powerful, high-level support for threads than the thread module discussed in the previous section.

The threading module exposes all the methods of the thread module and provides some additional methods −

threading.activeCount() − Returns the number of thread objects that are active. threading.currentThread() − Returns the number of thread objects in the caller's thread control. threading.enumerate() − Returns a list of all thread objects that are currently active. In addition to the methods, the threading module has the Thread class that implements threading. The methods provided by the Thread class are as follows −

run() − The run() method is the entry point for a thread. start() − The start() method starts a thread by calling the run method. join([time]) − The join() waits for threads to terminate. isAlive() − The isAlive() method checks whether a thread is still executing. getName() − The getName() method returns the name of a thread. setName() − The setName() method sets the name of a thread. Creating Thread Using Threading Module To implement a new thread using the threading module, you have to do the following −

Define a new subclass of the Thread class. Override the init(self [,args]) method to add additional arguments. Then, override the run(self [,args]) method to implement what the thread should do when started. Once you have created the new Thread subclass, you can create an instance of it and then start a new thread by invoking the start(), which in turn calls run() method.

Link to the original article


How to import local modules with Python - Quentin Fortier

1st solution: add root to sys.path

We can add the path to the root of the project:

from pathlib import Path import sys path_root = Path(file).parents[2] sys.path.append(str(path_root)) print(sys.path)

import src.c.d view raw

Link to the original article


OpenWonderLabs/SwitchBotAPI: SwitchBot Open API Documents

Open Token and Secret Key

Note: You must update the app to the latest version, V6.14 or later, in order to get the secret key.

In SwitchBot API v1.1, the authentication method has been improved. In order to gain access to private data through the API, you must generate a unique signature using a token and a secret key. When you make a request, the Authorization token and signature will be validated simultaneously.

You as a developer will then be able to add, delete, edit, and look up your data including profile data and data associated with the devices that have been added to your SwitchBot account.

To continue to use SwitchBot API v1.0, refer to the legacy document.

How to Sign?

We have attached a python script for you to quickly generate a sign. If you prefer to write your own script or routine, here is the procedure.

Print the 13 digit timestamp and concatenate it with your token Create a signature using your secret and the string produced in the previous step Convert the signature to upper case

Link to the original article


switchbot-client · PyPI

An unofficial Python client implementation of the SwitchBot API.

Link to the original article


Python 3 - Command Line Arguments

Python provides a getopt module that helps you parse command-line options and arguments.

$ python test.py arg1 arg2 arg3 The Python sys module provides access to any command-line arguments via the sys.argv. This serves two purposes −

sys.argv is the list of command-line arguments. len(sys.argv) is the number of command-line arguments. Here sys.argv[0] is the program ie. the script name.

Link to the original article


Markdown Preview Github Styling - Visual Studio Marketplace

Features

Preview what your markdown will look like rendered on GitHub. Extends VS Code's built-in markdown preview. Includes both light or dark Github themes. Customize styling using your own markdown.styles css

Link to the original article


Peek — The Ultimate macOS Quick Look Extension

Peek — The Ultimate Quick Look Extension Accelerate your workflow with the Quick Look conveniences that only Peek can deliver (for macOS 10.15+): copying, searching, jumping, scroll restoring, syntax highlighting, & more.

Link to the original article


geerlingguy/ansible-for-devops: Ansible for DevOps examples.

This repository contains Ansible examples developed to support different sections of Ansible for DevOps, a book on Ansible by Jeff Geerling.

Most of the examples are full-fledged VM examples, which use Vagrant, VirtualBox, and Ansible to boot and configure VMs on your local workstation. Not all playbooks follow all of Ansible's best practices, as they illustrate particular Ansible features in an instructive manner.

For more interesting examples of what you can do with Ansible, please see the Ansible Vagrant Examples repository, and browse through some of geerlingguy's roles on Ansible Galaxy.

Link to the original article


Makefile Tutorial By Example

Why do Makefiles exist? Makefiles are used to help decide which parts of a large program need to be recompiled. In the vast majority of cases, C or C++ files are compiled. Other languages typically have their own tools that serve a similar purpose as Make. Make can also be used beyond compilation too, when you need a series of instructions to run depending on what files have changed. This tutorial will focus on the C/C++ compilation use case. Here's an example dependency graph that you might build with Make. If any file's dependencies changes, then the file will get recompiled:

Link to the original article


How to install Ansible on Ubuntu Server 22.04 | TechRepublic

How to install Ansible

Because Ansible is found in the standard repositories, the installation is as simple as logging in to your controller node and issuing the command:

sudo apt-get install ansible -y

The installation will pick up a large number of dependencies and will take anywhere from 2-10 minutes to complete.

We’ll also need to install a second piece of software, called SSHpass, which is a non-interactive password provider — otherwise you’d have trouble with SSH authentication. Install SSHPass with:

sudo apt-get install sshpass -y

Link to the original article


Make your first open source contribution - Marko Denic - Web Developer

By doing open source contributions, you will learn a lot. It allows you to become a part of the open-source community. It can be hard at the beginning, but it’s definitely worth it. How do you make a pull request? How to ask the maintainers to merge it? Let’s start!

First of all, you should know the basics of git. You’ll need a GitHub account as well. If you don’t have one, you can create it here. Step 1: Find a project you want to contribute to.

If you want to practice a little bit first, you can use this demo repository. Don’t worry, I created it for this purpose.

Link to the original article


"Markdown cheat sheet by GitHub https://t.co/S7eJwKssFT" / Twitter

GitHub uses a syntax called Markdown to format text. As many Python folks use GitHub, here’s a handy reference to how Markdown encodes the typical document formats including bold/italic/lists and much more – Twitter (open for full two page reference).

Link to the original article


Markdown Cheat Sheets

Concise information about GitHub markdown


Running Virtual Machines Under Vagrant on the New Mac M1 | by James Cundle | Better Programming

Running Virtual Machines Under Vagrant on the New Mac M1 Finding a working VM alternative when VirtualBox no longer works

Link to the original article


Monitor your Internet with a Raspberry Pi | Jeff Geerling

The Internet Pi runs Pi-hole for DNS privacy and ad-blocking, and Prometheus and Grafana to provide Internet connection monitoring dashboards.

Having a Pi monitoring my Internet continuously makes it easy to see trends over time, or confirm outages. If you just spot check by running a Speedtest every now and then, you don't have much data to go on.

Link to the original article


Raspberry Pi DNS Settings: How to Change the DNS - Pi My Life Up

The process of changing the DNS server on your Raspberry Pi is a pretty simple process and involves modifying a single file. In addition to showing you what file you will need to edit, we will also walk you through a couple of methods of ensuring your Raspberry Pi is using your newly set DNS.

There are many reasons why you might want to utilize a different DNS server to your ISP’s default. One of the top reasons being performance. Many ISP provided DNS servers can be incredibly slow at lookups and sometimes can take ages to update and add domains.

There is also the privacy factor to be considered, typically your ISP’s DNS server will leak your IP address as well as cache details about what websites you are visiting. Alternatives like Cloudflare 1.1.1.1 offer increased privacy by not logging any identifiable data and offering HTTPS over DNS.

If you’re looking to set up a dynamic DNS for accessing your Raspberry Pi then our tutorial on port forwarding and setting up Dynamic DNS will help you out. This tutorial simply goes into the steps of changing the way your Pi resolves domain names.

Link to the original article


Paste URL - VS Code Extension

VS Code Plugin

Paste URL handy VS Code extension that formats URLs pasted into md documents as correct md links.

The developer website is found at GitHub - kukushi/PasteURL

For more information check out their extension on the Marketplace

Special Features

  • If you highlight text before pasting the text becomes the link text.
  • If you just paste, then it will fetch the title text of the linked page.

Recommendation

  • Update the VS Code keyboard shortcuts key-binding for quick URL pasting experience. I use cmd-b.

Paste Image - VS Code Extension

VS Code Plugin

Paste Image is a VS Code plugin that allows you to paste images into md documents. It's currently on version 1.0.4 with over 226,000 downloads.

The developer website is found at GitHub

For complete details visit the VS Code marketplace.

The only downside is it was last updated on 01/23/2019.

Ideas on how to setup

  • settings --> pasteimage
    • for setting path and filename options
    • pastes image into current_document_folder/images
    • prepends documentname_ to image name
    • pastes formatted md url at cursor in current
  • change the keyboard shortcut
    • I use ctrl-v to paste image from clipboard

Python in Visual Studio Code – August 2022 Release - Python

Microsoft announces the availability of the Python and Jupyter extensions for Visual Studio @Code - August 2022. Updates include a new Python Tools extension template, Web app debug setups that are automatically generated and more. #Python #Jupyter

Link to the original article


SFTP - Visual Studio Marketplace

sftp sync extension for VS Code

New version by @Natizyskunk that just work 😀 (This was originally a fork from liximomo's SFTP plugin)

VS Code marketplace : https://marketplace.visualstudio.com/items?itemName=Natizyskunk.sftp VSIX release : https://github.com/Natizyskunk/vscode-sftp/releases/ Syncs your local directory with a remote server directory. Allows you to optionally edit upload a file to the remote directory after it saves locally. This allows you to edit more or less directly on the server similar to WinScp or other similar programs.

Link to the original article


Setting Up a Developer Environment Using Docker

A Docker-based Dev Environment The dev environment I wish to build will be based on Linux. Frequently, I wish to quickly spin up a Linux environment for fun and dev. Although a VM is awesome, I want something lighter, something that spins up instantly at almost zero cost. And I want something that, if I left it running, I wouldn't even notice.

Docker images always start from a base image. The reason I picked Linux is because Linux comes with the most stripped-down bare-bones starter image. This means that all of the images I build on top of it will be light too, and I get to pick exactly what I want.

Link to the original article


"Docker-composing" a Python 3 Flask App Line-by-Line | by Luis Ferrer-Labarca | BitCraft | Medium

"Docker-composing" a Python 3 Flask App Line-by-Line This is a continuation of our article: “Dockerizing a Python 3 Flask App Line-by-Line”. In this article I will assume you have some basic knowledge on Docker, so make sure to read that first if Docker is completely new to you.

Link to the original article


Getting Started - IOTstack

New installation¶

automatic (recommended)¶

Install curl:

$ sudo apt install -y curl Run the following command:

$ curl -fsSL https://raw.githubusercontent.com/SensorsIot/IOTstack/master/install.sh | bash Run the menu and choose your containers:

$ cd ~/IOTstack $ ./menu.sh Bring up your stack:

$ cd ~/IOTstack $ docker-compose up -d

Link to the original article