Skip to content

Instantly share code, notes, and snippets.

@awilliams
awilliams / gist:551d8282e8b66e6f8c15
Created June 12, 2015 11:38
vagrant ssh config
# Add this to ~/.ssh/config, changing the Host and IdentifyFile definitions as needed.
# Run `vagrant ssh-config` for more info.
Host devbox
HostName 127.0.0.1
User vagrant
Port 2222
ForwardAgent yes
IdentityFile ~/vms/devbox/.vagrant/machines/default/virtualbox/private_key
UserKnownHostsFile /dev/null
@awilliams
awilliams / raspberry_pi.md
Created January 4, 2015 19:30
Raspberry Pi setup - for my own records mostly

This is available at: gist

Raspberry Pi

Creating image

@awilliams
awilliams / poo_server.go
Created December 28, 2014 17:15
💩 server
// HTTP server which periodically emits a message, in this case, "💩 ".
//
// Idea taken from http://robpike.io/
// Test with: curl -i -N http://localhost:8080
package main
import (
"fmt"
"io"
@awilliams
awilliams / sshtunnel
Created October 29, 2014 11:16
sshtunnel helper
#!/usr/bin/env bash
# ARG1 = remote host, ie db.example.com
# ARG2 = port to forward, ie 8080
set -eu
echo "Tunneling $1 -> http://sshtunnel:$2"
#open /Applications/Google\ Chrome.app/ "http://sshtunnel:$2/"
ssh -C $1 -L $2:localhost:$2 -N
#!/usr/bin/env bash
set -o pipefail
set -o errexit
# set -o xtrace
__DIR__="$(cd "$(dirname "${0}")"; echo $(pwd))"
__BASE__="$(basename "${0}")"
__FILE__="${__DIR__}/${__BASE__}"
@awilliams
awilliams / bm.rb
Created February 5, 2014 18:46
Benchmark Restfulness::Sanitizer#sanitize_query_string
#
# Benchmark Restfulness::Sanitizer#sanitize_query_string
# Usage: ruby -I lib bm.rb 1000
#
require 'benchmark'
require 'restfulness'
iterations = ARGV.empty? ? 1000 : ARGV.shift.to_i
query_string = "alongparam=das3e23&something=dfasd&password=caca&another=false"