Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Crowley rcrowley

View GitHub Profile
View zipadeedoodah_test.go
// It seems that Go's archive/zip does not preserve the
// executable bit on input files on Mac OS. It does, so
// something else is fishy, but I'll preserve this for
// posterity and further thinking about what's wrong.
package zipadeedoodah
import (
"archive/zip"
"io/ioutil"
"os"
@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"
You can’t perform that action at this time.