Skip to content

Instantly share code, notes, and snippets.

View alanbchristie's full-sized avatar

Alan B. Christie alanbchristie

View GitHub Profile
@alanbchristie
alanbchristie / create-os-server.py
Last active June 26, 2019 10:58
A Python module to create OpenStack server instances (trying again if they fail).
#!/usr/bin/env python
# A create-server utility as it would have been written by 'Robert I'.
# A wrapper around the OpenStack SDK to try (and try again) to create
# OpenStack server instances.
#
# Note: This module DOES NOT provide all the functionality of
# ---- the underlying API, just those bits I need for my work.
#
# You will need your OpenStack environment variables defined
@alanbchristie
alanbchristie / clubhouse-label-update.sh
Created November 10, 2020 09:46
Changing Clubhouse Labels
# A simple example using the Clubhouse API
# to get exiting labels and update them -
# in this case, change their colour.
#
# You'll need: -
#
# curl
# jq
# List labels
@alanbchristie
alanbchristie / first-actions.sh
Last active July 30, 2023 09:54
Raspberry Pi OS - first headless actions
# (Notes written from an OSX host)
# Assuming you've...
#
# - Done 'touch ssh' on the SSD before instering it into the Pi
# - Added a suitable `wpa_supplicant.conf` (if relying on WiFi)
#
# ...here are the first important actions on first boot of the OS.
# Login to the Pi, using the default password 'raspberry': -
@alanbchristie
alanbchristie / fixed-ip.sh
Last active December 15, 2023 07:26
Raspberry Pi OS - setting a fixed IP4 address
# Fixed IP4 address are handy.
# To avoid DHCP you can set a fixed address
# by editing '/etc/dhcpcd.conf'.
#####
# 0 #
#####
# For newer RPi operatign systems (like Debian Bookworm)
# you might need to use this method: -
#
@alanbchristie
alanbchristie / cmdline.txt
Last active May 25, 2022 08:15
Raspberry Pi OS - installing k3s
# You'll need to patch the Pi's `/boot/cmdline.txt`
# by adding `cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1`
# to the end of the existing line (see https://github.com/k3s-io/k3s/issues/2067)
#
# i.e. `/boot/cmdline.txt` should look like something like this: -
console=serial0,115200 console=tty1 root=PARTUUID=b9075e12-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
# Reboot and you should be able to install k3s
# and its agents: -
@alanbchristie
alanbchristie / openvpn.txt
Last active April 18, 2025 12:10
Installing OpenVPN on RPi
# Starting with a Pi flashed with 'Raspberry Pi OS Lite (32-bit)'
#
# I used the following:
#
# - Raspberry Pi 4 Model B Rev 1.1 (4Gi) [cat /proc/cpuinfo]
# - Debian 11.1 [cat /etc/debian_version]
# - Raspbian GNU/Linux 11 (bullseye) [cat /etc/os-release]
#
# And the instructions (pivpn) installs: -
#
@alanbchristie
alanbchristie / pistation-shutdown.txt
Last active April 16, 2025 14:22
Adventures with the PiStation Safe Shutdown feature
# The PiStation Case (for the Raspberry Pi 4)
# is a well built fun case, especially for those
# with a passion for retro-gaming consoles.
# Personally, I love it.
#
# - https://shop.pimoroni.com/products/pistation-case
#
# But installing the 'safe shutdown' feature may get you frustrated.
# The hardware's brilliant, but the shutdown script installation
# needs a little work. There are a number of
@alanbchristie
alanbchristie / noip2.service
Last active February 15, 2022 20:39 — forked from NathanGiesbrecht/noip2.service
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# https://www.noip.com/support/knowledgebase/install-ip-duc-onto-raspberry-pi/
#
# mkdir /home/pi/noip
# cd /home/pi/noip
# wget https://www.noip.com/client/linux/noip-duc-linux.tar.gz
# The juice4halt super-capacitor board for the RaspberryPi
# can be configured to operate using systemd scripts.
# There are a set from https://github.com/skhg/juice4halt
# that I've forked to https://github.com/alanbchristie/juice4halt.
# To seup the follow the simple instructions in the repo, i.e. ...
sudo apt -y install git
git clone https://github.com/alanbchristie/juice4halt.git
cd juice4halt
sudo ./setup.sh
@alanbchristie
alanbchristie / max_stats_watcher.py
Created March 14, 2022 13:30
Keep max CPU and Memory using container stats
#!/usr/bin/env python3
#
# Simple utility to watch the stats for a single docker container.
# It writes stats to two files 'max-cpu.txt' and 'max-mem.txt'
# for the maximum observed CPU and memory.
# The utility runs the stats every 60 seconds.
#
# Stats look like this...
#
# CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS