Skip to content

Instantly share code, notes, and snippets.

ansi_hash () {
# Colors a string based on a hash of its contents
# Usage: ansi_hash [-s style] [-o offset] text ..
style=0 # default is normal, 1 is bold, 4 is underline
offset=30 # default is normal, 90 is high intensity
OPTIND=0
while getopts s:o: a
do case "$a" in
s) style="$OPTARG";;
@akrito
akrito / gist:897054
Created March 31, 2011 19:30
All together
ps1_venv () {
if [ -n "$VIRTUAL_ENV" ]; then
printf ' (%s)' `basename $VIRTUAL_ENV`
fi
}
ps1_err () {
errcode=$?
local prompt=$1
printf "$(ansi_hash ${prompt})"
ansi_hash () {
# Colors a string based on a hash of its contents
# Usage: ansi_hash [-s style] [-o offset] text ..
style=0 # default is normal, 1 is bold, 4 is underline
offset=30 # default is normal, 90 is high intensity
OPTIND=0
while getopts s:o: a
do case "$a" in
s) style="$OPTARG";;
import re, sys
to_find = sys.argv[1]
def find_closing_paren(string, start):
current = start
num_open = 1
for c in string[start:]:
current += 1
@akrito
akrito / gist:1137394
Created August 10, 2011 16:53
Packing

Clothes

  • 2 pair underwear
  • 1 t-shirt
  • 1 oxford
  • 1 pair slacks
  • 1 pair sandals
  • 1 pair sunglasses
  • 1 rain jacket
[s3]
SigLevel = Optional TrustAll
Server = http://media.8bitb.us/pkg
alignment ml
border_inner_margin 0
border_outer_margin 0
double_buffer yes
gap_x 0
gap_y 0
imlib_cache_size 0
lua_draw_hook_pre all
lua_load ~/.conky.lua
minimum_size 17 766
require 'cairo'
function conky_all ()
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
cairo_select_font_face (cr, "Deja Vu Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
[Record(id=1307102, business_type_id=4, suggested_type='', pre_name='', name='Candle Connection', slug='candle-connection', nickname='', description='', meta_description=None, address1='1726 Churn Creek Rd', address2='', city='Redding', state='CA', zip_code='96002', mailing_address1=None, mailing_address2=None, mailing_city=None, mailing_state=None, mailing_zip_code=None, phone1='530-222-2390', phone2='', fax='530-222-2216', website='http://candlestogifts.com', email='', latitude=Decimal('40.581852'), longitude=Decimal('-122.354273'), notes='Owner: RACHEL CARRINO\nCONTACT_NAME: RACHEL CARRINO\nTITLE_DESC: OWNER', validated=True, additional_hours_info='', default_hours_id=None, point='0101000020E6100000C636A968AC965EC05C8E57207A4A4440', created=datetime.datetime(2011, 10, 19, 8, 14, 5, 219333, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=1140, name=None)), modified=datetime.datetime(2011, 10, 19, 8, 14, 5, 219379, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=1140, name=None)), extension2=None, extension1=Non
[Record(id=1307102, business_type_id=4, suggested_type='', pre_name='', name='Candle Connection', slug='candle-connection', nickname='', description='', meta_description=None, address1='1726 Churn Creek Rd', address2='', city='Redding', state='CA', zip_code='96002', mailing_address1=None, mailing_address2=None, mailing_city=None, mailing_state=None, mailing_zip_code=None, phone1='530-222-2390', phone2='', fax='530-222-2216', website='http://candlestogifts.com', email='', latitude=Decimal('40.581852'), longitude=Decimal('-122.354273'), notes='Owner: RACHEL CARRINO\nCONTACT_NAME: RACHEL CARRINO\nTITLE_DESC: OWNER', validated=True, additional_hours_info='', default_hours_id=None, point='0101000020E6100000C636A968AC965EC05C8E57207A4A4440', created=datetime.datetime(2011, 10, 19, 8, 14, 5, 219333, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=1140, name=None)), modified=datetime.datetime(2011, 10, 19, 8, 14, 5, 219379, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=1140, name=None)), extension2=None, extension1=Non