Skip to content

Instantly share code, notes, and snippets.

View tel's full-sized avatar
✍️

Joseph Abrahamson tel

✍️
View GitHub Profile
@tel
tel / gist:1212793
Created September 12, 2011 23:47
HPD Plotting for Beta-Binomial model
require(plyr)
randHDR <- function(df = function(x) {dbeta(x, 1, 1)},
getRand = function(n) {rbeta(n, 1, 1)},
p = 0.05,
n = 1000) {
# Density quantile approach of Hyndman (1996)
# Compute HDR level
xs <- getRand(n)
ps <- sort(aaply(xs, 1, df))
fj <- ps[ceiling(p*n)]
@tel
tel / gist:1220157
Created September 15, 2011 19:02
Default protocal implementations?
(defprotocol AProtocol
(say-hello [this])
(location [this]))
(defrecord Place [name])
(extend-protocol AProtocol
Object
(say-hello [this] (str "Hello " (location this)))
Place
@tel
tel / mac
Created June 30, 2012 18:34
Mac Address Spoofing Script
#!/usr/bin/env sh
SCRIPT=`basename $0`
BACKUP=$HOME/.mac.orig
case "$1" in
current)
ifconfig en0 | ack ether | cut -d\ -f 2
;;
new)
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
;;
select
county,
population,
(population / ST_Area(wkb_geometry)) * 1000000 as popsqkm,
wkb_geometry,
replace(county, ' County', '') || E'\n' ||
'pop. ' || population || E'\n' ||
round((population / ST_Area(wkb_geometry))::numeric * 1000000, 1) || E' / km²\n'
as label
@tel
tel / test.hs
Created October 19, 2012 02:47
import qualified Crypto.Hash.SHA256 as SHA
@tel
tel / Grid.hs
Created October 27, 2012 17:37
takeS :: Int -> Stream x -> [x]
takeS n (x :> rest) =
{"action": "email",
"internal": "project-a@reifyhealth.com",
"external": "me@jspha.com",
"subjec
no such file to load -- sinatra/r18n (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./hack_sanitation_app.rb:2
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/tel/Dropbox/proj/hacksanitation/config.ru:2
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/tel/Dropbox/proj/hacksanitation/config.ru:1:in `new'
from /Users/tel/Dropbox/proj/hacksanitation/config.ru:1
tags = parse_hashtags body
[200, {}, tags.join(' ')]
else
404 # What happened? Not Twilio, apparently
end
end
private