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 May 12, 2025 10:37
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)
@samveen
samveen / setup-vpn.sh
Last active March 1, 2025 07:25
MicroHOWTO - NetworkManager controlled OpenVPN connections
#!/bin/bash
# {MicroHOWTO|Script} to setup a NetworkManager controlled openvpn connection
# OVPN Config file is the parameter to the script (no checks, blind faith)
OVPN_CONF="$1"
# Install the requirements if not available
# SUDO REQUIRED
sudo apt install -y openvpn network-manager-openvpn # Debian 10/*buntu 20.04 and later
# yum -y install openvpn NetworkManager-openvpn # RHEL 7/Rocky 7/Fedora ?? and later
@alwynallan
alwynallan / Makefile
Last active February 22, 2025 16:37
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 May 13, 2025 04:22
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 <[email protected]>
# 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
@malcolmgreaves
malcolmgreaves / git-largest-files
Last active August 19, 2024 03:12 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Updated to use Python 3 by Malcolm Greaves.
#
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch