Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍

Kenneth Reitz kennethreitz

🐍
View GitHub Profile
@kennethreitz
kennethreitz / .bash_profile.sh
Created October 27, 2009 16:58
My .bashrc configuration
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
@kennethreitz
kennethreitz / robot.py
Created November 24, 2009 16:20
Pacman Simulation for iRoomba (years ago, don't worry)
from create import *
from time import *
import create
robot = create.Create(3)
def wait():
sleep(.5)
def die():
@kennethreitz
kennethreitz / oh-god.py
Created November 24, 2009 16:32
My first python script from 4 years ago. Wow.
def main():
import os, time
menu_selection = 0
while menu_selection != 5:
clear_screen()
mainmenu()
if menu_selection == 1:
clear_screen()
print_instructions()
elif menu_selection == 2:
@kennethreitz
kennethreitz / populus-codes.txt
Created November 28, 2009 03:05
Populus Sheild Codes
Inside of shield World
---------------- --------
6 large blocks HURTUOLD
Heavy vertical lines JOSDEBOY
Light vertical lines MORYDOR
Light horizontal lines TIMDIDOR
Heavy horizontal lines CALKOPPAL
Heavy diagonal lines SCOQAZPERT
Heavy diagonal lines BURSODJOB
Light diagonal lines SWAELAS
@kennethreitz
kennethreitz / zshrc.sh
Created December 17, 2009 09:54
My zsh.rc configuration
setopt APPEND_HISTORY
unsetopt BG_NICE # do NOT nice bg commands
setopt CORRECT # command CORRECTION
setopt EXTENDED_HISTORY # puts timestamps in the history
setopt HIST_ALLOW_CLOBBER
setopt HIST_REDUCE_BLANKS
setopt INC_APPEND_HISTORY SHARE_HISTORY
setopt ALL_EXPORT
setopt MENUCOMPLETE
@kennethreitz
kennethreitz / mt-dv-s3.php
Created December 18, 2009 14:31
PHP script to backup all sites on a MediaTemple server to an S3 bucket
#!/usr/bin/env php
<?php
set_time_limit(0);
$nDays = 300; // How many days of backups to keep?
// MySQL variables
@kennethreitz
kennethreitz / reset.css
Created December 20, 2009 01:35
The best darn CSS Reset Around
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
@kennethreitz
kennethreitz / js_redirect_example.html
Created January 20, 2010 14:39
Proper XHTML header
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
</html>
@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 / facebook-selectall.js
Created March 7, 2010 16:10
Use this on a facebook select friends invite panel to select everyone.
javascript:elms=document.getElementById('friends').getElementsByTagName('li');for(var fid in elms){if(typeof elms[fid] === 'object'){fs.click(elms[fid]);}}