Skip to content

Instantly share code, notes, and snippets.

@DanielHeath
DanielHeath / .env
Last active December 14, 2016 05:05
Setting up a go project to produce a binary
export GOPATH="$(pwd):$(pwd)/vendor"
export PATH="$(pwd)/bin:$PATH"
export CDPATH=.:$(pwd)/src/github.com:$(pwd)/vendor/src/golang.org:$(pwd)/src
if [ -f .env.secret ] ; then
source .env.secret
fi
@cjyar
cjyar / memoize.go
Created December 1, 2013 01:29
Generic memoizer in Go.
package memoize
import (
"fmt"
"reflect"
)
// fptr is a pointer to a function variable which will receive a
// memoized wrapper around function impl. Impl must have 1 or more
// arguments, all of which must be usable as map keys; and it must
@wilkie
wilkie / experiment.rb
Created November 19, 2012 23:51
Code to produce a probability distribution of how likely a gender breakdown in conference speakers is, and also to experiment to produce the result
# This program will select at random a set of speakers and look at the gender breakdown given 20% women
total_speakers = 15
percentage_of_women = 0.25
hist, list, results = {}, [], []
(1000 * (1 - percentage_of_women)).floor.times{list << 0}
(1000 * percentage_of_women).floor.times{list << 1}