Skip to content

Instantly share code, notes, and snippets.

View Raynos's full-sized avatar

Jake Verbaten Raynos

View GitHub Profile
raynos at raynos-ThinkPad-T440p  
~/gocode/src/github.com/uber/zanzibar on master*
$ go test -benchmem -cpu 2 -bench . ./wut_test.go 
testing: warning: no tests to run
BenchmarkClosure-2   	10000000	       113 ns/op	      64 B/op	       2 allocs/op
BenchmarkStruct-2    	10000000	       129 ns/op	      64 B/op	       2 allocs/op
PASS
ok  	command-line-arguments	2.684s
package staticConfig
import (
"io/ioutil"
"reflect"
"encoding/json"
"github.com/buger/jsonparser"
"github.com/pkg/errors"
# Use go test to generate coverage into ./coverage/cover.out
# go test ./... -cover -coverprofile ./coverage/cover.out
.PHONY: view-istanbul
view-istanbul:
@go get github.com/axw/gocov/gocov
@gocov convert ./coverage/cover.out > coverage/gocov.json
@node ./scripts/gocov-to-istanbul-coverage.js ./coverage/gocov.json \
> coverage/istanbul.json
istanbul report --root ./coverage --include "**/istanbul.json" html
@Raynos
Raynos / _perf.md
Created August 26, 2016 21:49
bind allocation performance

Node 6

raynos at raynos-ThinkPad-T440p  ~/projects/temp
$ node bind-perf.js 
v8 version:  5.0.71.60
.bind() allocate time: 311
fbind() allocate time: 51
raynos at raynos-ThinkPad-T440p  ~/projects/temp
$ node bind-perf.js 
@Raynos
Raynos / relay_server.md
Last active August 29, 2015 14:24
A c relay server

libuv relay server

var LibuvTChan = require('libuv-tchannel');

var parse = new LibuvTChan();

// You get frames form the channel
parser.onFrame = onFrame;
raynos at raynos-SVS15127PXB ~/uber/tchannel/node on hyperbahn-advertise
$ npm install
npm http GET https://registry.npmjs.org/crc
npm http GET https://registry.npmjs.org/bufrw
npm http GET https://registry.npmjs.org/error
npm http GET https://registry.npmjs.org/farmhash
npm http GET https://registry.npmjs.org/hexer
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/readable-stream
raynos at raynos-SVS15127PXB ~/uber/tchannel/node on hyperbahn-advertise*
$ npm install
npm http request GET https://registry.npmjs.org/bufrw
npm http request GET https://registry.npmjs.org/crc
npm http request GET https://registry.npmjs.org/error
npm http request GET https://registry.npmjs.org/farmhash
npm http request GET https://registry.npmjs.org/hexer
npm http request GET https://registry.npmjs.org/json-stringify-safe
npm http request GET https://registry.npmjs.org/lru-cache
npm http request GET https://registry.npmjs.org/readable-stream
'use strict';
var through = require('through');
var ss = require('stream-serializer').json;
var net = require('net');
var dba = null;
var dbb = null;
function boilerplateCreateServer(db) {
var h = require("virtual-hyperscript");
// Children as arguments[2]
h("div", {
"aria-hidden": true,
"ev-click": onClick,
}, [
h("p", {
"aria-hidden": true,
'use strict';
/*usage:
```js
var IOError = require('error/io');
var fs = require('fs');
fs.readFile(fPath, function (err, file) {
if (err) {