This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plyr) | |
library(reshape2) | |
library(ggplot2) | |
bnames <- read.csv("bnames.csv", stringsAsFactors = FALSE) | |
bibnames <- read.csv('BiblicalNames.txt')$BiblicalNames | |
bnames$bibl <- is.element(bnames$name, bibnames) | |
bibpop <- ddply(bnames, c('year', 'sex', 'bibl'), summarise, tot=sum(percent)) | |
bibpopT <- subset(bibpop, bibl==TRUE) | |
qplot(year, tot, data=bpopT, geom='line', colour=sex, ymin=0, ymax=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# f(z = x + iy) = u(x, y) + i * v(x, y) | |
function finite_difference{T <: Complex}(f::Function, | |
z::T, | |
alongx::Bool = true, | |
alongu::Bool = true) | |
epsilon = sqrt(eps(max(abs(one(T)), abs(z)))) | |
if alongx | |
zplusdz = z + epsilon | |
else | |
zplusdz = z + epsilon * im |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A script to train myself on knowing the cuberoots of perfect cubes with 6 digits or less. | |
''' | |
import sys, random, time | |
print "welcome to know these ten cubes " | |
count = 0 | |
start = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
An example daemon to query twine and log results. | |
Gabe Gaster, Datascope Analytics, 2014 | |
[email protected] | |
''' | |
import requests, json, time | |
twine_id = "00000----------" # twine id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import datetime | |
import time | |
import pytz | |
import tempodb | |
# Modify these with your credentials found at: http://tempo-db.com/manage/ | |
API_KEY = 'intentionally left blank' | |
API_SECRET = 'fffffffffffffffffffff' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script> | |
</head> | |
<body> | |
<div id="chart"> | |
</div> | |
<script type="text/javascript"> | |
var w = 960, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample_a.dat | |
sample_b.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations, product | |
import numpy as np | |
import csv | |
def get_lucas_matrix(genus=3): | |
# generate V, all non-zero binary 2*genus tuples. | |
V = (np.array(m) | |
for m in product(*( [range(2)]*genus*2 )) | |
if np.array(m).sum()>0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""From http://programmingpraxis.com/2009/10/23/mr-s-and-mr-p/ and | |
told to me by Mike Stringer. John McCarthy, who discovered Lisp, | |
attributes this puzzle to Hans Freudenthal: | |
We pick two numbers a and b, so that 100>a,b>1. We tell | |
Mr. P. the product ab and Mr. S. the sum a+b. Then Mr. S. and | |
Mr. P. engage in the following dialog: | |
Mr. P.: I don't know the numbers. | |
Mr. S.: I knew you didn't know. I don't know either. |