Skip to content

Instantly share code, notes, and snippets.

View zbyte64's full-sized avatar

Jason Kraus zbyte64

View GitHub Profile
import io
numbers = {
(' _ ', '| |', '|_|'): 0,
(' ', ' |', ' |'): 1,
(' _ ', ' _|', '|_ '): 2,
(' _ ', ' _|', ' _|'): 3,
(' ', '|_|', ' |'): 4,
(' _ ', '|_ ', ' _|'): 5,
@zbyte64
zbyte64 / gist:6453850
Created September 5, 2013 18:07
Cleans up test accounts
from gevent import monkey; monkey.patch_all()
from gevent.pool import Pool
import stripe
to_delete = list()
pool = Pool(10)
def check_customer(customer):
if customer['subscription'] or customer['default_card']:
return False
@zbyte64
zbyte64 / fix_s3_crossorigin.py
Last active December 14, 2015 23:09
Fix cross origins on S3 with boto
from boto.s3.cors import CORSConfiguration
from boto.s3.connection import S3Connection
conn = S3Connection('<aws access key>', '<aws secret key>')
bucket = conn.create_bucket('mybucket')
config = CORSConfiguration()
config.add_rule(allowed_method=['GET'], allowed_origin=['*'], allowed_header=['Content-*', 'Host'], max_age_seconds=3000)
bucket.set_cors(config)
@zbyte64
zbyte64 / forms.py
Created February 2, 2013 22:15
Example of using Django forms to load CSVs
from simplecart.discounts.models import *
from simplecart.orders.models import SKU
from decimal import Decimal
import datetime
from django import forms
class r(str):
pass
@zbyte64
zbyte64 / debug_middleware.py
Created August 3, 2012 23:36
Debug Middleware
from django.views.debug import technical_500_response
import sys
import webbrowser
import tempfile
class BrowserExceptionMiddleware(object):
def process_exception(self, request, exception):
response = technical_500_response(request, *sys.exc_info())
path = tempfile.mkstemp(suffix='html')[1]
open(path, 'w').write(response.content)