Skip to content

Instantly share code, notes, and snippets.

andsens /
Last active Aug 9, 2016
Google spreadsheet function for signing S3 URLs (very handy for CSV cost allocation reports when combined with the ImportData() function)
function sign_s3(access_key, private_key, bucket, object_name, validity, base_url) {
if(!base_url) {
base_url = "";
if(!validity) {
validity = 60;
expires = Math.floor((new Date()).getTime() / 1000) + validity;
object_name = encodeURIComponent(object_name);
stringToSign = "GET\n\n\n"+expires+"\n/"+bucket+"/"+object_name;
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

erikh /
Created Mar 31, 2012 — forked from DAddYE/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
blacktaxi / ruby-fmt.clj
Created Jan 25, 2012
Ruby-like string interpolation in Clojure
View ruby-fmt.clj
; Ruby has an awesome feature -- string interpolation. Read about it on the internet.
; On the other hand, Clojure only has cumbersome Java string formatting, which can not be
; used without pain after you've tried Ruby.
; So here's this simple macro that basically allows you to do most things you could do
; with Ruby string interpolation in Clojure.
(ns eis.stuff
(:require [clojure.string]))
cheenu / netflix_api_sample_signed_request.rb
Last active Sep 18, 2019
How to generate an OAuth signature for the Netflix API using Ruby
View netflix_api_sample_signed_request.rb
## This gist is intended to provide a code example for the
# 'Making Signed Requests' section of the 'Authentication Overview' document.
# (
# We are going to make a catalog request. The hardest part of
# it is figuring out how to generate the oauth_signature.
require 'cgi'
require 'base64'
require 'openssl'
peterc / dnsd.rb
Created Dec 2, 2011
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
View dnsd.rb
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
# MIT license
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See for protocol guidance
# * All records get the same TTL
headius / output
Created May 19, 2011
Rubinius's actor API under JRuby
View output
~/projects/jruby ➔ jruby rbx_actor_example.rb
Processing: 0
Processing: 4
Processing: 7
Processing: 5
Processing: 8
Processing: 3
Processing: 2
Processing: 6
Processing: 1
View gist:981817
View Gemfile
gem 'resque', '>= 1.10.0'
gem 'heroku' # You will need the heroku gem for this too.