Skip to content

Instantly share code, notes, and snippets.

View alanbchristie's full-sized avatar

Alan B. Christie alanbchristie

View GitHub Profile
@alanbchristie
alanbchristie / dm.code-workspace
Last active December 21, 2022 08:19
VS Code DM Workspace file
{
"folders": [
{
"path": "squonk2-data-manager.wiki"
},
{
"path": "squonk2-data-manager"
},
{
"path": "squonk2-data-manager-ansible"
@alanbchristie
alanbchristie / useful-vs-extensions.txt
Last active December 22, 2022 10:18
Useful VS Code Extensions
I find the following VisualStudio Code extensions useful for general development.
- Python Extensions Pack (Don Jayamanne)
- SQLTools (Matheus Teixeira)
- SQLTools PostgreSQL/Cockroach Driver (Matheus Teixeira)
- Code Spell Checker (Street Side Software)
- Conventional Commits (vivaxy)
@alanbchristie
alanbchristie / group_contractor.py
Created September 22, 2022 14:00
Optimised group compression
#!/usr/bin/env python
"""A recursive Python 3 utility to combine ('contract') a numerical sequence of
'objects' ensuring that combinations of consecutive objects only occurs once.
The sequence of objects is referred to by a numerical index with a minimum value of
'1' and a contiguous unbroken sequence of values up to 'N'.
This optimises the calculation of different combinations by ensuring that
no two consecutive combinations are computed more than once. The user is expected to
iteratively combine 'M' groups of objects using different 'partitions'.
@alanbchristie
alanbchristie / build-it.sh
Last active April 30, 2022 06:56
Build ARM64 images with buildx
# See https://docs.docker.com/buildx/working-with-buildx
# Here I'm on macOS (11.6.5)
# and using Docker Desktop (4.7.1)
# Multi-architecture build (Docker Desktop)
# Create an isolated buildx instance...
docker buildx create --name mybuilder
docker buildx use mybuilder
# Build something for amd64 and arm64...
@alanbchristie
alanbchristie / .cz.yaml
Created April 12, 2022 14:21
IM commitizen CHANGELOG configuration
---
# Commitizen custom configuration.
# Here we extend it to add all our recognised types into the changelog.
# The default ignores pretty-much anything other than 'feat' and 'fix'.
#
# See the default at...
# https://github.com/commitizen-tools/commitizen/
# blob/095f02e6c419b60c90aa84b8cebc9e9eacc8a391/commitizen/defaults.py#L83
commitizen:
name: cz_customize
@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
# 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 / 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
@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 / 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: -
#