Skip to content

Instantly share code, notes, and snippets.

"""
This module encapsulates all knowledge about what environment your
code is running in (ie: development / production).
Note: make sure all calls to settings.get() are done at runtime, and not at import time.
usage:
import settings
def test():
import MySQLdb
from DBUtils import PooledDB
from MySQLdb import cursors
import settings
import logging
class DB(object):
"""simple database wrapper"""
mysqldbpool = None
import os
import httplib
import tornado.web
class ErrorHandler(tornado.web.RequestHandler):
"""Generates an error response with status_code for all requests."""
def __init__(self, application, request, status_code):
tornado.web.RequestHandler.__init__(self, application, request)
self.set_status(status_code)
Bitly tech talk 4/22/2010
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here!
# @jehiah
# in place file regex replacement
perl -pi -e 's/this/that/g' filename_pattern
# print the last column of a file ($NF stands for 'Number of Fields' or more commonly Last Field).