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
rcrowley / LICENSE
Last active Oct 31, 2017
Comparing the GPL v3 to the AGPL v3
View LICENSE
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
@rcrowley
rcrowley / gist:724970de828cb445e14e958efa5ac2f0
Created Mar 31, 2016
This is very important if you write shell programs
View gist:724970de828cb445e14e958efa5ac2f0
█ $ cat false-trap-true.sh
set -e -x
trap false EXIT
true
█ $ cat true-trap-false.sh
set -e -x
trap true EXIT
false
█ $ sh false-trap-true.sh; echo $?
+ trap false EXIT
View duo-unix-deb.sh
VERSION="1.9.14"
BUILD="slack2"
set -e -x
OLDESTPWD="$PWD"
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
@rcrowley
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 {
View keybase.md

Keybase proof

I hereby claim:

  • I am rcrowley on github.
  • I am rcrowley (https://keybase.io/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:

View s3cmd-deb.sh
BUILD="betable3"
set -e -x
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
git clone "git://github.com/s3tools/s3cmd.git"
mkdir -p "usr/bin" "usr/lib/python2.7/dist-packages" "usr/share/man/man1"
export PYTHONPATH="usr/lib/python2.7/dist-packages"
View README.md

Benchmark of two graceful stop implementations

The server for each of these benchmarks is based on https://github.com/rcrowley/go-tigertonic/tree/master/example. It was run as ./example >/dev/null 2>/dev/null.

The client for each of these benchmarks is ab -H"Host: example.com" -c"100" -n"1000000" "http://127.0.0.1:8000/stuff/ID".

Baseline

@rcrowley
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
rcrowley / sendmsg.go
Created Feb 19, 2014
sendmsg(2) SCM_RIGHTS demo
View sendmsg.go
package main
import (
"fmt"
"log"
"net"
"os"
"os/exec"
"reflect"
"syscall"
@rcrowley
rcrowley / bad-side-effects-on-mac-osx.sh
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`.
View bad-side-effects-on-mac-osx.sh
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.