THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
// 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) | |
}); |
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 |
require 'celluloid' | |
WORKERS_COUNT = (ARGV[0] || 1).to_i | |
class Output | |
include Celluloid | |
def puts(msg) | |
Kernel.puts(msg) | |
end |
""" | |
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 |
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: |
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 \ |
# create a redis app | |
flynn create --remote "" redis | |
# create a release using the latest (at the time of writing) Docker Redis image | |
flynn -a redis release add -f config.json "https://registry.hub.docker.com?name=redis&id=868be653dea3ff6082b043c0f34b95bb180cc82ab14a18d9d6b8e27b7929762c" | |
# scale the server to one process. This may time out initially as the server pulls the image, but watch "flynn -a redis ps" and should come up. | |
flynn -a redis scale server=1 | |
# redis should now be running in the cluster at redis.discoverd:6379 |
/* bling.js */ | |
window.$ = document.querySelector.bind(document); | |
window.$$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
NodeList.prototype.__proto__ = Array.prototype; | |
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
<?xml version='1.0'?> | |
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
<fontconfig> | |
<dir>~/.fonts</dir> | |
<alias> | |
<family>serif</family> | |
<prefer> | |
<family>Source Serif Pro</family> | |
<family>IPAMincho</family> | |
</prefer> |