Skip to content

Instantly share code, notes, and snippets.

View AudriusButkevicius's full-sized avatar

Audrius Butkevicius AudriusButkevicius

View GitHub Profile
@AudriusButkevicius
AudriusButkevicius / patch.diff
Created March 26, 2016 22:34
Golang Android DNS patch
diff --git a/src/net/conf.go b/src/net/conf.go
index 36566a4..42ff1c5 100644
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -96,7 +96,7 @@ func initConfVal() {
confVal.nss = parseNSSConfFile("/etc/nsswitch.conf")
}
- confVal.resolv = dnsReadConfig("/etc/resolv.conf")
+ confVal.resolv = dnsReadConfig(resolvConfPath)
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// Read system DNS config from /etc/resolv.conf
package net
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// Read system DNS config from /etc/resolv.conf
package net
goroutine 646 [running]:
runtime/pprof.writeGoroutineStacks(0xe19090, 0xc0820340d0, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:516 +0x8b
runtime/pprof.writeGoroutine(0xe19090, 0xc0820340d0, 0x2, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:505 +0x4d
runtime/pprof.(*Profile).WriteTo(0xbc4f80, 0xe19090, 0xc0820340d0, 0x2, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:236 +0xdb
net/http/pprof.handler.ServeHTTP(0xc08204b3f1, 0x9, 0xe19008, 0xc0820340d0, 0xc0820fc1c0)
C:/Go/src/net/http/pprof/pprof.go:210 +0x385
net/http/pprof.Index(0xe19008, 0xc0820340d0, 0xc0820fc1c0)
goroutine 4099 [running]:
runtime/pprof.writeGoroutineStacks(0xe31868, 0xc0821a6340, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:516 +0x8b
runtime/pprof.writeGoroutine(0xe31868, 0xc0821a6340, 0x2, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:505 +0x4d
runtime/pprof.(*Profile).WriteTo(0xbc2f80, 0xe31868, 0xc0821a6340, 0x2, 0x0, 0x0)
C:/Go/src/runtime/pprof/pprof.go:236 +0xdb
net/http/pprof.handler.ServeHTTP(0xc08216a581, 0x9, 0xe317d0, 0xc0821a6340, 0xc082100380)
C:/Go/src/net/http/pprof/pprof.go:210 +0x385
net/http/pprof.Index(0xe317d0, 0xc0821a6340, 0xc082100380)
Audrius@Audrius gohashcompare $ go run main.go
Build: go1.7beta2 windows-amd64
testing: warning: no tests to run
Blake2b 256-4 5000 313853 ns/op 417.62 MB/s 32 B/op 1 allocs/op
Blake2b 256 Modified-4 5000 309857 ns/op 423.01 MB/s 32 B/op 1 allocs/op
Blake2b 256 SIMD-4 10000 198329 ns/op 660.88 MB/s 32 B/op 1 allocs/op
Blake2b 512-4 5000 311300 ns/op 421.05 MB/s 64 B/op 1 allocs/op
Blake2b 512 Modified-4 5000 306372 ns/op 427.82 MB/s 64 B/op 1 allocs/op
Blake2b 512 SIMD-4 10000 197811 ns/op 662.61 MB/s 64 B/op 1 allocs/op
Blake2s 256-4 3000 504822 ns/op 259.64 MB/s 32 B/op 1 allocs/op
package main
import(
"fmt"
"github.com/ccding/go-stun/stun"
)
func main(){
c := stun.NewClient()
package main
import(
"fmt"
"net"
"github.com/ccding/go-stun/stun"
)
func main(){
@AudriusButkevicius
AudriusButkevicius / README.md
Created November 6, 2016 00:03 — forked from csabahenk/README.md
Rsync rolling sum calculation in various languages

Rsync rolling sum calculation in various languages

The programs below calculate the rsync weak sum (of block size 4096) of the last block of the data available on stdin.

The data is assumed to be at least block size big; the weak sum is calculated in a direct manner for the first block, and from that on, the sum is adjusted on each incoming byte using the "rollability" of this kind of checksum.

The primary goal was to see the performance of naive implementations; so my metrics was both performance and "how close is the code to

package dummy
import (
"errors"
"runtime"
"syscall"
"unsafe"
)
type CredentialsPromptFlag uint32