Skip to content

Instantly share code, notes, and snippets.

Richard Crowley rcrowley

Block or report user

Report or block rcrowley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rcrowley / LICENSE
Last active Oct 31, 2017
Comparing the GPL v3 to the AGPL v3
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
The GNU Affero General Public License is a free, copyleft license for
rcrowley / gist:724970de828cb445e14e958efa5ac2f0
Created Mar 31, 2016
This is very important if you write shell programs
View gist:724970de828cb445e14e958efa5ac2f0
█ $ cat
set -e -x
trap false EXIT
█ $ cat
set -e -x
trap true EXIT
█ $ sh; echo $?
+ trap false EXIT
set -e -x
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
rcrowley / lra.go
Created Jul 23, 2014
Least-Recently Accessed
View lra.go
package lra
// LRA is a fixed-size cache which expires the least-recently added string.
type LRA struct {
i int
m map[string]struct{}
ss []string
func NewLRA(n int) *LRA {

Keybase proof

I hereby claim:

  • I am rcrowley on github.
  • I am rcrowley ( on keybase.
  • I have a public key whose fingerprint is 16BF 2FED 3AEF 25E7 C901 FAA8 37AA AB88 53D2 F050

To claim this, I am signing this object:

set -e -x
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
git clone "git://"
mkdir -p "usr/bin" "usr/lib/python2.7/dist-packages" "usr/share/man/man1"
export PYTHONPATH="usr/lib/python2.7/dist-packages"

Benchmark of two graceful stop implementations

The server for each of these benchmarks is based on It was run as ./example >/dev/null 2>/dev/null.

The client for each of these benchmarks is ab -H"Host:" -c"100" -n"1000000" "".


rcrowley / gist:9192703
Last active Aug 29, 2015
Benchmarks for Go CL 67730046
View gist:9192703

Benchmarks before CL 67730046

./bench -bench=http

2014/02/24 10:21:20 Benchmarking 1 iterations
2014/02/24 10:21:20 Benchmarking 100 iterations
2014/02/24 10:21:20 Benchmarking 10000 iterations
rcrowley / sendmsg.go
Created Feb 19, 2014
sendmsg(2) SCM_RIGHTS demo
View sendmsg.go
package main
import (
rcrowley /
Last active Aug 29, 2015
A protip for authors of shell programs. I use this pattern *all the time* for working in a temporary directory and cleaning it up after I'm done but a quirk in how shells interpret failures in command substitution caused a program like these to remove my coworker's home directory when he ran said program on Mac OS X, which doesn't have `mktemp -d`.
set -e
# Looks clever, is short, but removes your working directory on Mac OS X
# where `mktemp -d` fails.
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
# ...
You can’t perform that action at this time.