Skip to content

Instantly share code, notes, and snippets.

View progrium's full-sized avatar

Jeff Lindsay progrium

View GitHub Profile
@actsasflinn
actsasflinn / msgpack_benchmark.rb
Created January 30, 2010 05:07
Message Pack vs similar utilities
=begin
Message Pack vs similar utilities
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.0.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02
Packing
user system total real
pack: bert 18.320000 0.770000 19.090000 ( 19.101583)
pack: bson_ext 0.850000 0.030000 0.880000 ( 0.878398)
pack: json_ext 2.540000 0.040000 2.580000 ( 2.582495)
@somebox
somebox / convert_trac.rb
Created October 10, 2010 20:31
Convert Trac Wiki to Markdown
#!/usr/bin/env ruby
# Convert Trac DB Wiki pages to Markdown source files
# This script is based on http://github.com/seven1m/trac_wiki_to_github which
# converted all pages from a Trac DB to GitHub Wiki format (as Textile).
#
# I made two changes:
# - uses MarkDown format instead
# - uses the sqllite3-ruby gem which does not need Ruby 1.9
@tmc
tmc / gist:787105
Created January 19, 2011 23:29
gevent nonblocking stdin
import os
import sys
import fcntl
import gevent
from gevent.socket import wait_read
def print_every(s, repeat=1):
print s
if repeat:
import gevent
from gevent.server import StreamServer
from gevent.pool import Group
from gevent_zeromq import zmq
context = zmq.Context()
class CodependentGroup(Group):
"""
A greenlet group that will kill all greenlets if a single one dies.
@robballou
robballou / gist:929564
Created April 19, 2011 20:31
Example python of how to add DNS entries to Amazon's Route 53 with the boto library
from boto.route53.connection import Route53Connection
# your amazon keys
key = ""
access = ""
if __name__ == '__main__':
zones = {}
route53 = Route53Connection(key, access)
@inportb
inportb / csp_gevent.py
Created May 27, 2011 06:21
A Comet Session Protocol implementation for gevent
# Please see <https://github.com/inportb/playground/tree/master/Pinako/csp_gevent>
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@progrium
progrium / DisketteLabel.xml
Created October 23, 2011 11:42
Dymo label XML for an image filling a Diskette (Large) label
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
<PaperOrientation>Landscape</PaperOrientation>
<Id>Label</Id>
<PaperName>30258 Diskette</PaperName>
<DrawCommands>
<RoundRectangle X="0" Y="0" Width="3060" Height="3960" Rx="270" Ry="270"/>
</DrawCommands>
<ObjectInfo>
<ImageObject>
@progrium
progrium / test.badge.js
Created October 23, 2011 12:01
RaphaelJS script to test badges
var badge = Raphael(200, 0, 225, 187);
// Header
var attrs = {'fill': '#f90', 'stroke': 'none', 'font-size': 11, 'font-family': 'helvetica'};
badge.rect(5, 3, 225, 14).attr(attrs);
badge.circle(212, 8, 16).attr(attrs);
var textAttrs = {'fill': '#fff', 'font-size': 11, 'font-family': 'helvetica', 'text-anchor': 'end'};
var text = badge.text(198, 9, "SuperHappyDevHouse");
text.attr(textAttrs);
var num = badge.text(211, 9, "48");
@caniszczyk
caniszczyk / git-pre-receive-hook.sh
Created October 31, 2011 13:17
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.