Skip to content

Instantly share code, notes, and snippets.

Jehiah Czebotar jehiah

Block or report user

Report or block jehiah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:376179
Bitly tech talk 4/22/2010
On 4/22 we held a 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).
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)
import MySQLdb
from DBUtils import PooledDB
from MySQLdb import cursors
import settings
import logging
class DB(object):
"""simple database wrapper"""
mysqldbpool = None
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.
import settings
def test():
import pylibmc
import Queue
import logging
import functools
This is a transparent pool library that wraps a pylibmc client
from MemcachePool import mc
jehiah /
Created Dec 17, 2010
python script to archive your tweets
#!/usr/bin/env python
""" written by Jehiah Czebotar 2010 <>
this uses the great 'python twitter tools' library by Mike Verdone
$ pip install twitter
jehiah /
Created Dec 17, 2010
parse Adium XML log files into a csv
this script parses Adium XML log files into a csv
use -u to specify your usernames to look for
use -d to specify the path (with wildcards) to adium xml logs (be careful to check all installed adium versions)
you can then read data with
import csv
jehiah /
Created Feb 18, 2011
script to download the latest chromium build nightly
## this is a quick and dirty script to automagically install the latest chromium build on OSX 10.5
## you can set this up as a nightly cron job, or run manually from the command line
# save script to your home directory aka /Users/$USER/
# open up a command prompt (aka /Applications/Utilities/Terminal)
# run manually from the command line whenever you want the most recent chromium build
# $ sh
# start it as a nightly task (runs at 1am or edit the plist below)
View bitly.rb
# API implementation - thanks to Richard Johansso
require 'httparty'
class Api::Bitly
include HTTParty
base_uri ''
format :json
# Usage: Bitly.shorten("")
def self.shorten(url)
jehiah /
Created Mar 4, 2011
a simple way to parse shell script arguments
# a simple way to parse shell script arguments
# please edit and use to your hearts content
You can’t perform that action at this time.