Skip to content

Instantly share code, notes, and snippets.

View matthutchinson's full-sized avatar
🧐
`¯\_(ツ)_/¯`

Matthew Hutchinson matthutchinson

🧐
`¯\_(ツ)_/¯`
View GitHub Profile
#!/bin/bash
COMMAND="git br | grep '$1' | sed 's/\* //'"
git co $(eval $COMMAND)
@matthutchinson
matthutchinson / gist:d6770107a3131abab362
Created May 16, 2014 15:41
store.pmfaqtory.com nginx/unicorn/ssl/tls/oscp/resumption/forward secrecy/NPN/SPDY/3.1
# https://istlsfastyet.com
# https://github.com/igrigorik/istlsfastyet.com/blob/master/nginx.conf
# https://github.com/matthutchinson/matthutchinson.github.com/wiki/NGINX
# nginx (1.5.10) with resumption, OCSP stapling, 1400 byte TLS records, forward secrecy, NPN + SPDY/3.1
upstream unicorn {
server unix:/var/www/pmfaqtory-store/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
# redirect all non ssl traffic to ssl
@matthutchinson
matthutchinson / pmfaqtory-store.conf
Last active August 29, 2015 14:02
upstart conf for bluepill app management including global env vars on launch (/etc/init/pmfaqtory-store.conf)
# upstart for bluepill daemon and store app
# use with config/bluepill.pill
description "pmFAQtory store"
start on runlevel [2]
stop on runlevel [016]
exec su -c "$(tr "\n" " " < /etc/environment) bluepill load /var/www/pmfaqtory-store/current/config/bluepill.pill"
@matthutchinson
matthutchinson / keybase.md
Last active August 29, 2015 14:05
keybase.md

Keybase proof

I hereby claim:

  • I am matthutchinson on github.
  • I am matthutchinson (https://keybase.io/matthutchinson) on keybase.
  • I have a public key whose fingerprint is 2F6D 6D3C 53D6 659F 4674 4021 DDC0 B52C D778 C2B8

To claim this, I am signing this object:

@matthutchinson
matthutchinson / shell_helpers.rb
Created August 31, 2014 19:50
Babushka shell command patched to work with rbenv and .ruby-version
# rbenv shell helper patch
module Babushka
module ShellHelpers
# Run +cmd+ via #shell, raising an exception if it doesn't exit
# with success.
def shell! *cmd, &block
opts = cmd.extract_options!
cmd = cmd.first if cmd.map(&:class) == [Array]
@matthutchinson
matthutchinson / thx.sh
Last active August 29, 2015 14:15
THX startup sound :)
# brew install sox
echo '(play -q -n synth sine F2 sine C3 remix - fade 0 4 .1 norm -4 bend 0.5,2399,2 fade 0 4.0 0.5 &)' >> ~/.bash_profile
# via https://twitter.com/climagic/status/467322823631831040
# subdomains.rake in /lib/tasks
namespace :subdomains do
desc "adds the necessary hosts to your /etc/hosts file from current subdomains in your application"
task :setup => :environment do
# NOTE: default_hosts is used as a locator for the line to update in /etc/hosts
tmp_file, changed = '/tmp/etc_hosts_copy', false
default_hosts, hosts = %w(blog.local emptyblog.blog.local), []
# find all the subdomains used in your app (push to hosts array) - modify this to suit your app
@matthutchinson
matthutchinson / gist:320476
Created March 3, 2010 09:29
simple TwitStream using EventMachine
#!/usr/bin/env ruby
# usage;
# script/twitstream start
# script/twitstream stop
# script/twitstream restart
# pid and log at RAILS_ROOT/tmp/pids
# where config/twitstream.yml looks like this;
#!/usr/bin/env ruby
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
self.rank = rank
self.suit = suit
end
@matthutchinson
matthutchinson / .bash_aliases
Created September 20, 2010 15:12
.bash_aliases
# launching console/server
sc () {
if [ -f ./script/rails ]; then
rails c $@
else
./script/console $@
fi
}
sg () {