Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍

Kenneth Reitz kennethreitz

🐍
View GitHub Profile
@kennethreitz
kennethreitz / browser
Created March 3, 2010 21:47 — forked from defunkt/browser
html | browser
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo "<h1>hi mom!</h1>" | browser
# $ ron -5 man/rip.5.ron | browser
if [ -t 0 ]; then
cat <<usage
@kennethreitz
kennethreitz / gist:324961
Created March 8, 2010 07:21 — forked from leah/gist:216443
Great collection of advanced emoticons.
:⌉
=⌉
¦-) as opposed to |
⍥ om nom nom
sudo curl "http://gist.github.com/raw/372696/bffde4ea5cf23eebd8b0f4ee15708a0a9d0af7f5/ssh-copy-id" -o /usr/local/sbin/ssh-copy-id
sudo chmod +x /usr/local/sbin/ssh-copy-id
@kennethreitz
kennethreitz / ports.sh
Created April 21, 2010 17:56 — forked from defunkt/ports.sh
List what ports are in use on OS X
sudo lsof -iTCP -sTCP:LISTEN -P
// ==UserScript==
// @name Google domain blacklist
// @namespace http://www.google.com
// @description Removes results for specific domains from google.
// @include http://www.google.com/search*
// @include http://www.google.co.uk/search*
// ==/UserScript==
var blacklist = new Array("experts-exchange.com", "torrentreactor.to");
for (domain in blacklist) {
@kennethreitz
kennethreitz / py2app.md
Created August 11, 2010 18:04 — forked from brantfaircloth/py2app.bash
Proper Setup of Py2App

Proper Setup of Py2App

This assumes you have a proper Framework'd Python installation.

brew install python --framework 

Install Qt v4.7.1

import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
class WebSocket(object):
handshake = (
@kennethreitz
kennethreitz / gist.py
Created September 9, 2010 00:26 — forked from soeren/gist.py
import httplib
import urllib
import re
import os.path
def gist_write(name, content, ext=None, login=None, token=None):
if ext is None:
ext = os.path.splitext(name)[1]
# credit: http://news.ycombinator.com/item?id=1543915
# in ipythonrc:
# execfile copy_and_paste.py
def copy(data):
from subprocess import Popen, PIPE
Popen(["xclip", "-selection", "clipboard"], stdin=PIPE).communicate(str(data))
def paste():
#! /usr/bin/env ruby
# this script takes your current commit, finds all the submodules in it,
# makes them static files in a new tree and updates a branch called 'heroku'
# - this way you can push a project with submodules to heroku easily
# just run this, then run "git push heroku heroku:master"
current_commit = `git rev-parse HEAD`
current_tree = `git rev-parse HEAD^{tree}`
puts "Starting at tree #{current_tree}"