Skip to content

Instantly share code, notes, and snippets.



  • Kraken Technologies
  • Brooklyn, NY
View GitHub Profile
carljm /
Created Apr 13, 2016
Django settings from env.
"""Utility for pulling settings from the environment."""
import os
from urllib.parse import urlparse
class EnvParser:
"""Utility for getting settings from the OS environ.
Instantiate with the name of an env var to get the current mode from (that
env var should be set to one of VALID_MODES, or not set), then call the
bearfrieze /
Last active May 20, 2021
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

KeyMaster- / polarWarp.glsl
Created Apr 4, 2015
Cartesian to Polar coordinates warp shader, for
View polarWarp.glsl
//To be used on
//Uses the image at iChannel0 and warps it into polar coordinates
void mainImage( out vec4 fragColor, in vec2 fragCoord )
vec2 relativePos = fragCoord.xy - (iResolution.xy / 2.0);
vec2 polar;
polar.y = sqrt(relativePos.x * relativePos.x + relativePos.y * relativePos.y);
polar.y /= iResolution.x / 2.0;
polar.y = 1.0 - polar.y;


To start godoc at log in time (so it always there on port 6060 when you need it):

  1. copy smarticus.godoc.plist to in ~/Library/LaunchAgents
  2. launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
  3. visit http://localhost:6060
import numpy as np
import pandas as pd
import datetime
import urllib
from bokeh.plotting import *
from bokeh.models import HoverTool
from collections import OrderedDict
## Read in our data. We've aggregated it by date already, so we don't need to worry about paging
equaliser / gist:5194456
Created Mar 19, 2013
Arduino MCP4922 SPI DAC demo code
View gist:5194456
MCP4922 test
Steve Woodward, 2010
most code borrowed from
+5v > 4922 pin 1
gregsadetsky /
Last active May 28, 2021
See: -- I was looking for a way to run Selenium tests for a Django app on a staging server hosted on Heroku using a PostgreSQL database. The DjangoTestSuiteRunner creates and destroys the whole database before/after testing, which would not work on Heroku where databases are added via other means (her…
import dj_database_url
'default': dj_database_url.config(env='TEST_DATABASE_URL')
# replace path below to point to HerokuTestSuiteRunner class
datagrok / gist:2199506
Last active Sep 8, 2021
Virtualenv's `bin/activate` is Doing It Wrong
View gist:2199506
kolber / pandoras_vox.mdown
Created Mar 20, 2012
pandora’s vox: on community in cyberspace
View pandoras_vox.mdown

pandora’s vox: on community in cyberspace

by humdog (1994)

when i went into cyberspace i went into it thinking that it was a place like any other place and that it would be a human interaction like any other human interaction. i was wrong when i thought that. it was a terrible mistake.

the very first understanding that i had that it was not a place like any place and that the interaction would be different was when people began to talk to me as though i were a man. when they wrote about me in the third person, they would say “he.” it interested me to have people think i was “he” instead of “she” and so at first i did not say anything. i grinned and let them think i was “he.” this went on for a little while and it was fun but after a while i was uncomfortable. finally i said unto them that i, humdog, was a woman and not a man. this surprised them. at that moment i realized that the dissolution of gender-category was something that was happening everywhere, and perhaps it was only just very obvious on the ne