Skip to content

Instantly share code, notes, and snippets.

View akutz's full-sized avatar

Andrew Kutz akutz

View GitHub Profile
@akutz
akutz / goodbye-example.go
Created October 4, 2017 19:20
An example program using the Goodbye library.
package main
import (
"context"
"fmt"
"log"
"net"
"net/http"
"os"
"time"
@akutz
akutz / README.md
Last active October 9, 2017 17:44
A small one-liner to undo the changes made by the Golang dependency tool "dep" when the only change is a file's line-endings.

The Golang dependency tool dep is awesome, but it has this habit of mark files as changed when the only difference is related to line-endings. The following one-line script reverts those changes:

git checkout -- \
  $(for f in $(git status --porcelain | \
    grep " M" | awk '{print $2}'); do \
      if git --no-pager diff $f 2>&1 | head -n 1 | grep -q "warning: CRLF will be replaced by LF"; then \
        echo $f; \
      fi; \
    done;)
@akutz
akutz / README.md
Last active October 24, 2017 18:48
Building Go on macOS High Sierra

When Go is built from source on macOS High Seirra, two errors may occur during the test phase:

  1. Network Timeout
  2. X509 Chain Count

Network Timeout

This bug is a known issue, golang#22062.

--- FAIL: TestDialerDualStackFDLeak (0.20s)
@akutz
akutz / sortfold-benchmark.sh
Created October 23, 2017 22:52
The benchmark results for the sortfold repo.
$ go test -benchmem -run Bench -bench . -v
goos: darwin
goarch: amd64
pkg: github.com/akutz/sortfold
Benchmark_FoldedSort______2_Chars____LowerCase_Sorted-8 30000000 40.5 ns/op 0 B/op 0 allocs/op
Benchmark_LCasedSort______2_Chars____LowerCase_Sorted-8 30000000 49.3 ns/op 0 B/op 0 allocs/op
Benchmark_FoldedSort______2_Chars____LowerCase_Shuffled-8 30000000 46.4 ns/op 0 B/op 0 allocs/op
Benchmark_LCasedSort______2_Chars____LowerCase_Shuffled-8 20000000 59.7 ns/op 0 B/op 0 allocs/op
Benchmark_FoldedSort______2_Chars____MixedCase_Sorted-8 50000000 37.9 ns/op 0 B/op 0 allocs/op
Benchmark_LCasedSort______2_Chars____MixedCase_Sorted-8 10000000 114 ns/op 8 B/op 2 allocs/op
@akutz
akutz / glide.yaml
Created October 26, 2017 22:35
nayana-ibm logrus
package: github.com/codedellemc/rexray
import:
################################################################################
## NAYANA-IBM LOGRUS ##
################################################################################
- package: github.com/Sirupsen/logrus
ref: support/nayana-ibm
repo: https://github.com/akutz/logrus
@akutz
akutz / gvt-restore.sh
Created November 28, 2017 20:34
vSphere Docker Volume Driver Sirupsen Fun
$ gvt restore
2017/11/28 14:31:11 fetching cloud.google.com/go/compute/metadata
2017/11/28 14:31:11 fetching github.com/coreos/etcd/auth/authpb
2017/11/28 14:31:11 fetching github.com/boltdb/bolt
2017/11/28 14:31:11 fetching github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes
2017/11/28 14:31:11 fetching github.com/coreos/etcd/clientv3
2017/11/28 14:31:11 fetching github.com/coreos/etcd/etcdserver/etcdserverpb
2017/11/28 14:31:11 fetching github.com/coreos/etcd/mvcc/mvccpb
2017/11/28 14:31:11 fetching github.com/coreos/etcd/pkg/tlsutil
2017/11/28 14:31:14 fetching github.com/coreos/go-systemd
@akutz
akutz / dep-init.sh
Created November 28, 2017 20:46
Updating vSphere Docker Volume Driver to Golang Dep
$ dep init
Importing configuration from gvt. These are only initial constraints, and are further refined during the solve process.
Detected gb/gvt configuration files...
Converting from vendor/manifest ...
Using * as initial constraint for imported dep cloud.google.com/go
Trying * (3e1507a) as initial lock for imported dep cloud.google.com/go
Using master as initial constraint for imported dep github.com/sirupsen/logrus
Trying master (95cd2b9) as initial lock for imported dep github.com/sirupsen/logrus
Using * as initial constraint for imported dep github.com/boltdb/bolt
Trying * (d974993) as initial lock for imported dep github.com/boltdb/bolt
@akutz
akutz / csi.pb.go
Created February 9, 2018 19:46
CSI Spec Versioned Namespace
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: csi.proto
/*
Package csi is a generated protocol buffer package.
It is generated from these files:
csi.proto
It has these top-level messages:
[0]akutz@pax:dep$ git show-ref --head
063d03889f6be8391be87143b907e1e63c461191 HEAD
063d03889f6be8391be87143b907e1e63c461191 refs/heads/master
f7999207706e81f490561d86ec2331cbe939e664 refs/pull/origin/1/head
bbc601799e1d8808a4c705986f07d8e17567da05 refs/pull/origin/1000/head
7571fe60f3ebf2ec18c54db3ed1e595013e91463 refs/pull/origin/1000/merge
b90c0e90746ea1b2e82c0f76855407768fd19deb refs/pull/origin/1004/head
eb40858a46ef95703cf7797027c543e10c982c61 refs/pull/origin/1004/merge
814ee6bde244d3e0eadb9b7c8e8559f591141d11 refs/pull/origin/1005/head
394b995c4d12409c1ab7d524d430541e36ff535c refs/pull/origin/1009/head
#!/bin/bash
# Must set BINTRAY_USER and BINTRAY_KEY to owner of both orgs and that
# owner's API key
# Set to stable, staged, or unstable
REPO=${REPO:-$1}
REPO=${REPO:-stable}
# It's possible to pass in a file with the