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
var confirmed = true; | |
var skype = "abe.stanway"; | |
var hitMeUpYo = function(skype, confirmed){ | |
confirmed | |
? console.log("Looking forward to speaking with you! My Skype is " + skype) | |
: console.log("Sorry, gonna have to pass") | |
}; | |
hitMeUpYo(skype, confirmed); |
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
# NOTE: Requires https://github.com/technoweenie/nubnub | |
Client = require '../src/client' | |
cli = Client.build( | |
hub: "http://hub.etsy.com/" | |
mode: "subscribe" | |
verify: 'sync' | |
topic: 'http://www.etsy.com/api/push/listings/latest.atom' | |
callback: 'http://ec2-23-20-144-147.compute-1.amazonaws.com:8080/callback' | |
apikey: 'YOURKEYHERE' |
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
~/code/hackerleague.org$ bundle exec foreman start | |
13:50:08 web.1 | started with pid 18516 | |
13:50:08 worker.1 | started with pid 18517 | |
13:50:20 web.1 | => Booting Thin | |
13:50:20 web.1 | => Rails 3.2.3 application starting in development on http://0.0.0.0:5000 | |
13:50:20 web.1 | => Call with -d to detach | |
13:50:20 web.1 | => Ctrl-C to shutdown server | |
13:51:39 web.1 | Exiting | |
13:51:39 web.1 | /Users/abestanway/.rvm/gems/ruby-1.9.2-p290/gems/mongo-1.6.2/lib/mongo/connection.rb:415:in `connect': Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure) | |
13:51:39 web.1 | from /Users/abestanway/.rvm/gems/ruby-1.9.2-p290/gems/mongo-1.6.2/lib/mongo/connection.rb:589:in `setup' |
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 socket | |
import sys | |
import pickle | |
import redis | |
""" | |
Basically, this bad boy needs to receive 500k pickled metrics of the type [name, (timestamp, | |
value)] every 10 seconds. It needs to then unpickle them and pop them in Redis. When you fire | |
it up, it works for about five seconds (just listening - not even Redising yet), and then it | |
stops, with a weird exception in gen_unpickle: |
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
string = "stats.pages.home_page.visitors" | |
split_string = string.split('.') | |
tree = {} | |
tree_string = 'tree' | |
for i in range(0, len(split_string)): | |
try: | |
tree_string = tree_string + '[split_string[' + str(i) + ']]' | |
exec(tree_string) | |
except KeyError: |
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
@participations = 0 | |
@hacks.each do |hack| | |
@participations += hack.hackers_count | |
end | |
unless @participations == 0 | |
@average = sprintf("%.1f", (@hacks.length / @participations)) | |
else | |
@average = 0 | |
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
#!/bin/bash | |
SLOW=10 | |
while true | |
do sleep $SLOW | |
echo "clap" | |
SLOW=$(($SLOW - 1)) | |
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
# Optimizations | |
ujson_loads = ujson.loads | |
time_time = time.time() | |
settings_ANALYZER_PROCESSES = settings.ANALYZER_PROCESSES | |
self_analyze = self.analyze | |
json = ujson_loads('my string') | |
self_analyze(json) |
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 pandas import stats, Series | |
import numpy as np | |
from numpy import linalg as numpy_linalg | |
from numpy import mean as numpy_mean | |
from numpy import sqrt as numpy_sqrt | |
from numpy import round as numpy_round | |
from scipy import stats as sci_stats | |
from scipy import array as scipy_array | |
from scipy import std as scipy_std | |
from time import 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
func Pummeler(schema interface{}, callback string, failedAttempts chan bool, pummelers chan int) { | |
pummelers <- 1 | |
// Format request | |
jsonEncoded, err := json.Marshal(schema) | |
if err != nil { | |
log.Println("Could not encode JSON") | |
return | |
} |
OlderNewer