Skip to content

Instantly share code, notes, and snippets.

View JonTheNiceGuy's full-sized avatar

Jon "The Nice Guy" Spriggs JonTheNiceGuy

View GitHub Profile
@JonTheNiceGuy
JonTheNiceGuy / AAA_README pullImage Functions.md
Last active December 4, 2025 13:57
crictl pull image using ecr-credential-provider

pullImage Functions

A while back I wrote a blog post about using Credential Providers to automate getting secrets for pulling images for Kubernetes.

Today I had cause to go back to look at that when my cluster was failing to pull images (because they didn't exist, foolishly) and I decided I needed a way to automatically check whether I could actually pull the images. Unlike with the docker credential helpers, you can't just "pull" an image, you need to tell crictl what credentials to use (as this is usually handled by kubelet), so I wrote the first script - ecr_pullImage.function.sh. After a short while I realised it would be more useful to be able to pull from several image sources, and asked Claude to enhance the script to figure out what

@JonTheNiceGuy
JonTheNiceGuy / get-github-asset.sh
Last active September 24, 2025 08:27
Get Github Asset in Bash
#!/bin/bash
AGENT=""
TRY_WGET=1
TRY_CURL=1
if [ "$TRY_WGET" == "1" ] && command -v wget >/dev/null 2>&1
then
AGENT=wget
elif [ "$TRY_CURL" == "1" ] && command -v curl >/dev/null 2>&1
then

Gluster Setup Scripts for Proxmox

Following my blog post about setting up a Proxmox cluster with GlusterFS, this script automates the settings needed for a gluster disk.

PHPIPAM Bulk Add Subnets.py

This is a simple script to help build up a load of subnets in quick order!

Add your subnets to the list starting at line 76 called "make_subnets", run pip3 install -r requirements.txt and then python3 phpipam_bulk_add_subnets.py

Your result should be like this:

@JonTheNiceGuy
JonTheNiceGuy / get_cert_digest.bash
Created May 5, 2023 16:08
A bash script which gets the certificate SHA256 hashes of certificates in a chain, or for an individual certificate
#!/bin/bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
if [ -z "${KEEP:-}" ] && [ -n "${tempdir:-}" ]
then
rm -Rf "$tempdir"
fi
@JonTheNiceGuy
JonTheNiceGuy / AAA_Docker Minecraft Server README.md
Created December 15, 2022 10:06
This is an Ansible Playbook to monitor a git repo for players to add (or remove) and then restart the relevant docker containers using `docker-compose`. I use this to manage the players on a minecraft server I run.

Docker Minecraft Server

This is an Ansible Playbook to monitor a git repo for players to add (or remove) and then restart the relevant docker containers using docker-compose. I use this to manage the players on a minecraft server I run.

In this repo, you'll find the actual ansible playbook (playbook.yml), the crontab-able run_playbook.sh (which silences unchanged plays) and the template I'm using (templates=docker-compose.yml). There is also an example vars file (host_vars=localhost=vars.yml) to show the basics of what this file would look like. Note that directory structures in gists are not permitted, so I've replaced / with = in each filename.

blueprint:
name: Turn off Light after Time has elapsed
description: Given a light entity, watch for it turning on, and then turn it off after a certain period of time.
domain: automation
input:
light:
name: Light
description: Select the light to monitor and control
selector:
entity:
blueprint:
name: Turn off Switch after Time has elapsed
description: Given a switch entity, watch for it turning on, and then turn it off after a certain period of time.
domain: automation
input:
switch:
name: Switch
description: Select the switch to monitor and control
selector:
entity:
@JonTheNiceGuy
JonTheNiceGuy / Turn Off Light After Time.yaml
Last active October 7, 2022 13:23
Deprecated - uses wrong selector
blueprint:
name: Turn off Light after Time has elapsed
description: Given a light entity, watch for it turning on, and then turn it off after a certain period of time.
domain: automation
input:
light:
name: Light
description: Select the light to monitor and control
selector:
entity:
@JonTheNiceGuy
JonTheNiceGuy / Turn Off Switch After Time.yaml
Last active February 19, 2023 13:24
Deprecated - uses wrong selector
blueprint:
name: Turn off Switch after Time has elapsed
description: Given a switch entity, watch for it turning on, and then turn it off after a certain period of time.
domain: automation
input:
switch:
name: Switch
description: Select the switch to monitor and control
selector:
entity: