Skip to content

Instantly share code, notes, and snippets.

tomdavidson /
Created June 16, 2015 16:46
Install VirtualBox on OSX
# install lastest virtualbox and extenion pack releases
VBOX_LATEST_FILE_OSX=$(wget -q${VBOX_LATEST_VERSION}/MD5SUMS -O- | grep -i "OSX.dmg" | cut -d"*" -f2)
hdiutil mount /tmp/${VBOX_LATEST_FILE_OSX}
sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target /
hdiutil unmount /Volumes/VirtualBox
tomdavidson /
Created June 16, 2015 20:52
database load script to use with docker, waits for db server to reply to ping.
tar -xvf /tmp/build-data/sandbox_sql.tar.gz -C /tmp/build-data
while ! ping -c1 expressionengine &>/dev/null; do sleep 2; echo "waiting on expressionengine"; done
mysql -hexpressionengine -uroot -proot sandbox_expressionengine < /tmp/build-data/sandbox_expressionengine.sql
while ! ping -c1 wowzalicensing &>/dev/null; do sleep 2; echo "waiting on wowzalicensing"; done
mysql -hwowzalicensing -uroot -proot sandbox_wowzalicensing < /tmp/build-data/sandbox_wowzalicensing.sql
while ! ping -c1 wowzamedia &>/dev/null; do sleep 2; echo "waiting on wowzamedia"; done
tomdavidson / geoip-ut-to-ut.js
Created December 31, 2015 06:17
redirects utah ip addresses to the utah home page
View geoip-ut-to-ut.js
(function() {
var geoIpServiceUrl = '';
var redirectUrl = '';
var isBotSpider = Boolean(navigator.userAgent.match(/bot|spider/i));
var alreadyUtRedirected = Boolean(document.cookie.replace(/(?:(?:^|.*;\s*)utRedirected\s*\=\s*([^;]*).*$)|^.*$/, '$1'));
var atRoot = window.location.pathname === '/';
var shouldRedirect = atRoot && !alreadyUtRedirected && !isBotSpider;
function redirect(response) {
tomdavidson /
Last active May 16, 2016 18:21
install ssl cert on aws, including creating intermediate for a complete chain
# unofficial bash strict mode
set -euo pipefail
# Run script from dir with both certificate files and the private key
# certificate name on AWS
View allow-user-iam.json
"Version": "2012-10-17",
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
tomdavidson /
Created September 1, 2019 08:56
the find file sub mod
variable "filter" {
type = string
default = "*.yaml"
description = "The pattern used to filter files, i.e. '*.yaml'."
variable "search_dir" {
type = string
default = "."
description = "The the directory to search from. Default is '.'."
tomdavidson /
Last active September 3, 2019 21:31
tf to create children teams after looking up parent ids
## Existing list of teams with members list:
"0" = {
"description" = "No one cared enough to add a description to this team"
"members" = [
"role" = "maintainer"
"username" = "bob"
#!/usr/bin/env bash
help() {
cat <<EOF
Simple monorepo lifecycle/pipeline tool for running one or more commands on one
or more directories that have diffs compared to an ansector. The primary
use case is for selective CI jobs within a trunk based workflow.
Takes two arguments, <glob> <command>. The command is invoked from each
directory context matching the glob.
tomdavidson /
Created December 5, 2019 06:41
Terraform example loading config from dir of files
variable "config_files_path" {
default = "../../teams/*.yaml"
description = "The path to team config files"
data "local_file" "configs" {
for_each = { for k, file in fileset(dirname(var.config_files_path), basename(var.config_files_path)) :
k => abspath("${dirname(var.config_files_path)}/${file}")
tomdavidson /
Created April 15, 2015 03:46
Android route hotspot traffic over vpn
iptables -t filter -F FORWARD
iptables -t nat -F POSTROUTING
iptables -t filter -I FORWARD -j ACCEPT
iptables -t nat -I POSTROUTING -j MASQUERADE
ip rule add from lookup 61
ip route add default dev tun0 scope link table 61
ip route add dev wlan0 scope link table 61
ip route add broadcast dev wlan0 scope link table 61