Skip to content

Instantly share code, notes, and snippets.

View streadway's full-sized avatar

Sean Treadway streadway

  • Veo - ex SoundCloud
  • Berlin
View GitHub Profile
@streadway
streadway / stress.go
Created February 9, 2014 13:22
AMQP stress test #93
package main
import (
"github.com/streadway/amqp"
"log"
"time"
)
const (
writeURL = "amqp://localhost/"
@streadway
streadway / uuid22.c
Created September 12, 2012 21:29
Example UUID in 22 bytes. Linux: `cc -luuid uuid22.c` Darwin: `cc uuid22.c`
#include <stdio.h>
#include <uuid/uuid.h>
#include <sys/types.h>
u_int64_t bits2uint64(unsigned char const bits[]) {
return ((u_int64_t)bits[0] << 56)
| ((u_int64_t)bits[1] << 48)
| ((u_int64_t)bits[2] << 40)
| ((u_int64_t)bits[3] << 32)
#!/bin/bash
cat << EOF > /etc/apt/sources.list.d/testing.list
deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free
EOF
cat << EOF > /etc/apt/preferences
Package: *
Pin: release a=stable
function fromISO8601(str) {
var o = function(s) { return (s || '+') == '-' ? -1 : 1 } // Offset (pos/neg)
, i = function(s) { return s ? parseInt(s, 10) : 0; } // Integer (smart 0 handling)
, m = str.match(/(\d\d\d\d)-(\d\d)-(\d\d)(?:[T ](\d\d):?(\d\d):?(\d\d)?(?:Z?([+-]?)(\d\d):?(\d\d)?)?)?/)
, d = new Date()
;
d.setUTCFullYear(i(m[1]));
d.setUTCMonth(i(m[2]));