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 / Vagrant + MicroK8S - README.md
Last active July 9, 2025 02:07
Using Vagrant with MicroK8S to experiment with Kubernetes

Using Vagrant with Multi-Node MicroK8S to experiment with Kubernetes

This script (using Vagrant) is used to build a pair of Ubuntu based virtual machines that have the MicroK8S setup of Kubernetes.

It also installs docker, and sets up aliases for kubectl in line with the MicroK8S documentation.

Please note that this script relies on the fact that Vagrant transfers files in /vagrant to the host file system, which we can then use to setup the second node.

@JonTheNiceGuy
JonTheNiceGuy / ink_level.sh
Last active May 12, 2020 08:17
Canon MG3050 Printer Ink Level reporting tool
#!/bin/bash
rc=0
function matchIP() {
# These regex based on https://stackoverflow.com/a/17871737
if echo "$1" | egrep '^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$' >/dev/null 2>/dev/null
then
echo 4
return 4
elif echo "$1" | egrep '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,
4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:
@JonTheNiceGuy
JonTheNiceGuy / AAA_Readme for wp-upgrade.sh.md
Created June 5, 2020 07:20
A simple script to upgrade all wordpress components in cron

wp-update.sh

A simple tool to update and upgrade Wordpress components

A few years ago, I hosted my blog on Dreamhost. They've customized something inside the blog which means it doesn't automatically update itself. I've long since moved this blog off to my own hosting, but I can't figure out which thing it was they changed, and I've got so much content and stuff in here, I don't really want to mess with it.

Anyway, I like keeping my systems up to date, and I hate logging into a blog and finding updates are pending, so I wrote this script. It uses wp-cli which I have installed to /usr/local/bin/wp as per the install guide.

@JonTheNiceGuy
JonTheNiceGuy / The Rules.md
Last active May 27, 2022 11:30
Transcribed rules for Scotland Yard (lightly edited for clarity), based on the scan at https://boardgamegeek.com/filepage/4035/scotlandyardpdf

Scotland Yard
A compelling detective game

For 3 to 6 Players

The Scene

Mr. X, a most-wanted criminal is on the run in Central London and Scotland Yard's finest detectives are in hot persuit. To escape capture, Mr. X must move cleverly and secretly (Mr. X's whereabouts are revealed only as many as 5 times during the game); to corner Mr. X, the detectives must use ingenuity and cooperation.

One player is Mr. X. All other players are the detectives. Whether one is being chased or doing the chasing, all players travel from location to location by bus, taxi or underground. To take a certain form of transportation, you must be on the correct boarding spot and have the correct fare - no ticket, no ride!

Jekyll Git Status

Installing this plugin

  1. Create a _plugins directory in the root of your Jekyll site.
  2. Place the ruby script into that directory. This can be done by either:
    1. Downloading the "raw" version of the jekyll-git-status.rb into that directory.
    2. Cloning this gist into that directory as a submodule.
    3. Creating a new file, with the extension .rb in that path, and pasting in the content below.
/---------------------------------------------------- Read the following file. Usually just the last 10 characters, but options
| follow.
| /---------------------------------------------- Follow the file, without stopping when it gets to the end of the "defined"
| | size to read.
| | /------------------------------------------- Define the number of lines to read.
| | | /----------------------------------------- Don't read any lines (-n 0) In this case because you might be following
| | | | binary files!
| | | | /--------------------------------------- $() executes the comand within the braces, and uses "STDOUT" as this value.
| | | | | /------------------------------------- Find lists all the files (or directories) which match the criteria.
| | | | | | /-------------------------------- The path to look for files in. All files
@JonTheNiceGuy
JonTheNiceGuy / AAA_README.md
Created June 28, 2022 13:42
Karabiner for OS X Keyboard Remapping
@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:
@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: