Skip to content

Instantly share code, notes, and snippets.

@pipoket
pipoket / udpserver.py
Created November 25, 2011 07:40
UDP server implementation for gevent. Copied from http://code.google.com/p/gevent/issues/detail?id=50
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
"""UDP/SSL server"""
import sys
import errno
import traceback
from gevent import socket
from gevent import core
from gevent.baseserver import BaseServer
@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.
@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");
@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>
@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

@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>
@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)
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.
@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:
@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