Skip to content

Instantly share code, notes, and snippets.

View ashmckenzie's full-sized avatar

Ash McKenzie ashmckenzie

View GitHub Profile
@ashmckenzie
ashmckenzie / bootstrap.sh
Created September 3, 2012 04:05
Bootstrap for new Ubuntu box
#!/bin/bash
RUBY_VERSION='1.9.3-p194'
sudo apt-get install build-essential
cd /tmp
wget -c http://mirrors.ibiblio.org/ruby/ruby-${RUBY_VERSION}.tar.gz
tar xzf ruby-${RUBY_VERSION}.tar.gz
cd ruby-${RUBY_VERSION}
@ashmckenzie
ashmckenzie / hash_challenge.rb
Last active December 24, 2015 08:59
Create the smallest solution to take the given data hash and produce the desired output (using pure Ruby stdlib)
# Source data
#
data = {
name: 'John Smith',
age: 45,
address: '123 Here St',
email: '[email protected]'
}
# Code here..
env
bundle install --deployment
export DISPLAY=:$$
/usr/bin/Xvfb ${DISPLAY} -ac > /dev/null 2>&1 &
XVFB_PID=$!
/usr/bin/firefox > /dev/null 2>&1 &
FIREFOX_PID=$!
bundle exec rake
kill ${XVFB_PID} ${FIREFOX_PID}
@ashmckenzie
ashmckenzie / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am ashmckenzie on github.
  • I am ashmckenzie (https://keybase.io/ashmckenzie) on keybase.
  • I have a public key whose fingerprint is 5B61 33ED 9A42 5888 38E9 41A4 8077 C600 7FF5 E320

To claim this, I am signing this object:

@ashmckenzie
ashmckenzie / .slate
Created June 12, 2014 00:09
My ~/.slate file
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsIconAlpha 0.3
config windowHintsFontColor 255;255;255;1
config windowHintsBackgroundColor 0;0;0;0.3
config windowHintsShowIcons true
@ashmckenzie
ashmckenzie / .slate.js
Last active August 29, 2015 14:02
Slate JS - goes in ~/.slate.js
function MergeRecursive(obj1, obj2) {
for (var p in obj2) {
try {
// Property in destination object set; update its value.
if ( obj2[p].constructor==Object ) {
obj1[p] = MergeRecursive(obj1[p], obj2[p]);
} else {
obj1[p] = obj2[p];
}
} catch(e) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Wilson Júnior <[email protected]>
import cmd
import sys
import os
import subprocess
import re
import readline
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: master1
[DEBUG ] Missing configuration file: ~/.saltrc
[DEBUG ] Configuration file path: /etc/salt/master
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: master1
[DEBUG ] Missing configuration file: ~/.saltrc
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] LazyLoaded local_cache.get_load
@ashmckenzie
ashmckenzie / run.sh
Created January 22, 2016 00:23
Possible consul KV lookup bug
#!/bin/bash
consul agent \
-bootstrap=true \
-config-file=./consul.hcl \
-data-dir=./consul_data \
-bind=0.0.0.0 \
-client=127.0.0.1 \
-advertise=127.0.0.1
@ashmckenzie
ashmckenzie / build-tmux.sh
Last active May 17, 2016 01:43 — forked from philipsoutham/build-tmux.sh
Build static tmux
#!/usr/bin/env bash
pushd $(dirname $0) > /dev/null; CURRABSPATH=$(readlink -nf "$(pwd)"); popd > /dev/null; # Get the directory in which the script resides
set -x
MUSLPKG="musl:musl.tgz:http://www.musl-libc.org/releases/musl-1.1.4.tar.gz"
LEVTPKG="libevent:libevent2.tgz:https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
TMUXPKG="tmux:tmux.tgz:https://github.com/tmux/tmux/releases/download/1.9a/tmux-1.9a.tar.gz"
NCRSPKG="ncurses:ncurses.tgz:http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz"
TEMPDIR="$CURRABSPATH/tmp"
TMPLIB="tempinstall/lib"
TMPINC="tempinstall/include"