Skip to content

Instantly share code, notes, and snippets.

@benburkert
benburkert / commands
Created June 14, 2017 17:47
BenchmarkAppend memory profile
$ go test -run XXX -bench=BenchmarkAppend -memprofile mem.out -memprofilerate 1 golang.org/x/net/dns/dnsmessage
$ go tool pprof -alloc_space -list dnsmessage dnsmessage.test mem.out
@benburkert
benburkert / benchstat
Created June 12, 2017 03:49
BenchmarkName
name old time/op new time/op delta
Name/abc.xzy.-8 274ns ± 1% 472ns ± 0% +72.30% (p=0.000 n=10+9)
Name/ab.cde.fgh.ijk.lmn.opq.rst.uvw.xyz.-8 1.32µs ± 2% 2.19µs ± 0% +66.61% (p=0.000 n=10+9)
Name/example.com.-8 446ns ± 1% 1140ns ± 1% +155.89% (p=0.000 n=10+10)
Name/bar.example.com.-8 451ns ± 2% 1014ns ± 1% +124.86% (p=0.000 n=10+9)
Name/foo.bar.example.com.-8 455ns ± 0% 843ns ± 1% +85.34% (p=0.000 n=8+10)
Name/xyz.foo.bar.example.com.-8 536ns ± 1% 1703ns ± 1% +217.67% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
Name/abc.xzy.-8 32.0B ± 0% 536.0B ± 0% +1575.00% (p=0.000 n=10+10)
@benburkert
benburkert / keybase.md
Created January 19, 2016 06:56
keybase.md

Keybase proof

I hereby claim:

  • I am benburkert on github.
  • I am benburkert (https://keybase.io/benburkert) on keybase.
  • I have a public key whose fingerprint is 08C7 752F 7067 69D5 A0ED D866 5F87 7D48 B719 3648

To claim this, I am signing this object:

@benburkert
benburkert / track-coverage
Last active August 29, 2015 14:13
track libgit2 implementation
#!/usr/bin/env ruby
#
# track-coverage
# example: ./track-coverage /path/to/go-libgit2 /path/to/libgit2 /path/to/git2go
require 'pp'
$go_libgit2_dir = ARGV[0] || File.join(ENV['GOPATH'], 'src/github.com/benburkert/go-libgit2')
$libgit2_dir = ARGV[1] || File.join(ENV['GOPATH'], 'src/github.com/libgit2/libgit2')
$git2go_dir = ARGV[2] || File.join(ENV['GOPATH'], 'src/github.com/libgit2/git2go')
@benburkert
benburkert / increase-sample-buffer-size.diff
Created April 6, 2012 17:49
ssldump patch: increase sample buffer size
--- a/base/pcap-snoop.c 2012-04-06 10:35:06.000000000 -0700
+++ b/base/pcap-snoop.c 2012-04-06 10:45:31.000000000 -0700
@@ -286,7 +286,7 @@
err_exit("Aborting",-1);
}
}
- if(!(p=pcap_open_live(interface_name,5000,!no_promiscuous,1000,errbuf))){
+ if(!(p=pcap_open_live(interface_name,18432,!no_promiscuous,1000,errbuf))){
fprintf(stderr,"PCAP: %s\n",errbuf);
err_exit("Aborting",-1);
@benburkert
benburkert / reorder-include-files.diff
Created April 6, 2012 17:48
ssldump patch: reorder include files
--- a/base/pcap-snoop.c 2010-03-18 22:59:13.000000000 -0700
+++ b/base/pcap-snoop.c 2010-03-18 22:59:30.000000000 -0700
@@ -46,10 +46,9 @@
static char *RCSSTRING="$Id: pcap-snoop.c,v 1.14 2002/09/09 21:02:58 ekr Exp $";
-
+#include <net/bpf.h>
#include <pcap.h>
#include <unistd.h>
@benburkert
benburkert / 0001-Add-SNICallback-to-tls.Config.patch
Created March 22, 2012 18:21
go crypto/tls SNICallback patch
From dfab1ff5a57b6a0809b1a6c7d3dccaf71d630ce8 Mon Sep 17 00:00:00 2001
From: Ben Burkert <ben@benburkert.com>
Date: Thu, 22 Mar 2012 11:18:04 -0700
Subject: [PATCH] Add SNICallback to tls.Config.
---
tls/common.go | 3 +++
tls/handshake_server.go | 9 +++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
@benburkert
benburkert / sni_test.go
Created March 21, 2012 18:43
go crypto/tls test & patch for SNI
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"errors"
--- config.guess.orig 2011-09-03 05:51:07.000000000 -0700
+++ config.guess 2012-01-27 21:57:09.000000000 -0800
@@ -1,9 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
@benburkert
benburkert / dpkg.rb
Created January 24, 2012 01:28 — forked from tmm1/dpkg.rb
homebrew formula to get dpkg working a mac
require 'formula'
class Dpkg <Formula
url 'https://launchpad.net/debian/+archive/primary/+files/dpkg_1.16.0.3.tar.bz2'
homepage 'http://en.wikipedia.org/wiki/Dpkg'
md5 '0266b06ef9da8278cea008d21e17e5f6'
depends_on 'gnu-tar'
# depends_on 'cmake'