Skip to content

Instantly share code, notes, and snippets.


Chris Swan cpswan

View GitHub Profile
cpswan /
Created Jan 22, 2017
Example Network UPS Tool (NUT) configs
import os
import sys
import smtplib
import mimetypes
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEAudio import MIMEAudio
from email.MIMEImage import MIMEImage
cpswan / named.conf
Last active Oct 20, 2020
Unbound/BIND config for DNS over TLS to
View named.conf
options {
directory "/tmp";
listen-on-v6 { none; };
forwarders { port 2053;
auth-nxdomain no; # conform to RFC1035
cpswan /
Created Aug 4, 2015
Extract VPC DNS IP from AWS instance metadata
MAC="$(curl -s"
VPCCIDR="$(curl -s"$MAC"/vpc-ipv4-cidr-block)"
VPCBASE="$(echo "$VPCNET" | cut -d"." -f1-3)"
echo "$VPCDNS"
cpswan / nginx.conf
Last active Jul 26, 2020
Using nginx to proxy to an AWS ELB
View nginx.conf
daemon off;
worker_processes 1;
events { worker_connections 1024; }
sendfile on;
cpswan / autossh_screen.service
Created May 3, 2019
systemd service description for autossh tunnel within a screen
View autossh_screen.service
Description=AutoSSH tunnel in a screen
ExecStart=/usr/bin/screen -DmS tunnel1 /usr/lib/autossh/autossh -M 20020 -D
cpswan / mssql.rules
Created Sep 7, 2015
Suricata rule set for MS SQL Server
View mssql.rules
# Emerging Threats
# This distribution may contain rules under two different licenses.
# Rules with sids 1 through 3464, and 100000000 through 100000908 are under the GPLv2.
# A copy of that license is available at
# Rules with sids 2000000 through 2799999 are from Emerging Threats and are covered under the BSD License
# as follows:
cpswan /
Created Jan 21, 2018
Command line to launch UniFi controller in a Docker container
sudo docker run --rm --init -d -p 8080:8080 -p 8443:8443 -p 3478:3478/udp -p 10001:10001/udp -e TZ='Europe/London' -e RUNAS_UID0=false -e UNIFI_UID=1000 -e UNIFI_GID=1000 -v ~/unifi:/unifi --name unifi jacobalberty/unifi:stable
View GameOfLife_20171213.txt
Started by user Chris Swan
Building in workspace /var/jenkins_home/workspace/GameOfLife
Unpacking to /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3 on Jenkins
Cloning the remote Git repository
Cloning repository
> git init /var/jenkins_home/workspace/GameOfLife # timeout=10
Fetching upstream changes from
> git --version # timeout=10
> git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url # timeout=10
cpswan /
Created Dec 24, 2015
Configure systemd to use overlay file system for Docker
sudo mkdir /etc/systemd/system/docker.service.d
sudo bash -c 'cat <<EOF > /etc/systemd/system/docker.service.d/overlay.conf
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay
sudo systemctl daemon-reload
sudo systemctl restart docker
cpswan /
Created Jul 23, 2015
VNS3 IPsec tunnel example
# Set credentials and address for VNS3 manager
# Use IPsec connection 2
# Clear out any existing IPsec tunnels
while true; do
TUNNEL=$(curl -s -k -X GET -u api:"$VNS3_PW" \
https://"$VNS3_IP":8000/api/ipsec | python -mjson.tool \
You can’t perform that action at this time.