Skip to content

Instantly share code, notes, and snippets.

View progrium's full-sized avatar

Jeff Lindsay progrium

View GitHub Profile
export PS1="\[\033[01;31m\]\$(status=\$?; [[ \$status -ne 0 ]] && echo \"[\$status] \")\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\n\$ \[\033[00m\]"
alias reload="curl -s https://gist.githubusercontent.com/progrium/6a24ae8d7ab93bc65579/raw/gistfile1.txt > ~/.profile.me; source ~/.profile"
alias g="git"
alias gpr="git pull --rebase origin"
alias gprr="git pull --rebase"
alias gpu="git push origin"
alias gpuu="git push"
alias gs="git status"
@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)
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.
@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>
@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");
@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
@mpapis
mpapis / wait_port.sh
Created January 28, 2012 03:30 — forked from anonymous/gist:1692424
Wait for a port in bash, should work on sysv linux
#!/usr/bin/env bash
# wait_port <port> <seconds>
check_port ()
{
netstat -tpln 2> /dev/null | sed -E '/^[^t]/ d; s/^([^ ]+ +){3}//; s/ .*$//; s/^.*://;' | grep --color "^$1$" > /dev/null
}
wait_port ()
#!/bin/bash
# Usage:
# $ ./heroku-deploy.sh <app name> <git repo url> <heroku api key>
APP="$1"
REPO="$2"
APIKEY="$3"
echo "-----> Creating application $APP"
curl -u ":$APIKEY" -d "app[name]=$APP" -X POST https://api.heroku.com/apps -s > /dev/null
@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: