Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Tom Ehrlich tricoder42

I may be slow to respond.
View GitHub Profile
dfee /
Created Nov 25, 2017
Example of how subscriptions work with graphene
from collections import OrderedDict
import graphene
import rx
subject = rx.subjects.Subject()
class Author(graphene.ObjectType):
akorotkov / pg_graph
Created Jun 5, 2016
Draw psql output as iTerm2 v3 inline graph using matplotlib
View pg_graph
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Draw psql output as iTerm2 v3 inline graph using matplotlib
# Author: Alexander Korotkov <>
import sys
import re
import warnings
import matplotlib
chbrown /
Last active Dec 11, 2018
Upgrade PostgreSQL 9.4 to 9.5 on Mac OS X with Homebrew

First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):

cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Most importantly, note the -D /usr/local/var/postgres argument.

Second, shut down your current PostgreSQL.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
View double_comprehension.rst

When I need to remember the spelling for a list comprehension with more than one loop in Python, I find the following mnemonic helpful:

write the for statements in the same order you would write a nested loop

For example, suppose we have a nested list that we wish to flatten:

>>> nested_list = [[1, 2, '5!'], (3, 'sir!')]
epicserve /
Created Oct 30, 2013
Example of how to setup logging for a Django management command.
from import BaseCommand
from mymodule import main
import logging
class Command(BaseCommand):
help = 'Do foo'
def handle(self, *args, **options):