Skip to content

Instantly share code, notes, and snippets.

VERSION="2.4.1"
BUILD="betable1"
set -e -x
OLDESTPWD="$PWD"
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
@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"
@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 / 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,
@rcrowley
rcrowley / cron
Created June 14, 2011 19:33
Puppet installation notes
PATH="$PATH:/var/lib/gems/1.8/bin"
*/30 * * * * root puppet agent --no-daemonize --onetime --splay
@rcrowley
rcrowley / bootstrap.sh
Created May 20, 2011 17:57
Bootstrap a Puppet agent.
set -ex
apt-get install ruby rubygems ||
yum install ruby rubygems ||
pkgin install ruby rubygems ||
false
gem install facter ${FACTER_VERSION:+"-v$FACTER_VERSION"}
gem install puppet ${PUPPET_VERSION:+"-v$PUPPET_VERSION"}