Assuming macOS and an SD card presented as /dev/rdisk3:
For ARMv7 (Pi 2):
diskutil unmountDisk disk3
xzcat ubuntu-18.04.2-preinstalled-server-armhf+raspi2.img.xz | sudo dd of=/dev/rdisk3 bs=32m
[[language]] | |
name = "python" | |
scope = "source.python" | |
injection-regex = "python" | |
file-types = ["py","pyi","py3","pyw",".pythonstartup",".pythonrc"] | |
shebangs = ["python"] | |
roots = [".", "pyproject.toml", "pyrightconfig.json"] | |
comment-token = "#" | |
language-servers = ["pyright", "ruff"] | |
indent = { tab-width = 4, unit = " " } |
#!/usr/bin/env python | |
""" | |
A simple producer/consumer example, using Queue.task_done and Queue.join | |
From https://asyncio.readthedocs.io/en/latest/producer_consumer.html | |
""" | |
import asyncio | |
import random |
Installing Python 3.7.4 on Raspbian =================================
As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.4. This means we will have to build it ourselves, and here is how to do it.
Install the required build-tools (some might already be installed on your system).
package main | |
import ( | |
"golang.org/x/sys/unix" | |
"log" | |
"os" | |
) | |
func main() { | |
file, err := os.Open("/sys/class/somefile") |
package main | |
import ( | |
"fmt" | |
"github.com/spf13/viper" | |
) | |
// Create private data struct to hold config options. | |
type config struct { |
import { v4 as uuid } from 'uuid'; | |
export function generateId() { | |
return uuid(); | |
} | |
const v4 = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i); | |
console.log(generateId().match(v4)); | |
//console.log(generateId().length) |
#!/usr/bin/env zsh | |
# ------------------------------------------------------------------------------ | |
# Prompt for the Zsh shell: | |
# * One line. | |
# * VCS info on the right prompt. | |
# * Only shows the path on the left prompt by default. | |
# * Crops the path to a defined length and only shows the path relative to | |
# the current VCS repository root. | |
# * Wears a different color wether the last command succeeded/failed. | |
# * Shows user@hostname if connected through SSH. |
# WOrks in python 2.7 not sure if it works in python 3. | |
# Just straight up connect by any means possible. | |
from ftplib import FTP_TLS | |
def connect(): | |
ftp = FTP_TLS() | |
ftp.debugging = 2 | |
ftp.connect('localhost', 2121) | |
ftp.login('developer', 'password') |
# Original Source: | |
# https://gist.github.com/ggrandes/a57c401f1bad6bd0ffd87a557b7b5790 | |
# SIGN / VERIFY | |
openssl cms -sign -keyid -md sha256 -nodetach -binary -in /etc/passwd -signer user.crt -inkey user.key -out x.smime -outform SMIME | |
openssl cms -verify -CAfile ca.crt -in x.smime -inform SMIME | |
# ENCRYPT / DECRYPT | |
openssl cms -encrypt -keyid -aes-256-cbc -in /etc/passwd -binary -out x.smime -outform SMIME user.crt | |
openssl cms -decrypt -in x.smime -inform SMIME -recip user.crt -inkey user.key |