This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,"Goroka","Goroka","Papua New Guinea","GKA","AYGA",-6.081689,145.391881,5282,10,"U","Pacific/Port_Moresby" | |
2,"Madang","Madang","Papua New Guinea","MAG","AYMD",-5.207083,145.7887,20,10,"U","Pacific/Port_Moresby" | |
3,"Mount Hagen","Mount Hagen","Papua New Guinea","HGU","AYMH",-5.826789,144.295861,5388,10,"U","Pacific/Port_Moresby" | |
4,"Nadzab","Nadzab","Papua New Guinea","LAE","AYNZ",-6.569828,146.726242,239,10,"U","Pacific/Port_Moresby" | |
5,"Port Moresby Jacksons Intl","Port Moresby","Papua New Guinea","POM","AYPY",-9.443383,147.22005,146,10,"U","Pacific/Port_Moresby" | |
6,"Wewak Intl","Wewak","Papua New Guinea","WWK","AYWK",-3.583828,143.669186,19,10,"U","Pacific/Port_Moresby" | |
7,"Narsarsuaq","Narssarssuaq","Greenland","UAK","BGBW",61.160517,-45.425978,112,-3,"E","America/Godthab" | |
8,"Nuuk","Godthaab","Greenland","GOH","BGGH",64.190922,-51.678064,283,-3,"E","America/Godthab" | |
9,"Sondre Stromfjord","Sondrestrom","Greenland","SFJ","BGSF",67.016969,-50.689325,165,-3,"E","America/Godthab" | |
10,"Thule Air Base","Thule","Greenl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package debug | |
import ( | |
"fmt" | |
"io" | |
) | |
func teeCopy(w1 io.Writer, w2 io.Writer, r io.Reader) (totalN int, err error) { | |
buf := make([]byte, 1024) | |
for { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fs | |
// indirection techniques in go | |
//BenchmarkDirectFib-12 2000000000 0.13 ns/op | |
//BenchmarkSavePtr-12 30 34612496 ns/op | |
//BenchmarkUseBool-12 1000000000 0.53 ns/op | |
//BenchmarkIface-12 2000000000 0.16 ns/op | |
//ok fs 27.053s | |
import "testing" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func dump(seen map[reflect.Value]bool, rv reflect.Value) string { | |
if rv.Kind() == reflect.Invalid { | |
return "nil" | |
} | |
if _, ok := seen[rv]; ok { | |
return "SEEN[" + rv.Type().Name() + "]" | |
} | |
seen[rv] = true | |
method := rv.MethodByName("String") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package teewriter | |
type TeeWriter struct { | |
w1 io.Writer | |
w2 io.Writer | |
} | |
func (tw *TeeWriter) Write(p []byte) (n int, err error) { | |
n1, err1 := tw.w1.Write(p) | |
n2, err2 := tw.w2.Write(p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"os" | |
) | |
func main() { | |
if len(os.Args) != 3 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put this file in $GOPATH/perfbench/perfbench_test.go | |
//go test -bench . -v perfbench/... | |
// | |
//go version go1.5.1 linux/amd64 | |
// | |
//noop: 0 | |
//var x interface{} = <int8>: 1 | |
//var x interface{} = <*int8>: 0 | |
//var x interface{} = <[]int16>: 1 | |
//var x interface{} = <typedInterface(ptr)>: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildValMap(obj, m) { | |
if (typeof obj !== 'object' || obj === null) { | |
return ''; | |
} | |
if (obj === Object.prototype || obj === Array.prototype) { | |
return ''; | |
} | |
if (m.has(obj)) { | |
return ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func diffLines(a, b string) { | |
fmt.Printf("len(a) %d len(b) %d\n", len(a), len(b)) | |
sa := bufio.NewScanner(strings.NewReader(a)) | |
sb := bufio.NewScanner(strings.NewReader(b)) | |
index := 0 | |
for { | |
index++ | |
var readSomething bool | |
var aline string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sudo apt-get install cpufrequtils | |
sudo cpufreq-set -c 0 -g performance | |
sudo cpufreq-set -c 1 -g performance | |
sudo cpufreq-set -c 2 -g performance | |
sudo cpufreq-set -c 3 -g performance | |
sudo cpufreq-set -c 4 -g performance | |
sudo cpufreq-set -c 5 -g performance |