Skip to content

Instantly share code, notes, and snippets.

@adamf
adamf / gist:1131155
Created August 8, 2011 03:24
Smokeping config generation with awk
traceroute www.bbc.co.uk | awk '{ trg=$3; host=$2; gsub(/\./,"_",trg); gsub(/\./,"_",host); if (NR == 1) print "\n++",trg"\n\nmenu="$3"\ntitle="$3"\nhost="$3"\n"; else if ( !/\*/ ) print "+++",host, "\n\nhost=" $2"\n"}' >> /etc/smokeping/config.d/Targets
@adamf
adamf / gist:1043012
Created June 23, 2011 17:10
Experiments in R
# generate the distribution data and melt appropriately
k = rbind(t(replicate(100, rnorm(100,10,2))), t(replicate(100, rchisq(100,5, 2))))
s = t(apply(k, 1, summary))
foo = melt(s)
bar = melt(k)
# a plot of the smoothed data
ggplot(bar, aes(y=value, x=X1)) + geom_smooth() + ylab("milliseconds") + xlab("time")
@adamf
adamf / gist:837273
Created February 21, 2011 16:08
Diff of vexflow for adding notation-only display, but note flags don't render
diff --git a/src/formatter.js b/src/formatter.js
index 71333b6..a21a7d2 100644
--- a/src/formatter.js
+++ b/src/formatter.js
@@ -31,12 +31,12 @@ Vex.Flow.Formatter.FormatAndDraw = function(ctx, stave, notes, width) {
// Helper function to format and draw a single voice
Vex.Flow.Formatter.FormatAndDrawTab = function(ctx,
tabstave, stave, tabnotes, notes, width) {
+
var tabvoice = new Vex.Flow.Voice(Vex.Flow.TIME4_4).setStrict(false);