THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
# run this every minute from cron as a quick and dirty solution to get some | |
# haproxy stats on each of your listeners over to stackdriver | |
instance=$(curl -s "http://169.254.169.254/latest/meta-data/instance-id") | |
# while [ 1 ]; do | |
cp /dev/null /tmp/hastats.json | |
echo 'show stat' | socat - UNIX-CLIENT:/tmp/haproxy.sock \ | |
|while IFS=',' read pxname svname qcur qmax scur smax slim stot bin bout dreq \ | |
dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg \ |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
rem this is a generic media player | |
rem this prog was made by jordan earls | |
starty: | |
print "type 1 to choose where media is" | |
print "type 2 to pause music" | |
print "type 3 to resume music" | |
print "type 4 to reload music" | |
print "type 5 to change volume" | |
print "type 6 to change speed" | |
start: |
""" | |
Taken from my suggestion at: | |
https://groups.google.com/forum/#!msg/tweepy/OSGRxOmkzL4/yaNT9fL9FAIJ | |
Note that this is an incomplete snippet; you'll need to create the API auth object. | |
""" | |
import simplejson as json | |
import tweepy |
require 'celluloid' | |
WORKERS_COUNT = (ARGV[0] || 1).to_i | |
class Output | |
include Celluloid | |
def puts(msg) | |
Kernel.puts(msg) | |
end |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm | |
function map() { | |
emit(1, // Or put a GROUP BY key here | |
{sum: this.value, // the field you want stats for | |
min: this.value, | |
max: this.value, | |
count:1, | |
diff: 0, // M2,n: sum((val-mean)^2) | |
}); |