Skip to content

Instantly share code, notes, and snippets.

@miekg
miekg / gist:5a1db660a4fc23a34428
Created June 7, 2014 07:03
Some caching improvements for SkyDNS
master branch:
PASS
BenchmarkDNSSingle 2000 640568 ns/op
BenchmarkDNSWildcard 2000 1184798 ns/op
BenchmarkDNSSECSingle 2000 956796 ns/op
cache branch:
PASS
BenchmarkDNSSingle 5000 716114 ns/op
110 go func() {
1 if err := s.Run(); err != nil {
2 log.Fatal(err)
3 }
4 }()
diff --git a/parse_test.go b/parse_test.go
index 12de822..5ddb880 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -1049,7 +1049,7 @@ func TestTXT(t *testing.T) {
}
func TestTypeXXXX(t *testing.T) {
- _, err := NewRR("example.com IN TYPE1234 \\# 4 aabbccdd")
+ _, err := NewRR("example.com IN type1234 \\# 4 aabbccdd")
@miekg
miekg / zbundle
Created February 15, 2015 15:45
zbundle: bundle code and zip to have one unit of deployment
#!/bin/bash
set -e
getopts "s" show && shift
if [[ $show == "s" ]]; then
while read line; do
hex="$(echo $line | od -N4 -x | head -1)"
byte=(${hex})
if [[ ${byte[1]} == "4b50" && ${byte[2]} == "0403" ]]; then
break
fi
# GIT HOWTO
## Partially Apply Pull Request
#. git checkout -b other-repo-master master
#. git pull https://github.com/other-repo/my-repo-name.git master
#. git checkout master
#. git cherry-pick COMMIT_HASH
## Fetch pull request
@miekg
miekg / learninggo.txt
Last active September 3, 2015 21:37
"Learning Go" in Internet Draft text format
Go R. Gieben
Internet-Draft January 7, 2015
Intended status: Standards Track
Expires: July 11, 2015
R. Gieben
Atoom
December 10, 2014
Using mmark to create I-Ds and RFCs
@miekg
miekg / gist:921542
Created April 15, 2011 11:18
example client for async queries in Go DNS
package main
import (
"dns"
"fmt"
)
func HelloQuery(w dns.RequestWriter, req *dns.Msg, ) {
// client.Attemps = 3
@miekg
miekg / hash.go
Created June 11, 2012 11:43
Simple hashing and salting algo in Go
package main
import (
"crypto/sha1"
"fmt"
"io"
)
const ITER = 100000
@miekg
miekg / gist:3075199
Created July 9, 2012 08:49
check DS
package main
import (
"flag"
"fmt"
"github.com/miekg/dns"
"os"
"unbound"
)