This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Reads environment file, e.g. `wg-new.env` | |
# Configures WireGuard if it is not yet configured | |
# Adds a new peer with name and IP address | |
# arguments | |
name=$1 | |
ip=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branch=${BRANCH:-$(git symbolic-ref -q --short HEAD)} | |
remote=${REMOTE:-$(git config "branch.$branch.remote")} | |
remote=${remote:-origin} | |
default_branch=${DEFAULT_BRANCH:-$(git config "remote.$remote.defaultBranchName")} | |
default_branch=${default_branch:-$(git remote show $remote | awk '/HEAD branch/ {print $NF}')} | |
if [ -z "$@" ]; then | |
echo "usage: git open-path path/to/file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Install to $PATH | |
# Usage: git diff-stats | |
output=$(git diff $@) | |
echo + $(grep -e '^\+[^\+]' -e '^\+$' <<<"""$output""" | wc -l) | |
echo - $(grep -e '^\-[^\-]' -e '^\-$' <<<"""$output""" | wc -l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST="$1" | |
if [ "$HOST" = "" ]; then | |
echo "usage: $0 <ssh-host>" | |
exit 1 | |
elif [ "$HOST" = "--reconnect" ]; then | |
pkill -USR1 autossh | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Sends a file through an SMTP transaction. | |
Author: Ian Good <ian.good@rackspace.com> | |
""" | |
import sys | |
import smtplib | |
import optparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APPLICATION="chromium" | |
which google-chrome | |
if [ $? -eq 0 ]; then | |
APPLICATION="google-chrome" | |
fi | |
HOST="$1" | |
if [ "x$HOST" = x ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# Author: Ian Good <ian.good@rackspace.com> | |
# Inspired by http://costela.net/projects/awayonlock/ | |
# Use at your own risk! | |
import os | |
import sys | |
import signal | |
import hashlib |