Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🌙

Kenneth Reitz kennethreitz

🌙
View GitHub Profile
@protocool
protocool / gist:948666
Created April 29, 2011 17:34
A gist that shows how I'm embedding gists into Propane. Probably crappy but at least it feels a bit meta...
if (displayExpandedGists) {
Campfire.GistExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
var messages = this.chat.transcript.messages;
for (var i = 0; i < messages.length; i++) {
this.detectGistURL(messages[i]);
}
},
@whs
whs / gladosalarm.py
Created April 18, 2011 13:44
GLaDOS@Home alarm clock
#!/usr/bin/python
# READ FIRST
# This software poll HP2LY every 5 minutes and will play
# any ffmpeg supported file 20 times after 95%.
# To quit press Ctrl+C in Terminal.
# Closing ffplay would just respawn it.
#
# Dependency:
# Ubuntu: sudo apt-get install ffmpeg
# Fedora: su -c 'yum install ffmpeg'
@schacon
schacon / .gitconfig
Created April 11, 2011 21:43
insteadOf example
[url "https://github.com/"]
insteadOf = "gh:"
@emre
emre / solarized.xml
Created April 8, 2011 11:33
pycharm color scheme based on solarized colors.
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="w3" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.2" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="DejaVu Sans Mono" />
<colors>
<option name="GUTTER_BACKGROUND" value="ffffff" />
<option name="WHITESPACES" value="808000" />
</colors>
<attributes>
r = Raphael("jobs-graph", 640, 120);
rect = r.rect(481, 30, 7, 90);
rect.attr({stroke: "none",
fill: "#446093"});
r = Raphael("jobs-graph", 640, 140);
text = r.text(490, 130, "Clinton");
text.attr({"font-family": "8px Courier",
fill: "#9c9c9b"});
@tmm1
tmm1 / 0-INSTALL.md
Created March 28, 2011 10:33
use cycript to load js enhancers into the propane transcript window

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

@wilsaj
wilsaj / flaskplotlib.py
Created March 9, 2011 13:09
Example of rendering a matplotlib image directly to Flask view
from flask import Flask, make_response
app = Flask(__name__)
@app.route("/simple.png")
def simple():
import datetime
import StringIO
import random
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
@unbracketed
unbracketed / dump_and_restore_DBs.sh
Created February 23, 2011 18:20
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
@ericflo
ericflo / twitter_to_convore.py
Created February 20, 2011 10:02
A small script which takes keywords to track on Twitter and streams them live into a Convore topic.
import base64
import httplib
import threading
import urllib
import tweepy
CONVORE_BOT_USERNAME = ''
CONVORE_BOT_PASSWORD = ''
CONVORE_TOPIC_ID = '7612'
@mal
mal / convore-bookmarklets.js
Created February 13, 2011 14:44
Convore Usability Bookmarklets
// For use with convore.com
/*
* Automatically increase the size of the input field as you type
*/
javascript:void !function(a,b){var c=function(c){var d=$(this),e=parseInt(d.css("height")),f=c.keyCode===b||c.keyCode===13?19:this.scrollHeight,g;if(g=e-f)$("#message-list").css("margin-bottom",61+f),d.css("height",f),(g<0||a.scrollY<a.scrollMaxY)&&a.scroll(0,a.scrollY-g)};$("#footer").attr("style","height: auto !important"),$("#id-message").bind("keypress keyup",c).css("height",19),$("#post-message").find("input.btn").bind("click keyup",function(a){c.call($("#id-message"),a)})}(window)
/*
* Add permalinks to posts (click the time ago text)
* Based on previous work by balpha, https://convore.com/users/balpha/