Skip to content

Instantly share code, notes, and snippets.

View ryanuber's full-sized avatar

Ryan Uber ryanuber

View GitHub Profile
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
@ryanuber
ryanuber / raft-boltdb
Last active August 29, 2015 14:14
Raft backend benchmarks
BenchmarkBoltStore_FirstIndex-5 1000000 1932 ns/op
BenchmarkBoltStore_LastIndex-5 1000000 1907 ns/op
BenchmarkBoltStore_GetLog-5 300000 5931 ns/op
BenchmarkBoltStore_StoreLog-5 5000 266819 ns/op
BenchmarkBoltStore_StoreLogs-5 5000 300801 ns/op
BenchmarkBoltStore_DeleteRange-5 5000 322467 ns/op
BenchmarkBoltStore_Set-5 10000 247162 ns/op
BenchmarkBoltStore_Get-5 1000000 2176 ns/op
BenchmarkBoltStore_SetUint64-5 10000 240333 ns/op
BenchmarkBoltStore_GetUint64-5 1000000 2209 ns/op
---- Started new build at 2014-11-20 22:17:27.513674707 +0000 UTC ----
aws-build1 output will be in this color.
==> aws-build1: Inspecting the source AMI...
==> aws-build1: Creating temporary keypair: packer 546e6878-d7d2-3a20-ca03-a8f1891eebe8
==> aws-build1: Creating temporary security group for this instance...
==> aws-build1: Authorizing SSH access on the temporary security group...
==> aws-build1: Launching a source AWS instance...
 aws-build1: Instance ID: i-bdf72f53
==> aws-build1: Waiting for instance (i-bdf72f53) to become ready...
package main
import (
"github.com/armon/relay"
"log"
"time"
)
func main() {
conf := &relay.Config{Addr: "localhost"}
package main
import (
"fmt"
"sort"
"time"
"github.com/armon/relay"
)
@ryanuber
ryanuber / gist:78695e0d37451e77194e
Created October 16, 2014 02:33
Terraform hang during plan
SIGABRT: abort
PC=0x1a5ebe
goroutine 16 [syscall, 1 minutes]:
syscall.Syscall6(0x7, 0x4e0d, 0x86ba0c, 0x0, 0xc208072240, 0x0, 0x0, 0x1, 0x0, 0xc208072240)
/usr/local/go/src/pkg/syscall/asm_darwin_amd64.s:44 +0x5 fp=0x86b970 sp=0x86b968
syscall.wait4(0x4e0d, 0x86ba0c, 0x0, 0xc208072240, 0x2c31b, 0x0, 0x0)
/usr/local/go/src/pkg/syscall/zsyscall_darwin_amd64.go:32 +0x7d fp=0x86b9d0 sp=0x86b970
syscall.Wait4(0x4e0d, 0x86ba54, 0x0, 0xc208072240, 0x2ace4, 0x0, 0x0)
/usr/local/go/src/pkg/syscall/syscall_bsd.go:129 +0x64 fp=0x86ba18 sp=0x86b9d0
$ consul keyring -list
==> Gathering installed encryption keys...
==> Done!
dc2 (LAN):
HjZbybeuVTvM5QRtuLl77g== [2/2]
dc1 (LAN):
HjZbybeuVTvM5QRtuLl77g== [2/2]
$ consul keyring -init r+pUD3yH8bZVHxPrBwmI2g== -data-dir /tmp/consul
<start/join agents here>
$ consul keyring -list
==> Asking all WAN members for installed keys...
r+pUD3yH8bZVHxPrBwmI2g== [1/1]
==> Asking all LAN members for installed keys...
r+pUD3yH8bZVHxPrBwmI2g== [2/2]
@ryanuber
ryanuber / gist:7adb3babcc90cb9a6f40
Created August 23, 2014 06:53
terraform_example_panic
Refreshing Terraform state prior to plan...
Error running plan: unexpected EOF
panic: interface conversion: interface is nil, not string
2014/08/22 23:50:27 terraform-provider-aws:
2014/08/22 23:50:27 terraform-provider-aws: goroutine 8 [running]:
2014/08/22 23:50:27 terraform-provider-aws: runtime.panic(0x7d3040, 0xc2100a4700)
2014/08/22 23:50:27 terraform-provider-aws: /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
2014/08/22 23:50:27 terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.func·003(0x0, 0x0, 0x9, 0x0)
@ryanuber
ryanuber / gist:9498296
Last active August 29, 2015 13:57
goyaml parsing JSON text
package main
import (
"fmt"
"log"
"github.com/go-yaml/yaml"
)
var json_data = `
{