Skip to content

Instantly share code, notes, and snippets.

@rcrowley
rcrowley / example.tf
Created February 15, 2024 17:56
The simplest custom internal tool, protected by the Substrate Intranet, BYO functionality
data "archive_file" "example" {
output_file_mode = "0666" # before umask
output_path = "${path.module}/example.zip"
source_file = "${path.module}/example/index.js"
type = "zip"
}
data "aws_apigatewayv2_apis" "substrate" {
name = "Substrate"
protocol_type = "HTTP"
// 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 October 31, 2017 17:21
Comparing the GPL v3 to the AGPL v3
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 March 31, 2016 18:51
This is very important if you write shell programs
█ $ 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
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 July 23, 2014 00:59
Least-Recently Accessed
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 (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:

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"

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 August 29, 2015 13:56
Benchmarks for Go CL 67730046

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