Skip to content

Instantly share code, notes, and snippets.

@jacobian
jacobian / userChrome.css
Created October 14, 2013 20:01
Remove Firefox bookmark toolbar icons
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#PlacesToolbarItems .bookmark-item .toolbarbutton-icon {
display:none !important
}
@jacobian
jacobian / why open source django.md
Created July 24, 2013 17:49
Our arguments for open sourcing Django
  1. The code will get better. Linus' Law: "given enough eyeballs, all bugs are shallow": we'll be able to get community contributions and bug reports, and thus the code will grow better faster than we can grow it ourselves. Also, Joy's Law - "No matter who you are, most of the smartest people work for someone else": we'll get better code from people who don't work for us than from people who do.

  2. We'll write better code. Wall's 3rd great virtual of a programmer, Hubris: we'll write better code people we don't want other people to say bad things about us. We'll do better with the world watching than with just us.

  3. Increased ability to hire. We're a 19k circ newspaper in a town most people have never heard of. Open source will help put us on the map, make us a place people actually might be interested in working.

  4. When we do hire, we'll be able to hire pe

import requests
requests.post(
'https://api.mailgun.net/v2/%s/messages' % MAILGUN_DOMAIN
auth = ("api", MAILGUN_API_KEY,
data = {
"from": from_address,
"to": to_address
"subject": subject_line
"text": body_plain,
The location security mechanism is that once a mobile is registered to a
network, it is issued with a temporary mobile subscriber identification
(TMSI), which acts as its address as it roams through the network. The attack on
this mechanism uses a device called an IMSI-catcher , which is sold to police
forces [488]. The IMSI-catcher, which is typically operated in a police car tailing
a suspect, pretends to be a GSM base station. Being closer than the genuine
article, its signal is stronger and the mobile tries to register with it. The IMSI
catcher claims not to understand the TMSI, so the handset helpfully sends it
the cleartext IMSI. This feature is needed if mobiles are to be able to roam
from one network to another without the call being dropped, and to recover
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
This file contains a list of everyone who is authorized to release Django.
When we issue an official release of Django, it'll come with a checksum file
for the release. That file will be signed by one of the authorized users
listed below, and will contain instructions on how to verify that the release
hasn't been tampered with.
This releasers document is itself signed by a master key with key ID
digraph CreateView {
// Basic graph, node, and edge styling.
splines="true";
ranksep=0.4;
node [shape="box", style="rounded" fontsize="9", height="0.3", fontname="Open Sans Light"];
edge [headport="n"];
// Graph title - \G means "title of the graph"; the \ns are the only way
// I can find to visuall separate the title from the rest of the graph.
from django.contrib import admin
from .models import Author, Book
class BookInline(admin.TabularInline):
model = Book
readonly_fields = ['slug']
class AuthorAdmin(admin.ModelAdmin):
inlines = [BookInline]
import sys
import collections
import gridfs
import io
import psycopg2
import pymongo
import random
import time
# For fairness use the same chunk size - 512k.
@jacobian
jacobian / gridfs-vs-lobjects.py
Last active December 29, 2021 11:21
Benchmarking MongoDB's GridFS vs PostgreSQL's LargeObjects.
import io
import pymongo
import psycopg2
import gridfs
import timeit
# For fairness use the same chunk size - 512k.
CHUNK_SIZE = 1024 * 512
def bench_mongo(fs, size):

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