Skip to content

Instantly share code, notes, and snippets.

@rcrowley
rcrowley / httperf-deb.sh
Created October 1, 2012 16:45
httperf_modified Debian packaging
VERSION="0.9.0"
BUILD="betable1"
set -e -x
OLDESTPWD="$PWD"
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
@rcrowley
rcrowley / go-deb.sh
Last active October 10, 2015 17:48
Go binary distribution Debian packaging
VERSION="1.4.2"
BUILD="slack1"
set -e -x
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
curl -O "https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz"
tar xf "go$VERSION.linux-amd64.tar.gz"
[cache]
CACHE_QUERY_INTERFACE = <%= private_ipaddress || ipaddress %>
CACHE_QUERY_PORT = 7002
LINE_RECEIVER_INTERFACE = <%= private_ipaddress || ipaddress %>
LINE_RECEIVER_PORT = 2013
PICKLE_RECEIVER_INTERFACE = <%= private_ipaddress || ipaddress %>
PICKLE_RECEIVER_PORT = 2014
CONF_DIR = /etc/graphite/
@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
@rcrowley
rcrowley / failover-lb-member.sh
Created May 24, 2012 00:42
How to use two Cloud Servers to make a decently available load balancer
#!/bin/sh
# Failover a member of a load balancer pair. If this Cloud Server is
# currently the primary, it becomes the secondary, and vice versa.
#/ Usage: failover-lb-member
set -e
usage() {
@rcrowley
rcrowley / oracle-jdk-deb.sh
Created April 12, 2012 00:20
Oracle JDK Debian packaging
VERSION="6u31-b04"
BUILD="betable4"
set -e -x
# Keep track of the original working directory.
OLDESTPWD="$PWD"
# Work in a temporary directory.
cd "$(mktemp -d)"
@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 / monad.py
Created September 21, 2011 17:58
The three monad laws in Python. Why not?
# The three monad laws in Python. Why not?
# <http://rcrowley.org/2011/09/21/monads.html>
# <http://homepages.inf.ed.ac.uk/wadler/topics/monads.html#essence>
# A monad is a wrapper. Anyone who tells you otherwise is being obtuse.
class M(object):
def __init__(self, a):
self.a = a
def __repr__(self):
return '<M a: %s>' % self.a
@rcrowley
rcrowley / jinf.bash
Created September 9, 2011 15:08
Large memory support for Joyent's jinf program
#!/usr/bin/bash
# jinf v1.2
# Provides basic resource utilization information about an Accelerator
# Joyent Inc. 2009
# Large memory support 2011-09-09 by Richard Crowley <r@rcrowley.org>
PATH=/usr/bin:/usr/sbin
zone=`zonename`
zoneid=$( zoneadm list -p | awk -F: '{print $1}' )
@rcrowley
rcrowley / do-it.py
Created September 7, 2011 22:46
What happens when using Eventlet and inheriting an SSL socket file descriptor
import eventlet
import eventlet.debug
import optparse
import socket
import ssl
eventlet.monkey_patch(os=True,
select=True,
socket=True,
thread=True,