Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍
I may be slow to respond.

Kenneth Reitz kennethreitz

🐍
I may be slow to respond.
View GitHub Profile

"Other developers are just like us - weird"

"If you ever need to deploy Django, you're good. If you know Capistrano and Unicorn they've got rip-offs of all that stuff."

"I think we should all admit we're horrible coders and move on" "We're all drug addicts - we're fighting methods..."

"It's easy to learn to play the guitar and be able to play Bob Dylan and Weezer and never get better."

"This is basically a talk that was given 30 years ago. We just have to keep giving it every few years because young guys come along and forget it."

import time
class Retry(object):
default_exceptions = (Exception)
def __init__(self, tries, exceptions=None, delay=0):
"""
Decorator for retrying function if exception occurs
tries -- num tries
exceptions -- exceptions to catch
require "open-uri"
require "rubygems"
require "json"
USERNAME = "henrik"
query = ARGV.first.downcase
gists = JSON.parse(open("http://gist.github.com/api/v1/json/gists/#{USERNAME}").read)['gists']
#ruby
[1,2,3,4].select{ |x| x.even? }
#python
[x for x in [1,2,3,4] if not x%2]
#or, more norvingly
filter(lambda x: not x%2, [1,2,3,4])
#clojure
(filter #(even? % ) [1 2 3 4])
@kennethreitz
kennethreitz / gh-get.sh
Created February 15, 2011 02:25 — forked from defunkt/gh-get.sh
# $ gh-get https://github.com/defunkt/facebox/blob/master/src/facebox.js
function gh-get () {
curl -#O $(echo $1 | sed 's|blob|raw|')
}
import base64
import httplib
import threading
import urllib
import tweepy
CONVORE_BOT_USERNAME = ''
CONVORE_BOT_PASSWORD = ''
CONVOTE_TOPIC_ID = '7612'
.__ ___. .__ __ .__ .___
| |__ _____ ______ ______ ___.__. \_ |__ |__|_______ _/ |_ | |__ __| _/_____ ___.__.
| | \ \__ \ \____ \ \____ \< | | | __ \ | |\_ __ \\ __\| | \ / __ | \__ \ < | |
| Y \ / __ \_| |_> >| |_> >\___ | | \_\ \| | | | \/ | | | Y \/ /_/ | / __ \_\___ |
|___| /(____ /| __/ | __/ / ____| |___ /|__| |__| |__| |___| /\____ | (____ // ____|
\/ \/ |__| |__| \/ \/ \/ \/ \/ \/
_____ ___ ___ ___ ___ ___
/ /::\ / /\ / /\ /__/\ /__/\ /__/| ___
/ /:/\:\ / /:/_ / /:/_ \ \:\ \ \:\ | |:| / /\
/ /:/ \:\ / /:/ /\ / /:/ /\ \ \:\ \ \:\ | |:| / /:/

install cycript

brew install https://gist.github.com/raw/890258/cycript.rb

download the cycript hack

wget https://gist.github.com/raw/890258/hack_propane.js
chmod +x hack_propane.js

inject hack into running propane process

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>
Adaptive Layout Idea
</title>
<link rel="stylesheet" href="basic_defaults.css" />
<noscript>
<link rel="stylesheet" href="fallback.css" />
@kennethreitz
kennethreitz / dump_and_restore_DBs.sh
Created April 23, 2011 21:23 — forked from unbracketed/dump_and_restore_DBs.sh
Recipes for dumping and restoring different databases, using different compression formats
#Dump
mysqldump db | gzip -c > db.sql.gz
pg_dump db | gzip -c > db.sql.gz
#use gzip --fast
#Restore
gunzip < db.sql.gz | mysql db
bunzip2 < db.sql.bz2 | mysql db