Skip to content

Instantly share code, notes, and snippets.

@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
/**
* a very crude implmentation of python's format() for javascript,
* supporting simple replacement fields, eg::
*
* >>> format('{0} is {1}', 'javascript', 'cool')
* "javascript is cool"
*
* works for my purposes, but no where close to implementing full
* capabilities as described at::
* http://docs.python.org/library/string.html#formatstrings
@andrewwatts
andrewwatts / after.bashrc
Created May 2, 2010 18:53
Before and after .bashrc files for installing python on dreamhost
# ~/.bashrc: executed by bash(1) for non-login shells.
export EDITOR=vi
# terminal colors
LS_COLORS='no=00:fi=00:di=01;36:ln=01;93:pi=40;33:so=01;35:do=01;35:bd=40;33;01:
cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31
:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:
*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=0
1;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.t
@andrewwatts
andrewwatts / config.log
Created May 13, 2010 17:33
config.log showing glib errors from `brew install irssri`
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by irssi configure 0.8.14, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/irssi/0.8.14 --disable-debug --disable-dependency-tracking --with-modules --enable-ssl --enable-ipv6 --with-perl=yes
## --------- ##
## Platform. ##
@andrewwatts
andrewwatts / middleware.py
Created October 22, 2010 16:00
Django middleware that sets a tracking id (fetched from a ticket server) as a cookie in the http response.
'''
Django middleware that sets a tracking id (fetched from a ticket server) as a
cookie in the http response.
This assumes you have setup a couple k/v stores as ticket servers and that
you know the key. For demonstration purposes only, here is how one might do it
with redis:
# start a redis server on default port (6379)
$ redis-server /usr/local/etc/redis.conf &> /dev/null &
@andrewwatts
andrewwatts / fabfile.py
Created December 3, 2010 21:05
simple fabfile to testing goosemo's multiprocessing fabric branch
from fabric.api import *
env.roledefs['servers'] = [
'ec2-184-72-2-243.us-west-1.compute.amazonaws.com',
'ec2-204-236-153-163.us-west-1.compute.amazonaws.com',
]
@roles('servers')
def poke():
local("whoami")
@andrewwatts
andrewwatts / ec2_hosts.py
Created December 21, 2010 06:46
print an /etc/hosts file to stdout with ec2 instances
#! /usr/bin/env python
# ##########
#
# Usage:
# ec2_hosts.py
#
# Then copy results to /etc/hosts
#
# ##########
@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
"""
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 / 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