Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍👩‍👧‍👦
being a dad

Jeff Larson thejefflarson

👨‍👩‍👧‍👦
being a dad
View GitHub Profile
View vector-clock.js
var Clock = function(id){
this.id = id;
this.clock = {};
this.clock[this.id] = 0;
};
Clock.prototype.get = function() { return data; };
Clock.prototype.update = function(data, send) {
View Makefile
all: boston-results.csv
schools.csv: download.py
python download.py > schools.csv
boston-schools.csv: schools.csv
csvgrep -c 1 -m boston schools.csv > boston-schools.csv
boston-schools.db: boston-schools.csv
python build-dataset.py # in practice will output a sqlite db called boston-schools.db
View gist:0bc74e96cf789947ae02
desc "build cropped heightmap"
task :build_srtm do |t|
# have to download the SRTM_W_250m.tif first from cgiar
system "gdalwarp ./db/initial/srtm/SRTM_W_250m.tif ./db/initial/srtm/cropped.tif -t_srs 'EPSG:102003' -cutline ./db/initial/shapes/shoreline/us.shp -crop_to_cutline"
end
desc "build cropped raster from heightmap"
task :build_raster do |t|
STDOUT.sync = true
(200401..200407).each do |t|
View smash.rb
str = ""
nesting = 15000
nesting.times do
print "["
end
nesting.times do
print "]"
end
View Sorty.js
// usage: var mytable = new Sorty(table);
(function(){
var Row = function(el) {
this.values = $.map($(el).find('td'), function(e) {
var el = $(e);
var attr = el.attr('data-sort');
return attr ? parseFloat(attr) : el.text();
});
this.el = $(el);
View gist:10768422
// not checking error codes cause YOLO
void
plot_dots(OGRLayerH layer, cairo_t *ctx, simplet_map_t *map, const char *color){
OGRFeatureH feature;
while((feature = OGR_L_GetNextFeature(layer))){
int num = OGR_F_GetFieldAsInteger(feature, 0);
OGRGeometryH geom = OGR_F_GetGeometryRef(feature);
OGR_G_TransformTo(geom, map->proj);
OGREnvelope env;
View haxxors.txt
2014/02/17 08:52:43 [error] 231#0: *2612 open() "/usr/share/nginx/html/cgi-bin/rtpd.cgi" failed (2: No such file or directory), client: 183.60.244.44, server: jeffl.es, request: "GET /cgi-bin/rtpd.cgi?echo&AdminPasswd_ss|tdb&get&HTTPAccount HTTP/1.1", host: "69.115.143.116"
2014/02/17 08:52:43 [error] 231#0: *2613 open() "/usr/share/nginx/html/img/snapshot.cgi" failed (2: No such file or directory), client: 183.60.244.44, server: jeffl.es, request: "GET /img/snapshot.cgi?AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA�� HTTP/1.0"
2014/02/17 08:52:44 [error] 231#0: *2614 open() "/usr/share/nginx/html/oamp/System.xml" failed (2: No such file or directory), client: 183.60.244.44, server: jeffl.es, request: "GET /oamp/System.xml?action=login&user=L1_admin&password=L1_51 HTTP/1.1", host: "69.115.143.116"
2014/02/17 08:52:44 [error] 231#0: *2615 open() "/usr/share/nginx/html/oidtable.cgi" failed (2: No such file or
View parser.rl
%%{
machine records;
access @;
variable p @p;
variable pe @pe;
action offender_number_prefix {
@person = @cur = Person.new;
emit("offender_number_prefix");
}
View inline-template.js
var template = _.template([
"<p>",
"<%= thinger %>",
"</p>"
].join("\n"));
View rsa.js
(function(){
// Silly RSA, fun times, if you ever use this I will come to your house and
// punch you.
var gcd = function(a, b) {
var t;
while(b !== 0){
t = b;
b = a % t;
a = t;
}