Skip to content

Instantly share code, notes, and snippets.

View donovanhide's full-sized avatar

Donovan Hide donovanhide

View GitHub Profile
var sys = require('sys'),
require("./date/globalization/en-GB");
require("./date/core");
require("./date/parser");
require("./date/sugarpak");
require("./date/time");
require("./date/extras");
var start = new Date();
@donovanhide
donovanhide / Churn Hasher
Created August 14, 2010 20:18
Thanks Mikio!
#!/usr/bin/python
import atexit
import csv
import os
import glob
import time
import heapq
from struct import Struct
from array import array
from kyotocabinet import *
@donovanhide
donovanhide / output
Created November 6, 2011 17:07
Vector3D in a google dense_hash_map
$g++ vector_map.cpp -o vector_test && ./vector_test
Vector with x: 645 y: 413 z: 958 has value: 1312704908
Vector with x: 496 y: 358 z: 749 has value: 1988979514
Vector with x: 223 y: 868 z: 203 has value: 141221503
Vector with x: 345 y: 350 z: 869 has value: 1678149073
Vector with x: 565 y: 366 z: 722 has value: 1934444366
Vector with x: 934 y: 419 z: 619 has value: 560261625
Vector with x: 426 y: 92 z: 351 has value: 427818382
Vector with x: 24 y: 263 z: 407 has value: 760253072
...
{
"success" : true,
"documents" :{
"metaData" :{
"fields" : ["characters","docid","doctype","fragment_count","group","title"]
},
"rows" :[
{
"fragments" : [[93,11,36,450491776]],
"characters": 993759,
@donovanhide
donovanhide / index.html
Created March 20, 2012 13:35
IP Location Tesseract
<html>
<head>
<title>Streamgraph</title>
<script type="text/javascript" src="http://vis.stanford.edu/protovis/protovis-r3.2.js"></script>
<script type="text/javascript" src="stream.js"></script>
<style type="text/css">
body {
margin: 0;
}
$ gcc dht.cc -lstdc++ -o dht && ./dht
PASS
PASS
PASS
PASS
PASS
PASS
PASS
@donovanhide
donovanhide / Benchmark Results
Created December 15, 2012 17:21
First attempt at fast summing of a slice of uint8 using SSE assembly
go test sum -v -benchtime=0.1s
=== RUN TestSmallSumBytes
--- PASS: TestSmallSumBytes (0.00 seconds)
=== RUN TestSumBytes
--- PASS: TestSumBytes (2.52 seconds)
=== RUN TestBenchmark
--- PASS: TestBenchmark (10.96 seconds)
sum_test.go:75: Benchmark Results
Length: 0 Fast: 5.42 ns/op Slow: 4.93 ns/op Improvement -9.03%
Length: 1 Fast: 7.56 ns/op Slow: 5.26 ns/op Improvement -30.39%
$ go version && go run test.go
go version devel +87f67aadaed6 Sat Dec 22 17:41:00 2012 -0800 darwin/amd64
Test1: 0
Test1: 0
Test1: 0
Test1: 0
Test1: 0
Test1: 0
Test1: 0
Test1: 0
@donovanhide
donovanhide / testing.go.diff
Last active December 10, 2015 18:28
Patch for testing.go to align multi-line log output of tests. Makes it easier to read and copy and paste
--- a/src/pkg/testing/testing.go Sun Dec 30 12:01:53 2012 -0500
+++ b/src/pkg/testing/testing.go Mon Jan 07 11:43:25 2013 +0000
@@ -91,6 +91,7 @@
"strings"
"sync"
"time"
+ "unicode/utf8"
)
var (
@donovanhide
donovanhide / Concurrent map benchmarks
Last active January 24, 2016 03:21
Benchmarks for different implementations of a concurrent map
To benchmark:
go test -bench=".*" > machine_description.txt