This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is based on an idea for building a table of contents on top of | |
React Markdown using a custom renderer. The original conversation is at | |
https://github.com/remarkjs/react-markdown/issues/48 | |
*/ | |
import React from "react"; | |
import ReactMarkdown from "react-markdown"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Q | |
def composite_in(columns, tuples): | |
return reduce(Q.__or__, [Q(**dict(zip(columns, t))) for t in tuples]) | |
# | |
# MyModel.objects.filter(composite_in( | |
# ('col1', 'col2'), | |
# [(1,2), (1,3), (2,3)])) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import imaplib | |
import sys | |
from boto.ec2 import cloudwatch | |
email, password, mailbox = sys.argv[1:] | |
imap = imaplib.IMAP4_SSL('imap.gmail.com') | |
imap.login(email, password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
DOMAIN="onlinebanking.tdbank.com" | |
COOKIEJAR="cookiejar-tdbank" | |
USERAGENT='Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2' | |
USERNAME="username" | |
read -sp "Password: " PASSWORD; echo | |
curl \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple py2exe compilation script for Windows. With a python file handler configured, | |
drag python script on to compile_wrapper.py. Runs py2exe for that file and cleans up | |
the temporary build/dist directories. | |
Setup options may need tweaking, and there is room for optimization | |
(see http://www.py2exe.org/index.cgi/OptimizingSize). | |
Requires: | |
py2exe, http://www.py2exe.org/index.cgi/FrontPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django LaTeX custom template tag for equations (using amsmath). | |
Creates a .png in the project media directory and returns an img tag that references it. | |
Usage: | |
{% latex %} | |
x=\frac{-b \pm \sqrt {b^2-4ac}}{2a} | |
{% endlatex %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cause a Fluid/Growl notification on Lala song change. | |
// I execute the following in the Firebug console with the Lala tab active. | |
// I would like to package it as a Jetpack, extension, or bundle it | |
// with an existing Lala extension. | |
// Yip implements the fluid/growl API on my computer. | |
function showLalaSongNotification(song) { | |
window.fluid.showGrowlNotification({ |