Skip to content

Instantly share code, notes, and snippets.

Amber Jain amberj

Block or report user

Report or block amberj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
defunkt /
Created Apr 18, 2010
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

jpinnix / gist:547977
Created Aug 24, 2010
Help nginx+passenger serve static index pages
View gist:547977
# Help nginx+passenger serve static index pages
# Site specific config
server {
listen 80;
index index.html;
access_log logs/appname.access.log;
error_log logs/appname.error.log;
hugs /
Created Feb 16, 2011
Example code for using the Selenium 2 Python bindings.
# To install the Python client library:
# pip install -U selenium
# Import the Selenium 2 namespace (aka "webdriver")
from selenium import webdriver
# iPhone
driver = webdriver.Remote(browser_name="iphone", command_executor='')
# Android
mikeyk /
Created Apr 8, 2011
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
pamelafox /
Created May 23, 2011
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
View exportjson.js
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
Last active Feb 12, 2018
Vagrant snippet to set VirtualBox guest CPU count to the number of host cores on Linux or OS X (broken 2018)
View Gemfile
gem 'concurrent'
kisom / gist:3522220
Created Aug 30, 2012
The Yeelong: A Review
View gist:3522220

I'm sure many other people have reviewed the Lemote Yeelong 8089 netbook. I picked up mine for a specific use-case and for the most part, it does a decent enough job satisfying that use case. However, unless you're at an RMS level of free software dogmatism, you would probably be better served by an x86-based netbook. I use it for hacking in C on the bus, especially when working on code that is meant to run on OpenBSD systems. It is quite slow, making it sometimes painful to do much more than gvim (which can take a second or longer to pull up on screen)

Mine is configured with 1G of RAM and a 160G hard drive (I haven't looked at changing out any of the stock hardware), and runs OpenBSD 5.0/mipsel. For the most part, the hardware runs very well. The major exception is the wireless card; when I tried using it on an open access point, it worked fine. It struggled, and typically failed, to connect to my WPA2'd access point. I had a USB ral0 wireless adaptor lying around, and I just use that when I need wireless

Paretzky / gist:4105017
Created Nov 18, 2012
Total the Number of Pages in All Pdf's in the Current Directory Recursively
View gist:4105017
find . -type f -iname "*pdf" | xargs -0 -d "\n" -n 1 pdfinfo 2> /dev/null | grep Pages | grep -Eo "[[:digit:]]+" | tr "\n" "+" | grep -Eo "[[:digit:]]+(\+[[:digit:]]+)+" | bc

Where people struggle learning Django

Over the last 3 years or so I've helped a bunch of companies, small and large, switch to Django. As part of that, I've done a lot of teaching Django (and Python) to people new to the platform (and language). I'd estimate I've trained something around 200-250 people so far. These aren't people new to programming — indeed, almost all of them are were currently employed as software developers — but they were new to Python, or to Django, or to web development, or all three.

In doing so, I've observed some patterns about what works and what doesn't. Many (most) of the failings have been my own pedagogical failings, but as I've honed my coursework and my skill I'm seeing, time and again, certain ways that Django makes itself difficult to certain groups of users.

This document is my attempt at organizing some notes around what ways different groups struggle. It's not particularly actionable — I'm not making any arguments about what Django should or shouldn't do (at least

You can’t perform that action at this time.