Skip to content

Instantly share code, notes, and snippets.

View jordanorelli's full-sized avatar
👾

Jordan Orelli jordanorelli

👾
View GitHub Profile
@atamurad
atamurad / gist:1282243
Created October 12, 2011 19:23
Recurly.js signature implementation in Python
import hashlib
import hmac
def digest_data(data):
if type(data) == list:
return "[%s]" % (",".join([digest_data(v) for v in data if v]))
elif type(data) == dict:
kvs = sorted(data.items(), lambda x,y: cmp(x[0],y[0]))
def prefix(key):
return "" if type(key) == int else "%s:" % key
@jordanorelli
jordanorelli / sight.pde
Created June 10, 2012 20:37
ChucK -> Processing communication demo
import oscP5.*;
import netP5.*;
PGraphics pg;
OscP5 oscP5;
NetAddress inbound;
float minFreq = 140;
float maxFreq = 1600;
float[] notes;
@jordanorelli
jordanorelli / heterogenous.go
Created June 19, 2012 17:17
sorting heterogenous slices in go
package main
import (
"fmt"
"sort"
)
type CommonCollection []Convertible
func (c CommonCollection) Len() int { return len(c) }
@jordanorelli
jordanorelli / id.go
Created June 23, 2012 18:32
fast unique id generation in Go
package main
import (
"crypto/md5"
"encoding/binary"
"fmt"
"os"
"sync/atomic"
"time"
)
@jordanorelli
jordanorelli / templates.go
Created August 9, 2012 21:42
primitive template cache in Go with os.Stat
package core
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"path/filepath"
@jordanorelli
jordanorelli / queue.go
Created September 7, 2012 17:53
an absurd queue implementation with higher-order channels
package main
import (
"fmt"
"math/rand"
"time"
)
type Queue struct {
data []interface{}
@jordanorelli
jordanorelli / stringcache.go
Created October 9, 2012 23:11
a simple string cache
type idCache struct {
sync.RWMutex
data map[string]*string
maxSize int
newest *string
oldest *string
}
func newIdCache(size int) *idCache {
return &idCache{
@jordanorelli
jordanorelli / grayskull_menu.md
Created November 15, 2012 16:26
cafe grayskull menu

Manhattan

  • 2 oz Rye

  • 1 oz sweet Vermouth

  • 3 dashes Angostura bitters

    Stir, served Up in a coupe glass

Martini

  • 2 oz Gin
@jordanorelli
jordanorelli / life.ck
Created February 9, 2013 22:57
conway's game of life for the monome, written in chuck
24787 => int monomeIn;
17102 => int monomeOut;
"/example" => string monomePrefix;
"127.0.0.1" => string monomeHost;
OscRecv recv;
monomeIn => recv.port;
recv.listen();
fun float[][] toneGrid(int width, int height, int columnStep, int rowStep, float baseFreq, float octaveSteps) {
@jordanorelli
jordanorelli / shapes.pde
Created March 10, 2013 20:57
3d animated gif with processing
import gifAnimation.*;
GifMaker gifExport;
int frames = 0;
int totalFrames = 180;
void setup() {
smooth();
size(900, 300, P3D);
ortho();