Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Backtrace
  • Dallas, TX
View GitHub Profile
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
# Start working on a pull request, this requires a .git/user-repo file
# containing the string "user/repository"
pr() {
local pr_num=$1
if [[ -z $pr_num ]]; then
echo "Need the pull request number" >&2
return 1
fi
if [[ ! -r .git/user-repo ]]; then
echo "Need to setup user/repo" >&2
#cribbed from http://vimeo.com/52569901 (Twilio carrier call origination moderation)
# The idea is that many fan-in queues can enqueue at any rate, but
# dequeue needs to happen in a rate-controlled manner without allowing
# any individual input queue to starve other queues.
# http://en.wikipedia.org/wiki/Leaky_bucket (second sense, "This version is referred to here as the leaky bucket as a queue.")
#
# requires:
# redis 2.6+
# redis-py>=2.7.0
# anyjson
@cstrahan
cstrahan / Makefile
Created December 5, 2013 06:20 — forked from jvns/Makefile
obj-m += rootkit.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
require 'jruby'
module Serialize
def self.serialize(obj)
baos = java.io.ByteArrayOutputStream.new
oos = java.io.ObjectOutputStream.new(baos)
oos.write_object(JRuby.reference(obj))
oos.close
@cstrahan
cstrahan / thunk.c
Created November 14, 2013 17:37 — forked from karthick18/thunk.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#ifndef MAP_32BIT
#error "MAP_32BIT not defined"
#endif
struct scope
{
@cstrahan
cstrahan / ducker.sh
Created October 28, 2013 03:04 — forked from tobert/ducker.sh
#!/bin/bash
# snapshot the previous volume before updating
# otherwise there will be a CoW for each child, which could get slow quickly
btrfs subvolume snapshot /btrfs/base/precise-amd64-2013-04-01 /btrfs/base/precise-amd64-2013-04-31
# differential copy --inplace avoids the tempfile/mv so large files can remain shared
rsync -avx --inplace --delete server.domain.com::precise-amd64 /btrfs/base/precise-amd64-2013-04-31
# now make a snapshot for an app
@cstrahan
cstrahan / README.md
Created October 14, 2013 05:55 — forked from nikcub/README.md
require "mkmf"
$libs += " -lstdc++ "
create_makefile("human")