Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
💻 🍞

Damian Gryski dgryski

🏠
💻 🍞
View GitHub Profile
View tri.asm
.model tiny
.radix 16
.data
jmp start
;k1 dw 6255
;k2 dw 3619
k1 dw 24CD
k2 dw 1
seed dw ?
View moving-forward-with-generics.txt
From: Ian Lance Taylor
After many discussions and reading many comments, we plan to move
forward with some changes and clarifications to the generics design
draft.
1.
We’re going to settle on square brackets for the generics syntax.
We’re going to drop the “type” keyword before type parameters, as
View fuzz.go
// +build gofuzz
package viaproxy
import (
"bytes"
"io"
"net"
)
@dgryski
dgryski / gist:a8353cb0977641f1feb6db1b8ed0eaf7
Created Feb 27, 2018
using the C pre-processor with Go
View gist:a8353cb0977641f1feb6db1b8ed0eaf7
laptop:cppgo dgryski$ cat gen.go
package main
//go:generate cpp-7 -E -P foo.gopp foo.go
laptop:cppgo dgryski$ cat foo.gopp
package main
import "fmt"
#define STRINGIFY(x) #x
View gist:8a5450a2452b9c67acd352bff5ed75dd
<dgryski@kamek[go] \ʕ◔ϖ◔ʔ/ > ag '// [A-Z]+(\([^\)]*\))?: ' |sed 's/.*\/\/ //; s/:.*//; s/(.*)/(username)/' |sort |uniq -c |sort -n
1 ARM
1 ASCII
1 BP
1 BX
1 CAVEAT
1 D
1 DATABUNDLE
1 DATABUNDLEEND
1 EXCEPT
View main_test.go
package main
import (
"strings"
"testing"
)
var m = map[string]bool{"hello.goodbye": true}
func old(req string, filter map[string]bool) string {
View gist:cff922f5ed8ff6c2b4907c38a1b2f8c0
BenchmarkKetama8-4 5000000 373 ns/op
BenchmarkKetama32-4 5000000 394 ns/op
BenchmarkKetama128-4 3000000 433 ns/op
BenchmarkKetama512-4 3000000 538 ns/op
BenchmarkKetama2048-4 2000000 672 ns/op
BenchmarkKetama8192-4 2000000 978 ns/op
BenchmarkChash8-4 10000000 129 ns/op
BenchmarkChash32-4 10000000 136 ns/op
BenchmarkChash128-4 10000000 220 ns/op
BenchmarkChash512-4 5000000 318 ns/op
View gist:31ef7c8d40f804ab1d91f0c47728e928
<dgryski@kamek[w] \ʕ◔ϖ◔ʔ/ > cat main.go
package main
import "log"
type X struct {
body string
}
type Message interface {
View bench.txt
<dgryski@kamek[powbench] \ʕ◔ϖ◔ʔ/ > go test -test.bench=.
BenchmarkPolyPow-4 5000000 286 ns/op
BenchmarkPolyFast-4 100000000 16.7 ns/op
PASS
ok github.com/dgryski/powbench 3.430s
View go-runtime.pl
#!/usr/bin/perl
use warnings;
use strict;
my $bin=$ARGV[0];
my @line = split /\s+/, `nm $bin |grep runtime.buildVersion`;
my $addr = hex($line[0]);
my $end = $addr + 16;