Skip to content

Instantly share code, notes, and snippets.


Peter Schmidt pzrq

View GitHub Profile
pzrq / NSW_LGA_list.txt
Last active Jan 15, 2020
List of all local government areas in NSW, without shire suffixes
View NSW_LGA_list.txt
Armidale Regional
Bathurst Regional
Bega Valley
pzrq / 0_reuse_code.js
Created Jun 22, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
pzrq /
Created Feb 3, 2016
Get All Subclasses of a Python Class and Get Concrete Django Models
def get_all_subclasses(python_class):
Helper function to get all the subclasses of a class.
:param python_class: Any Python class that implements __subclasses__()
subclasses = set()
check_these = [python_class]
pzrq /
Last active Dec 15, 2020
Better PyCharm mixin handling would make it far more useful for Django Class-Based Views, Managers, etc
# -*- coding: utf-8 -*-
# usage: python
Better PyCharm mixin handling would make it far more useful for
Django Class-Based Views, Managers, and in contexts others have identified
such as Werkzeug.
pzrq /
Created Mar 24, 2015
SymPy RuntimeError file
from sys import exit
import os
os.environ['SYMPY_USE_CACHE'] = 'no' # 'yes', 'no', 'debug'
from sympy import *
x, y, a, t, x_1, x_2, z, s = symbols('x y a t x_1 x_2 z s')
def test_issue_4737():
pzrq / bash and vi
Created Nov 18, 2014
PostgreSQL view logged queries OSX
View bash and vi
# For OSX Yosemite 10.10 `brew install postgres` [v9.3.5.1]
vi ${DATA_DIR}postgresql.conf
# Find log_statement in vi, then uncomment and set to 'all'
log_statement = 'all'
# Save / Exit vi
# Remember to set log_statement = 'none' when finished with debugging
pzrq /
Last active Aug 29, 2015
Django Lazy ModelChoiceField
In practice with four subclasses of LazyModelChoiceField
across a large project, we found existing __deepcopy__ based
alternatives such as
simply didn't work in all the circumstances we needed them to.
Tested against Python 2.7 and Python 3.4 with Django 1.6.8
Hopefully this works for you too :)