Skip to content

Instantly share code, notes, and snippets.

View JonTheNiceGuy's full-sized avatar

Jon "The Nice Guy" Spriggs JonTheNiceGuy

View GitHub Profile

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:
@JonTheNiceGuy
JonTheNiceGuy / AAA_README.md
Created June 28, 2022 13:42
Karabiner for OS X Keyboard Remapping
/---------------------------------------------------- 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

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.