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
>>> import hashlib | |
>>> import hmac | |
>>> digest_maker = hmac.new('0x24FEEDFACEDEADBEEFCAFE', '', hashlib.sha1) | |
>>> digest_maker.update('http://farm5.static.flickr.com/4116/4857328881_fefb8e2134_z.jpg') | |
>>> digest_maker.hexdigest() | |
'2731d77b436b8a78f4cbe3624d8088fd5262f996' |
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 | |
from twisted.internet import reactor | |
from twisted.web import proxy, server | |
from twisted.web.resource import Resource | |
class ProxyResource(Resource): | |
def getChild(self, path, request): | |
request.received_headers['x-forwarded-host'] = request.received_headers['host'] |
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
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): |
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
import base64 | |
import httplib | |
import threading | |
import urllib | |
import tweepy | |
CONVORE_BOT_USERNAME = '' | |
CONVORE_BOT_PASSWORD = '' | |
CONVORE_TOPIC_ID = '7612' |
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
// | |
// NSURLConnection+Blocks.h | |
// SteveHolt | |
// | |
// Created by Eric Florenzano on 10/19/11. | |
// Copyright (c) 2011 Boilerplate Inc. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
def get_and_update_or_create(model, unique, update): | |
""" | |
Given a model, a dictionary of lookup arguments, and a dictionary of update | |
arguments, this convenience function gets an object and updates it in the | |
database if necessary. | |
Returns a tuple (object, int) where int is 0 if the object was not updated, | |
1 if the object was created, and 2 if the object was updated in the | |
database. |
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
import httplib | |
import base64 | |
import contextlib | |
import simplejson | |
import urllib | |
from django.conf import settings | |
def stripe_fetch(resource, method='GET', params=None, secret=settings.STRIPE_SECRET, prefix='/v1'): |
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.conf import settings | |
from django.template import Context, loader | |
from django.core.mail import send_mail | |
def send_template_mail(slug, context, recipient_list, from_email=settings.DEFAULT_FROM_EMAIL): | |
if isinstance(recipient_list, basestring): | |
recipient_list = [recipient_list] | |
if not isinstance(context, Context): | |
context = Context(context) | |
subject_tmpl = loader.get_template('mail/%s/subject.txt' % (slug,)) |
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
import os | |
import subprocess | |
from sqlalchemy import Column, String, Integer, Float, MetaData, Table | |
from sqlalchemy import create_engine | |
from alchimia import TWISTED_STRATEGY | |
from flask import json |
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
/** @jsx React.DOM */ | |
var ReactDropzone = React.createClass({ | |
componentDidMount: function() { | |
var options = {}; | |
for (var opt in Dropzone.prototype.defaultOptions) { | |
var prop = this.props[opt]; | |
if (prop) { | |
options[opt] = prop; | |
continue; |