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
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)] |
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
(defprotocol AProtocol | |
(say-hello [this]) | |
(location [this])) | |
(defrecord Place [name]) | |
(extend-protocol AProtocol | |
Object | |
(say-hello [this] (str "Hello " (location this))) | |
Place |
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
#!/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/.$//' | |
;; |
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
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 |
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 qualified Crypto.Hash.SHA256 as SHA |
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
takeS :: Int -> Stream x -> [x] | |
takeS n (x :> rest) = |
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
) |
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
{"action": "email", | |
"internal": "[email protected]", | |
"external": "[email protected]", | |
"subjec |
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
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 |
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
tags = parse_hashtags body | |
[200, {}, tags.join(' ')] | |
else | |
404 # What happened? Not Twilio, apparently | |
end | |
end | |
private |
OlderNewer