Skip to content

Instantly share code, notes, and snippets.

View jtauber's full-sized avatar

James Tauber jtauber

View GitHub Profile
// calculated Coordinated Mars Time (MTC)
var d = new Date();
var millis = d.getTime();
var jd_ut = 2440587.5 + (millis / 8.64E7);
var jd_tt = jd_ut + (35 + 32.184) / 86400;
var j2000 = jd_tt - 2451545.0;
var msd = (((j2000 - 4.5) / 1.027491252) + 44796.0 - 0.00096);
var mtc = (24 * msd) % 24;
We couldn’t find that file to show.
@jtauber
jtauber / cells.json
Last active August 29, 2015 14:01
C.elegans Cell Lineage
{"name": "P0", "children": [{"name": "AB", "children": [{"name": "ABa", "children": [{"name": "ABal", "children": [{"name": "ABalp", "children": [{"name": "ABalpa", "children": [{"name": "ABalpap", "children": [{"name": "ABalpapa", "children": [{"name": "ABalpapap", "children": [{"name": "ABalpapapa", "children": [{"name": "RMDDL"}, {"name": "ABalpapapap", "children": [{"name": "SMBDL"}, {"name": "ABalpapapapa"}]}]}, {"name": "ABalpapapp", "children": [{"name": "SMBVL"}, {"name": "ABalpapappa"}]}]}, {"name": "ABalpapaa", "children": [{"name": "ABalpapaap", "children": [{"name": "arc_ant_V"}, {"name": "ABalpapaapp"}]}, {"name": "ABalpapaaa", "children": [{"name": "hyp2_V"}, {"name": "RIPL"}]}]}]}, {"name": "ABalpapp", "children": [{"name": "ABalpappa", "children": [{"name": "ABalpappaa", "children": [{"name": "ABalpappaap", "children": [{"name": "I2L"}, {"name": "ABalpappaapp"}]}, {"name": "ABalpappaaa"}]}, {"name": "ABalpappap", "children": [{"name": "mc3V"}, {"name": "e2V"}]}]}, {"name": "ABalpappp", "childr
@jtauber
jtauber / pmarca.yml
Last active August 29, 2015 14:05 — forked from paltman/pmarca.yml
-
title: "Voter Participation"
screen_name: "pmarca"
first_id: 488428182282858498
first_timestamp: "2014-07-13T16:02:07-05:00"
tweets:
- "2014-07-13T16:02:07-05:00 Common thing one hears in US is \"Political system broken; Founding Fathers never intended politics to be dominated by moneyed interests.\""
- "2014-07-13T16:03:08-05:00 But in 1776, voting \"restricted to property owners—most of whom are white male Protestants over the age of 21\". http://t.co/x2AVaTBaEa"
- "2014-07-13T16:03:51-05:00 In 1789, George Washington was elected President. \"Only 6% of the population can vote.\" http://t.co/PpX4aLQcM8"
- "2014-07-13T16:04:38-05:00 Not until 1856 was voting expanded even to all white men (eliminating property ownership requirement) -- http://t.co/PpX4aLQcM8"
#!/usr/bin/env python
from collections import defaultdict
bigrams = defaultdict(set) # mapping first letter to possible second letter
trigrams = set()
with open("/usr/share/dict/words") as words:
for word in words:
word = word.replace("\n", "#")
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
# brainf*** Interpreter in Python
# Copyright (c) 2002 & 2006, James Tauber
#
# see http://en.wikipedia.org/wiki/Brainfuck
import sys
class brainf:
def __init__(self, program):
# Python implementation of the Gibbons-Lester-Bird algorithm[1] for enumerating
# the positive rationals.
#
# James Tauber 2004-07-01
# http://jtauber.com/
#
# [1] http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/rationals.pdf
def rationals():
"""
@jtauber
jtauber / gist:167009
Created August 13, 2009 05:33
Pi in Hex
# Implementation of Simon Plouffe's formula for Pi in Hex
#
# James Tauber 2007-03-14
# http://jtauber.com/blog/2007/03/14/generating_the_hex_digits_of_pi/
def pi():
N = 0
n, d = 0, 1
while True:
xn = (120*N**2 + 151*N + 47)