Skip to content

Instantly share code, notes, and snippets.

View jirwin's full-sized avatar

Justin Gallardo jirwin

  • Oakland, California
View GitHub Profile
use URI::Find::Rule;
use LWP::Simple;
use HTML::TokeParser;
use Time::localtime;
use Hackabot::Client;
my $hbc = Hackabot::Client->new;
sub bitly_link {
syntax on
filetype on
color evening
set nu
set ai
set tabstop=2
set shiftwidth=2
set expandtab
"------------ editor behaviour block ------------------
set ruler " show curser position at all times
search_method = request.params.get('search_method', None)
if not search_method:
search_method = 'keyword'
alpha_to_numeric = { 'A': 2, 'B': 3, 'C': 4, 'D': 5,
'E': 6, 'F': 7, 'G': 8, 'H': 9,
'I': 0, 'J': 1, 'K': 2, 'L': 3,
'M': 4, 'N': 5, 'O': 6, 'P': 7,
'Q': 8, 'R': 9, 'S': 0, 'T': 1,
'U': 2, 'V': 3, 'W': 4, 'X': 5,
'Y': 6, 'Z': 7}
def validate(self, tracking_number):
"Return True if this is a valid UPS tracking number."
tracking_num = tracking_number[2:-1]
odd_total = 0
even_total = 0
for ii, digit in enumerate(tracking_num.upper()):
try:
value = int(digit)
except ValueError:
nums = "1234567890"
even = []
odd_total = reduce(lambda x, y: x+y, filter(None, (int(x) if (ii+1) % 2 else even.append(int(x)) for ii, x in enumerate(nums))))
even_total = reduce(lambda x, y: x+y, even)
for ii in range(MAX):
try:
some_action()
except socket.error, e:
pass
raise e
def get_nearby_zipcodes(zipc, radius=15):
q = Quadtree([65, 15, 180, 75])
with open('/home/jirwin/zips.txt') as zips:
for line in zips:
line = line.rstrip().replace('"', '')
zipcode, city, state, longitude, latitude = line.split(',')[1:-2]
lat = float(latitude)
lon = float(longitude)
zipcode = int(zipcode)
q.add(zipcode, [lon,
Akon 2005 - 'Im so Lonely'
Akon 2006 - 'I Wanna Fuck You'
Akon 2009 - 'Dirty Bitch'
Akon 2010 - 'I Just Had Sex' [.♥.]
Akon 2011 - 'I Just got Aids'
test = {}
class Cheese(object):
id = 0
def __init__(self, id):
self.id = id
class Justin(object):
cheese = None