Skip to content

Instantly share code, notes, and snippets.

View bwestergard's full-sized avatar

Björn Westergard bwestergard

  • Mt. Pleasant, Washington, D.C.
View GitHub Profile
var env = process.env;
var cfg = {
foo: env.FOO_QUEUE || 'foo',
pattern: env.BIND_QUEUE_PATTERN,
amqpUrl: env.RABBIT_MQ_URL
};
cfg.channel = {
// Channel method to invoke
@bwestergard
bwestergard / x.js
Last active December 25, 2015 22:39
Cassini Do It Yourself (Attempted Fix)
// Cassini projection
// just a transverse equirectangular projection
// implemented from wikipedia description
d2r = Math.PI / 180;
return Math.asin(Math.sin(x * d2r) * Math.cos(y * d2r));
@bwestergard
bwestergard / bookmark.py
Created January 11, 2012 15:18
A python script to let you read a book (e.g. a dictionary, an encyclopedia) in random order, keeping track of which pages have already been read.
import sys,random
'''
USAGE
Let's say you want to read The Oxford Companion to Lulz, which has 819 pages. You would create a file with one line, "1:819", and save it as lulz.txt. Then you would run:
python bookmark.py lulz.txt
This would return a random page that you haven't yet read. Let's say it was 42. You then read from 42 to 50. You record this fact by running: