Skip to content

Instantly share code, notes, and snippets.


Troy Fontaine troyfontaine

View GitHub Profile
troyfontaine /
Last active Nov 25, 2020
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or

troyfontaine /
Last active Nov 19, 2020
HAProxy Redirecting based on an HTTP Query or a Map with a fallback redirect based on host header
# This file contains only partial paths to match on
# This file should reside in the same directory as the haproxy.cfg simply due to the way it is configured in the sample snippet-but they can go anywhere in the /etc/haproxy directory
troyfontaine /
Last active Nov 17, 2020
Resize root partition (or how to remove the default /home partition) on CentOS 7 online

Resize root partition (or how to remove the default /home partition) on CentOS 7 online

This requires you to be able to ssh into the instance using the root user account and that no services be running as users out of /home on the target machine.

The examples are from a default installation with no customation-you NEED to know what you're working with for volumes/partitions to not horribly break things.

By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and

Step 1 - Copy /home Contents

To backup the contents of /home, do the following:

troyfontaine / Docker-Compose.yml
Created Nov 29, 2019
Pihole Docker Container with IPv6 Support
View Docker-Compose.yml
version: "3"
# More info at and
container_name: pihole
image: pihole/pihole:latest
- "53:53/tcp"
- "53:53/udp"
troyfontaine /
Last active Nov 2, 2020
USG ddclient Upgrade Script

How to use this script?

Why, that's simple! Copy this script to your USG, run chmod +x on it and then, as a user with sudo permission, execute it.

Shamelessly borrowed from Brittanic on the Ubiquiti Unifi forums

How to use it?

Simply run the following command (note, if you are at all security concious-don't run it and instead review the script, then copy it to your USG to execute).

curl | sudo bash
troyfontaine /
Created Aug 13, 2020
Fixed Close All RabbitMQ Connections

Fixed command to close connections to RabbitMQ

rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name| grep -vP 'Listing|pid' | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "sh" }'
troyfontaine /
Last active Aug 7, 2020
Ubiquiti USG config.gateway.json Syntax

Ubiquiti USG Advanced Configuration


Integrated DNS Overview

When using a USG with Ubiquiti's Unifi Controller software (version 5.6 and earlier), the functionality of integrating the hostnames of clients (when they request a DHCP lease) into local DNS does not appear to work as you would find with Consumer grade routers. To work around this limitation, we can add static host mappings to a configuration file that will be provisioned to the USG when either a configuration change is made or we force provisioning to the USG itself.

Non-GUI Supported Dynamic DNS Providers

I've added in the necessary syntax for adding Cloudflare DDNS to the USG for VPN/Services setup courtesy of this post by britannic on the Ubiquiti Forums.

Configuration File

troyfontaine /
Last active Aug 7, 2020
Yubikey for AWS-Vault

How to Set up Yubikey for AWS-Vault

Tired of using a password for aws-vault? Want to use that lovely touch pad on your Yubikey? Here is how! (Shamelessly borrowed from this comment by Frederico Araujo). Note, this is not the same as configuring your terminal to use a Yubikey setup to be used as TOTP for AWS-instead of an app!

NOTE: These steps are for use on macOS and should be similar for Linux

  1. Remove existing credential from AWS Vault Run only if you already have it setup before:

     aws-vault remove myprofile
troyfontaine / myserver.xml
Created Jan 25, 2016
KVM Virtual Machine Template XML
View myserver.xml
<domain type='kvm'>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>4</vcpu>
<type arch='x86_64' machine='pc-i440fx-wily'>hvm</type>
<boot dev='hd'/>
troyfontaine /
Created Dec 12, 2019
Bash script to Delete/Remove Private Github Packages
# Really crappy script that works to delete private packages stored on Github Packages
# Intended to simplify deleting packages that are counting against your limit
# By Troy Fontaine (
# First displays the private packages name then the version finally the ID needed to delete it
# Then prompts you if you want to delete the packages based on the ID
You can’t perform that action at this time.