Skip to content

Instantly share code, notes, and snippets.

View btipling's full-sized avatar
:shipit:
shipping code

btipling

:shipit:
shipping code
  • ConductorOne
  • Bay Area, California
  • 07:57 (UTC -12:00)
View GitHub Profile
@btipling
btipling / gist:1813667
Created February 13, 2012 04:27
go not building on lucid links ubuntu 32bit
home/vagrant/apps/go/src/pkg/runtime/zruntime_defs_linux_386.go:7: lock redeclared in this block
previous declaration at /home/vagrant/apps/go/src/pkg/runtime/runtime_defs.go:9
/home/vagrant/apps/go/src/pkg/runtime/zruntime_defs_linux_386.go:12: note redeclared in this block
previous declaration at /home/vagrant/apps/go/src/pkg/runtime/runtime_defs.go:32
/home/vagrant/apps/go/src/pkg/runtime/zruntime_defs_linux_386.go:17: _string redeclared in this block
previous declaration at /home/vagrant/apps/go/src/pkg/runtime/runtime_defs.go:38
/home/vagrant/apps/go/src/pkg/runtime/zruntime_defs_linux_386.go:22: iface redeclared in this block
previous declaration at /home/vagrant/apps/go/src/pkg/runtime/runtime_defs.go:43
/home/vagrant/apps/go/src/pkg/runtime/zruntime_defs_linux_386.go:27: eface redeclared in this block
previous declaration at /home/vagrant/apps/go/src/pkg/runtime/runtime_defs.go:48
func matchesKeyId(pgpId string, key *packet.PublicKey) bool {
buffer := bytes.NewBuffer(make([]byte, 8))
for _, b := range key.Fingerprint[16:] {
buffer.WriteString(strconv.FormatUint(uint64(b), 16))
}
log.Printf("pgpId: '%s' and buffer: '%s'\n", pgpId, strings.ToUpper(buffer.String()))
log.Printf("pgpId == buffer: %s", pgpId == strings.ToUpper(buffer.String()))
return pgpId == strings.ToUpper(buffer.String())
}
@btipling
btipling / latency.txt
Created May 31, 2012 13:39 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
val := 0
var index int
index = rand.Intn(NUM_SHARDS)
//Trying to find a randomish greater than 0 value to decrement.
for val == 0 {
if index < (NUM_SHARDS - 1) {
index++
} else {
index = 0
}
@btipling
btipling / unfucktenxer.js
Created June 14, 2012 06:13
Remove tenxer github hooks. They will not delete the hooks they add to your private repos even if you tell them to remove your github info. I had to remove 173 hooks added by tenxer.
#!/usr/local/bin/node
var https = require('https');
var token, username;
var tenxer = 'tenxer';
var shitsFucked = 0;
var shitsUnfucked = 0;
var reposCount = 0;
process.argv.forEach(function (arg) {
@btipling
btipling / testHoisting.js
Created June 15, 2012 17:47
Test if nested functions are redeclared in nested function declarations.
#!/usr/local/bin/node
var declarations = [];
var expressions = [];
function testDeclared() {
declarations.push(aDeclaredFunction);
aDeclaredFunction();
function aDeclaredFunction() {
console.log("I do declare!");
@btipling
btipling / gist:2963188
Created June 21, 2012 00:45
calling a handler for a form in Closure
var f = goog.dom.getElementsByTagNameAndClass('form')[0];
var listener = goog.events.getListeners(f, goog.events.EventType.SUBMIT,
false)[0];
listener.listener(new goog.events.Event());
{"number": 10001, "prefix": "$"}
{"html": "<h1>November 12th</h1><p>So cool</p>"}
function processData() {
var topSentry = Number.POSITIVE_INFINITY,
bottomSentry = Number.NEGATIVE_INFINITY,
fakeInfinity = Number.MAX_VALUE,
i, j, k, m, length,
s, points, ps, x, y, axis, val, f, p, updated;
updated = false;
function updateAxis(axis, min, max) {
if (min < axis.datamin && min != -fakeInfinity)