Skip to content

Instantly share code, notes, and snippets.

View dctanner's full-sized avatar

Damien Tanner dctanner

View GitHub Profile
module Spec
module Matchers
class EqlHash #:nodoc:
def initialize(expected)
@expected = expected
end
def matches?(actual)
@actual = actual
ec2-run-instances ami-2bb65342 -k gsg-keypair
ssh -i ~/.ec2/id_rsa-gsg-keypair [email protected]
On EC2
---
yum install -y openvpn
modprobe tun
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.4.0.1/2 -o eth0 -j MASQUERADE
S3 buckets in Europe
Object operations (i.e. upload file) should be made to `mybucket.s3.amazonaws.com/myobject` and *not* `s3.amazonaws.com/mybucket/myobject` (as `s3.amazonaws.com` points to the US data center)
Annoyingly the signature on the request S3 expects needs a path which includes the bucket name! So when using your own domain as your bucket name (e.g. videos.mysite.com), even though the path (url excluding host and port) to PUT and object is going to be `/myobject`, the CanonicalizedResource part of the request signature requires a path string of `/videos.mysite.com/myobject`. See http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTAuthentication.html for more details.
@dctanner
dctanner / gist:4515
Created August 7, 2008 23:20
Graceful nginx init.d script
#! /bin/sh
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
# run 'sudo update-rc.d nginx defaults', or use the appropriate command on your
# distro.
#
# Author: Ryan Norbauer <[email protected]>
# Modified: Geoffrey Grosenbach http://topfunky.com
set -e
# This module allows you to prepend a verion prefix to your Sinatra URLs
# Example:
#
# require 'rubygems'
# require 'sinatra/base'
#
# class App < Sinatra::Base
# register Versioned
#
# set :version, 'v1'
The ft.com restricts users to only 3 articles a day, but if you come from Google they let you read the whole article. This bookmarklet does a google search for the ft.com article you're currently on so you can click the google link and read it!
javascript:location="http://www.google.com/search?q="+encodeURIComponent("site:ft.com \""+document.body.getElementsByTagName("h2")[2].innerHTML+"\"")
var sys = require('sys'),
spawn = require('child_process').spawn,
http = require('http');
http.createServer(function (req, res) {
var ffmpeg = spawn('ffmpeg', ['-i /path/to/file', '-f mp3', '-']);
res.writeHead(200, {'Content-Type': 'audio/mpeg'});
ffmpeg.stdout.addListener('data', function (d) {
We couldn’t find that file to show.
;(function(exports, undefined) {
})((typeof exports !== 'undefined' ? exports : this['Thing']));
background-color: white;
border: 1px solid;
color: black;
outline: 0;
padding: 8px 7px;
font-size: 0.857em;
height: 35px;
-webkit-appearance: none;
-webkit-box-shadow: 0 1px 2px #DDD inset;
-moz-box-shadow: 0 1px 2px #DDD inset;