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"
@rcrowley
rcrowley / rxvt-unicode.sh
Created June 15, 2010 06:39
Mac rxvt-unicode setup.
# Mac rxvt-unicode setup.
# http://rcrowley.org/articles/rxvt-unicode.html
# Install dependencies from MacPorts and CPAN.
sudo port install rxvt-unicode +xterm_colors_256
sudo port install terminus-font
sudo cpan install Mac::Pasteboard
# Run urxvt at X11 startup.
defaults write org.x.X11 app_to_run /opt/local/bin/urxvt
@rcrowley
rcrowley / grace.go
Last active March 1, 2023 16:06
Graceful stop in Go
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@rcrowley
rcrowley / acknowledgment_test.go
Last active October 14, 2022 09:22
Benchmark of goroutine acknowledgment patterns
// Go encourages us to organize our code using goroutines and to use
// channels of channels to implement request-response semantics [1].
//
// I have encountered far more instances that require acknowledgment
// than fully-fledged respones so I became curious whether channels
// of channels were indeed the best implementation strategy.
//
// In summary, yes, they are. These benchmarks demonstrate that
// channels perform better than mutexes, that condition variables are
// still clumsy, and that preallocation is a huge win when and if you
@rcrowley
rcrowley / sendmsg.go
Created February 19, 2014 17:07
sendmsg(2) SCM_RIGHTS demo
package main
import (
"fmt"
"log"
"net"
"os"
"os/exec"
"reflect"
"syscall"
@rcrowley
rcrowley / deps.pp
Created November 16, 2010 00:14
Deploying Django with Puppet
stage { "pre": before => Stage["main"] }
class python {
package {
"build-essential": ensure => latest;
"python": ensure => "2.6.6-2ubuntu1";
"python-dev": ensure => "2.6.6-2ubuntu1";
"python-setuptools": ensure => "latest";
}
exec { "easy_install pip":
path => "/usr/local/bin:/usr/bin:/bin",
@rcrowley
rcrowley / modpython.conf
Created June 22, 2010 04:39
Redis in Ganglia
modules {
module {
name = "python_module"
path = "/usr/lib/ganglia/modpython.so"
params = "/usr/lib/ganglia/python_modules"
}
}
include ('/etc/ganglia/conf.d/*.pyconf')
// 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 / graphite-deb.sh
Created April 5, 2012 14:34
Graphite Debian packaging
VERSION="0.9.9"
BUILD="betable1"
set -e -x
# Keep track of the original working directory.
OLDESTPWD="$PWD"
# Work in a temporary directory.
cd "$(mktemp -d)"
@rcrowley
rcrowley / whisper-clean.py
Created July 20, 2012 23:35
Clean up Whisper files that no longer map to this host.
import os
import os.path
import sys
from graphite.render.hashing import ConsistentHashRing
instances = []
unwelcome_instances = []
for arg in sys.argv[1:]:
unwelcome = False