Skip to content

Instantly share code, notes, and snippets.

@eykd
eykd / pycache.py
Created October 26, 2010 15:06
A simple script for caching packages on S3 and building simple HTML indices.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pycache -- cache a python package from PyPI on S3.
A simple script to collect a cache of packages locally and sync them up to an S3 bucket, using directories as namespaces so that different projects can have different dependencies.
This is just about the simplest thing that could possibly work.
"""
import warnings
warnings.filterwarnings('ignore')
@klipstein
klipstein / b64field.py
Created November 22, 2010 12:25
Base64 file handling for django-tastypie
import base64
import os
from tastypie.fields import FileField
from django.core.files.uploadedfile import SimpleUploadedFile
class Base64FileField(FileField):
"""
A django-tastypie field for handling file-uploads through raw post data.
It uses base64 for en-/decoding the contents of the file.
Usage:
@ericflo
ericflo / backup_db.py
Created January 5, 2011 18:25
A management command to put on a cron to keep daily backups of a postgres database (with a 1-week window)
import datetime
import subprocess
from django.conf import settings
from django.core.management.base import BaseCommand
from boto.s3.connection import S3Connection
from boto.s3.key import Key
class Command(BaseCommand):
@toastdriven
toastdriven / mytwilight.tmTheme
Created July 29, 2011 16:04 — forked from epicserve/sublime_text_2_notes.md
My Sublime Text 2 Setup
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Daniel Lindsley</string>
<key>name</key>
<string>My Twilight</string>
<key>settings</key>
<array>
@benjaminws
benjaminws / gist:1309375
Created October 24, 2011 15:59
For Gary
======================================================================
ERROR: test_coolstorybro.TestCoolStoryBro.test_coolstorybro
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/bsmith/Dev/python/coolstorybro/local/lib/python2.7/site-packages/nose/case.py", line 133, in run
self.runTest(result)
File "/home/bsmith/Dev/python/coolstorybro/local/lib/python2.7/site-packages/nose/case.py", line 151, in runTest
test(result)
File "/usr/lib/python2.7/unittest/case.py", line 385, in __call__
return self.run(*args, **kwds)
# original: https://github.com/simonw/mytweets
# modified by Brian Rosner
# This script does not fetch all tweets. It is limited by what Twitter's API
# returns. Somewhere around 3200 tweets.
#
# Tweak the API keys around line 40 for your Twitter app
import json
import httplib
@dgouldin
dgouldin / gist:1320358
Created October 27, 2011 18:17
Django model relation graph
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import loading
from django.db.models.fields.related import RelatedField
INDENT = ' '
for app_name in settings.INSTALLED_APPS:
print app_name
app_label = app_name.split(".")[-1]
try:
@epicserve
epicserve / send_email.py
Created January 3, 2012 21:07
A little script to test sending email
#!/usr/bin/env python
from argparse import ArgumentParser
import smtplib
from email.mime.text import MIMEText
"""
Example Usage:
./send_email.py \
@pamelafox
pamelafox / util.js
Created April 13, 2012 17:44
JavaScript Utility Libraries (Scroll down!)
var ED = ED || {};
// Utility functions
ED.util = (function() {
// Data structure functions
function each(object, callback) {
if (object === null) return;

With apologies to Gruber... http://www.flickr.com/photos/nasahqphoto/7088014787/

"Space shuttle Discovery, mounted atop a NASA 747 Shuttle Carrier Aircraft (SCA), flies over the Washington skyline as seen from a NASA T-38 aircraft, Tuesday, April 17, 2012. "

In celebration of abandoning our space program, we paraded our ailing 30-year old technology over the heads of warmongering lawmakers today.

"Discovery, the first orbiter retired from NASA’s shuttle fleet, ..."

A shuttle-sized walker was too expensive, especially after we bailed out all those banks.