Skip to content

Instantly share code, notes, and snippets.

@sloria
sloria / bobp-python.md
Last active June 26, 2024 15:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@sandeepraju
sandeepraju / ttfb.sh
Created July 20, 2016 21:17
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@dcwatson
dcwatson / fix_migrations.py
Created December 4, 2017 16:37
A hacky script to rewrite old Django migrations to include current on_delete values
#!/usr/bin/env python
# IMPORTANT! USAGE INSTRUCTIONS!
# Drop this file in the top level of your project *after* you've added on_delete to all your ForeignKey and
# OneToOneFields. Running it will rewrite your migration files to add whatever the current on_delete for each field is
# to the past migrations. Make sure you have a clean working copy so you can easily review the differences before
# committing. Assuming there were no pending migrations, running "makemigrations" should yield no new changes.
import os