Skip to content

Instantly share code, notes, and snippets.

@streeter
streeter / pyupgrades.py
Created March 3, 2013 04:50
List all upgrades for python packages available in the current environment.
#!/usr/bin/env python
import xmlrpclib
import pip
import argparse
from pkg_resources import parse_version
def version_number_compare(version1, version2):
return cmp(parse_version(version1), parse_version(version2))
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
db.execute('UPDATE auth_user SET password=CONCAT("bcrypt", SUBSTR(password, 3)) WHERE password LIKE "bc$%%"')
from threading import local
_blah = local()
class StopThatShit(Exception):
pass
def patch():
from django.db.backends import util
from django import template
@streeter
streeter / ECDesignatedInitializer.m
Created July 19, 2013 22:14
Bless and designate certain initializers as the proper initializer to use.
// Bless a certain initializer at compile time
//
// Sample usage:
// - (instancetype)initWithObject:(id)object
// - (instancetype)init ECDesignatedInitializer(initWithObject:);
//
#define ECDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead.")))
@streeter
streeter / swizzle.m
Created July 27, 2013 00:58
Swizzle methods in Objective-C
#import <objc/runtime.h>
static void SwizzleClassMethod(Class klass, SEL original, SEL new)
{
Method origMethod = class_getClassMethod(klass, original);
Method newMethod = class_getClassMethod(klass, new);
if (class_addMethod(klass, original, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(klass, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
import sys
import os
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
from distutils.util import convert_path
def _find_packages(where='.', exclude=()):

Watchers per repo, for each of my repos. Note: The GitHub API only lets me get the first few repos, so the list is incomplete.

Edit on Tributary.io

@streeter
streeter / hipchat.sh
Last active December 21, 2015 06:09
Encrypt HipChat API key in .travis.yml files
#!/bin/bash
travis encrypt ${HIPCHAT_API_KEY}@${HIPCHAT_ROOM} --add notifications.hipchat.rooms
@streeter
streeter / heaven.md
Created September 24, 2013 16:03 — forked from atmos/heaven.md

@holman got a request about our deployment system, heaven

I know it's not a high priority, but has there been any activity on open-sourcing the core Heaven gem?

There is. I've been working on extracting the non-GitHub specific parts into two gems. This first is a CLI portion called hades. The second is an HTTP API portion called heaven.

When you open source something previously used as in internal tool like Heaven, Hubot, Boxen, etc., how do you manage and hook in the parts that need to stay internal?

Normally I focus around four questions:

static BOOL PSPDFIsDevelopmentBuild(void) {
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
static BOOL isDevelopment = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// There is no provisioning profile in AppStore Apps.
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
if (data) {