Skip to content

Instantly share code, notes, and snippets.

@tj
tj / coros.rb
Last active August 29, 2015 13:55
def receive(co)
let status, val = coroutine.resume(co)
return val
end
def send(x)
coroutine.yield(x)
end
@tj
tj / README.md
Created March 30, 2014 05:07 — forked from mbostock/.block

A test for the new topojson.merge functionality that will be available in the next release of TopoJSON, 1.6. The state boundaries are computed by merging the county boundaries!

The merge algorithm appears to have some issues with Virginia’s small counties; I am currently investigating this problem.

@tj
tj / lame.js
Last active August 29, 2015 14:03
function shutdown() {
var times = 0;
process.on('SIGINT', function(){
trapped('INT');
});
process.on('SIGQUIT', function(){
trapped('QUIT');
});
body {
background-color: white;
color: rgba(0,0,0,0.8);
font-family: Georgia,Cambria,"Times New Roman",Times,serif;
}
#editor {
box-shadow: none
}
@tj
tj / hackpad.css
Created January 15, 2015 12:33
Hackpad theme
body {
background-color: white;
color: rgba(0,0,0,0.8);
}
#editor {
box-shadow: none
}
ul.listtype-hone {
2015/02/10 08:12:33 [pub] clear events topic
2015/02/10 08:12:33 [sub] [events:example] clear
2015/02/10 08:12:33 [pub] publish events hello 0
2015/02/10 08:12:34 [pub] publish events hello 1
2015/02/10 08:12:34 [pub] publish events hello 2
2015/02/10 08:12:34 [pub] publish events hello 3
2015/02/10 08:12:34 [pub] publish events hello 4
2015/02/10 08:12:34 [pub] publish events hello 5
2015/02/10 08:12:34 [pub] publish events hello 6
2015/02/10 08:12:34 [pub] publish events hello 7
ctx, err := context.New("red-extract", Version, args["--apex"].(string))
type Worker struct {
*context.Context
}
func (w *Worker) SomeMethod(){
...
w.Stats.IncrBy(n, "events", "published")
w.Log.Info("parsed %s in %s (size=%s) (events=%d)", file, time.Since(start), size, n)
}
avg-cpu: %user %nice %system %iowait %steal %idle
21.28 0.00 1.28 0.00 0.00 77.44
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
xvda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 0.00 5271.00 1163.00 2835.00 4652.00 37240.00 20.96 3.20 0.80 0.27 1.02 0.06 24.80
avg-cpu: %user %nice %system %iowait %steal %idle
21.23 0.00 1.02 0.26 0.26 77.24
console.log('starting with node %s', process.version)
setInterval(function(){ console.log('running') }, 5000)