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://aws.amazon.com/articles/4926593393724923 | |
http://elasticmapreduce.s3.amazonaws.com/samples/spark/0.7.3/install-spark-shark.sh | |
elastic-mapreduce --create --alive --name "Spark/Shark Cluster" --bootstrap-action s3://elasticmapreduce/samples/spark/0.7.3/install-spark-shark.sh --bootstrap-name "Mesos/Spark/Shark" --instance-type m1.xlarge --instance-count 3 | |
replace ec2-keypair in above command | |
commit to propagate credentials: https://github.com/amplab/shark/commit/70ddf149ea720fdfe76ae39cacbbac344be8402b |
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
def hash_pluck(hash, keys) | |
HashWithIndifferentAccess[keys.zip(hash.values_at(*keys.map(&:to_s)))] | |
end | |
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
cycles = (wastefulness) -> | |
t1 = new Date | |
for x in [0..Math.pow(wastefulness,2)] | |
Math.pow(Math.random*Math.random) | |
(new Date) - t1 | |
# >> cycles(100) | |
# 18 | |
# >> cycles(1000) |
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
obj = {'someThing':'else',"BlahBlah":"bLah","sealTeam":6} | |
defaults = {'some_thing':'more',"seal_team":2} | |
camelToSnake = (s)-> | |
s = s.replace /^([A-Z]+)/, (match) -> | |
if match.length == 1 | |
match.toLowerCase() | |
else | |
"#{match.slice(0,match.length-1).toLowerCase()}_#{match.slice(match.length-1).toLowerCase()}" | |
s = s.replace /([A-Z]+)$/, (match) -> |
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
function watch { | |
while sleep 1; do $@; done | |
} | |
function watchr { | |
while sleep 1; do if [ "$d" != "$(stat $1 | cut -d'"' -f4)" ];then echo && date && d=`stat $1 | cut -d'"' -f4` && ruby $1 ; fi; done | |
} |
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
#s = "ABCDEFABDC".split("") | |
s = "nlhthgrfdnnlprjtecpdrthigjoqdejsfkasoctjijaoebqlrgaiakfsbljmpibkidjsrtkgrdnqsknbarpabgokbsrfhmeklrle".split("") | |
ans = 'tsocrpkijgdqnbafhmle' | |
#s = "CABDBACBAB".split("") | |
#ans = "DCBA" | |
h = {}.tap do |h| | |
s.each_with_index do |c,i| | |
h[c] ||= [] | |
h[c] << i |
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
#s = "ABCDEFABDC".split("") | |
s = "nlhthgrfdnnlprjtecpdrthigjoqdejsfkasoctjijaoebqlrgaiakfsbljmpibkidjsrtkgrdnqsknbarpabgokbsrfhmeklrle".split("") | |
ans = 'tsocrpkijgdqnbafhmle' | |
#s = "CABDBACBAB".split("") | |
#ans = "DCBA" | |
h = {}.tap do |h| | |
s.each_with_index do |c,i| | |
h[c] ||= [] | |
h[c] << i |
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
[user] | |
name = <YOUR> <NAME> | |
email = <YOUR EMAIL> | |
[github] | |
user = <YOUR HANDLE> | |
[alias] | |
st = status | |
c = commit | |
ci = commit | |
b = branch |
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 'rack-proxy' | |
require 'rack' | |
RemoteHostForName = { | |
'simple' => "localhost:4567" | |
} | |
class ExternalProxy < Rack::Proxy | |
def rewrite_env(env) | |
#request = Rack::Request.new(env) |
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 'sinatra' | |
use Rack::CommonLogger | |
use Rack::Logger | |
require 'json' | |
post '/hi/there' do | |
request.logger.info JSON.pretty_generate(request.env) | |
"success\n" | |
end |