Skip to content

Instantly share code, notes, and snippets.

View alastairhm's full-sized avatar

Alastair Montgomery alastairhm

View GitHub Profile
@alastairhm
alastairhm / gist:5185969
Last active December 15, 2015 02:19 — forked from RC1140/gist:3299197
#include <LiquidCrystal.h>
#include <string.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
char message[] = "This is some long message that will end up scrolling";
int previous = 0;
int pos = 0;

Keybase proof

I hereby claim:

  • I am alastairhm on github.
  • I am alastairhm (https://keybase.io/alastairhm) on keybase.
  • I have a public key whose fingerprint is 49E7 6E2A 660F B90E 287E 0359 FF26 CADE 8D86 70C1

To claim this, I am signing this object:

@alastairhm
alastairhm / Dockerfile.slack
Last active August 12, 2016 10:47 — forked from alexellis/Dockerfile.slack
Slack Dockerfile for 2.1.0
FROM debian:stretch
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gconf2 \
@alastairhm
alastairhm / socat.sh
Created August 12, 2016 10:50
On the Mac, create a tunnel from an open X11 port (6000) through to the local UNIX socket where XQuartz is listening for connections
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
@alastairhm
alastairhm / vpn_setup.sh
Created April 20, 2017 11:02
Setting up Dockerized VPN
export OVPN_DATA="ovpn-data"
docker run --name $OVPN_DATA -v /etc/openvpn busybox
docker run --volumes-from $OVPN_DATA --rm kylemanna/openvpn ovpn_genconfig -u udp://$1:1194
docker run --volumes-from $OVPN_DATA --rm -it kylemanna/openvpn ovpn_initpki
docker run --volumes-from ovpn-data -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
@alastairhm
alastairhm / newcert.sh
Created April 20, 2017 11:05
Create a new VPN cert
#!/bin/bash
export OVPN_DATA="ovpn-data"
docker run --volumes-from $OVPN_DATA --rm -it kylemanna/openvpn easyrsa build-client-full ${1} nopass
docker run --volumes-from $OVPN_DATA --rm kylemanna/openvpn ovpn_getclient pizero > ${1}.ovpn
@alastairhm
alastairhm / systemd.erb
Created October 20, 2017 11:01
Puppet ERB template for generating Minio cluster systemd control script.
[Unit]
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
After=syslog.target network.target
AssertFileIsExecutable=<%= @installation_directory %>/minio
[Service]
WorkingDirectory=<%= @installation_directory %>
@alastairhm
alastairhm / template.rb
Created October 20, 2017 13:51
Ruby ERB inline templating
require 'erb'
service = "localhost.local"
node = "localhost"
port = "port"
#simple_template = "<%= node %>:<%= port %>"
simple_template = "<%= service %>"
output = ERB.new(simple_template).result()
@alastairhm
alastairhm / redirect.sh
Created April 18, 2018 20:35
Redirect 443 to higher port using IP tables.
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 18079
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 443 -j REDIRECT --to-ports 18079
iptables-save
alias ..='cd ..'
alias ...='cd ../..'
alias ls='ls -G'
alias ll='ls -lG'
alias dir='ls -lG'
alias gits='git status'
alias gs='git status'
alias gl='git log'
alias ga='git add'
alias gd='git diff'