Skip to content

Instantly share code, notes, and snippets.

@sjjf
sjjf / ubuntu22.04.yaml.tmpl
Created June 3, 2023 04:13
Sample xCAT Subiquity template
#cloud-config
autoinstall:
version: 1
apt:
primary:
- arches:
- amd64
uri: http://au.archive.ubuntu.com/ubuntu/
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active April 29, 2024 13:48
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
@samneggs
samneggs / defender.py
Created January 30, 2023 04:35
Defender game on Pi Pico in MicroPython
from LCD_1inch14 import LCD_1inch14
from machine import Pin,SPI,PWM, Timer
import framebuf, math
import utime, gc
from random import randint
from usys import exit
from micropython import const
class Obj():
def __init__(self,x,y,ax,ay,w,h):
@aallan
aallan / ap_webserver.py
Created July 7, 2022 13:43
Running a web server on an wireless Access Point for Raspberry Pi Pico W in MicroPython
import socket
import network
import machine
ssid = 'MicroPython-AP'
password = '123456789'
led = machine.Pin("LED",machine.Pin.OUT)
ap = network.WLAN(network.AP_IF)
@alwynallan
alwynallan / Makefile
Last active April 4, 2024 04:42
Hardware PWM Controller for the Raspberry Pi 4 Case Fan
CC = gcc
RM = rm -f
INSTRUMENT_FOR_PROMETHEUS := false
ifeq ($(INSTRUMENT_FOR_PROMETHEUS),true)
CFLAGS = -Wall -DINSTRUMENT_FOR_PROMETHEUS
LIBS = -lbcm2835 -lprom -lpromhttp -lmicrohttpd
else
CFLAGS = -Wall
@andrebrait
andrebrait / keychron_linux.md
Last active April 25, 2024 13:24
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@mdrisser
mdrisser / uping.py
Last active March 2, 2023 07:37 — forked from shawwwn/uping.py
µPing: Ping library for MicroPython
# µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <shawwwn1@gmail.com>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# Fork of original code: Added average response time and fixed issue with urandom.randint() not working
# Author: Mike Risser
@ghelobytes
ghelobytes / convert.py
Created March 21, 2019 02:29
Convert s3 url to http url
def s3_to_http(url):
if url.startswith('s3://'):
s3_path = url
bucket = s3_path[5:].split('/')[0]
object_name = '/'.join(s3_path[5:].split('/')[1:])
return 'https://s3.amazonaws.com/{0}/{1}'.format(bucket, object_name)
else:
return url
@angela-d
angela-d / gpg-key-migration.md
Created April 1, 2018 23:57
Move GPG Keys from One Machine to Another

Migrate GPG Keys from One Workstation to Another

Replace [your key] with your key ID

To obtain your key ID

gpg --list-secret-keys --keyid-format LONG

Which returns something like

@TimJDFletcher
TimJDFletcher / GNUPG_agent_forwarding.md
Last active April 29, 2024 12:48 — forked from surhudm/GNUPG_agent_forwarding.md
GnuPG agent forwarding

Forward GnuPG agent from macOS to Linux

On the remote machine

Run gpg once as your to create the directory structure

gpg --list-keys

For headless systemd based hosts