Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am andrewwatts on github.
  • I am andrewwatts (https://keybase.io/andrewwatts) on keybase.
  • I have a public key ASBM9lcs3y7LH3bb6i1xGYf4zHllnMbmvvd7SdymBZ5QLgo

To claim this, I am signing this object:

@andrewwatts
andrewwatts / README.md
Created January 25, 2018 17:25
BuzzFeed's README Template

name of the service

An explanation of what the service is doing and why. Any high level business logic should be mentioned here to give the reader an understanding of why the service exists in the first place.

List important endpoints/URLs and explain what they are responsible for.

Point of contact and Slack channel

@andrewwatts
andrewwatts / long-line.tsv
Created January 31, 2015 06:24
long lines
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
97.104.22.80 carpricing.consumerreports.org "10.3.158.46:50056, 10.3.158.45:50056, 10.3.158.47:50056" 1422558846.854 46.379 "GET /api/v1/prices.json?callback=jQuery111003678974979557097_1422558799853&d=eyJjaHJvbWVfdHJpbV9pZHMiOlszMTY4NTYsMzE2ODY0LDMxNjg3MSwzMTY4OTEsMzE2ODYyLDMxNjg2OSwzMTY4NzksMzE2ODgxLDMxNjg5MiwzMTY4OTcsMzE2OTAzLDMxNjkwNywzMTY4NzcsMzE2ODg2LDMxNjg5OSwzMTY5MDIsMzE2OTA2LDMxNjg1NSwzMTY4NTgsMzE2ODY1LDMxNjg2NywzMTY4NzUsMzE2ODg4LDMxNjg5NCwzMTY4OTUsMzE2OTA4LDMxNjkxMCwzMTY4NTcsMzE2ODcyLDMxNjg3NiwzMTY4NzgsMzE2ODgyLDMxNjg4NSwzMTY4OTAsMzE2ODk4LDMxNjkwMCwzMTY5MDQsMzE2OTExLDMxNjkxMywzMTY4NzMsMzE2ODg3LDMxNjkwMSwzMTY5MDUsMzE2ODYwLDMxNjg2OCwzMTY4NzQsMzE2ODgwLDMxNjg4NCwzMTY4OTMsMzE2OTEyLDMxNjg1OSwzMTY4NjEsMzE2ODYzLDMxNjg2NiwzMTY4NzAsMzE2ODgzLDMxNjg4OSwzMTY4OTYsMzE2OTA5LDMzODEwMCwzMzgxMDEsMzM4MTA1LDMzODEwOSwzMzgxMTAsMzM4MTExLDMzODExNiwzMzgxMjYsMzM4NDY4LDMzODQ3MCwzMzgwODIsMzM4MDg0LDMzODA5NywzMzgwOTksMzM4MTA2LDMzODExMywzMzgxMjIsMzM4MTMwLDMzODEzNywzMzgxMDIsMzM4MTEyLDMzODExOSwzMzgxMjEsMzM4NDY0LDMzODQ2NiwzMzg0NjUsMz
@andrewwatts
andrewwatts / request_time.py
Created March 10, 2012 19:33
urllib2 vs urllib3 vs requests
#!/usr/bin/env python2.7
import time
_URL = 'http://localhost/tmp/derp.html'
_NUMBER = 1000
def test_urllib2():
import urllib2
@andrewwatts
andrewwatts / underscore_dict.py
Created October 24, 2011 04:18
a dict that forces keys, which are likely camelCase, into under score keys.
class underscore_dict(dict):
"""
a dict like object that forces key to be pythonic and follow the underscore
convention.
eg::
>>> d = underscore_dict(dict(myKey='my_value'))
>>> print d
'my_key': 'my_value'}
@andrewwatts
andrewwatts / disable_lion_features.sh
Created July 31, 2011 03:16
Mac OS X Lion Installation
#!/bin/bash -x
# disable dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES
# disable Lion window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO
# disable Lion key repeat behavior
defaults write -g ApplePressAndHoldEnabled -bool false
@andrewwatts
andrewwatts / decimal.py
Created July 12, 2011 19:12
python's decimal.py
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module is currently Py2.3 compatible and should be kept that way
@andrewwatts
andrewwatts / git-completion-setup.bash
Created April 6, 2011 18:58
script to add git-completion.bash to a bash shell
#!bash -x
mkdir -p $HOME/bin
pushd $HOME/bin
curl -fsSLO https://github.com/andrewwatts/dotfiles/raw/master/bin/git-completion.bash
popd
cat >> $HOME/.bashrc << EOF
# BEGIN git install from https://gist.github.com/gists/1536b5ada40498fbb768
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@andrewwatts
andrewwatts / hybserv
Created December 29, 2010 22:39
/etc/init.d/hybserv and postinst from hybserv deb package
#! /bin/sh
# hybserv Start/stop Hybserv 2 IRC Services
# Version: hybserv 1.8.0 17-Mar-2003 joshk@triplehelix.org
# Version: hybserv 1.9.2 05-Sep-2006 ag@roxor.cx
### BEGIN INIT INFO
# Provides: hybserv
# Required-Start: $syslog ircd-hybrid
# Required-Stop: $syslog ircd-hybrid