Skip to content

Instantly share code, notes, and snippets.

def part1():
s = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyreso
@jiaaro
jiaaro / find_dry_violations.py
Created April 15, 2011 18:34
Finds the largest duplicate text block in a file
#!/usr/bin/env python
import sys
orig_txt = open(sys.argv[-1], "r").readlines()
txt = [line.strip() for line in orig_txt]
match_len = 0
longest_match = [
'occurence1 start', 'occurance1 end',
@jiaaro
jiaaro / gist:1098083
Created July 21, 2011 20:09 — forked from jacobian/gist:336445
Installing GeoDjango deps on Ubuntu 9.10
### Install some packages. Ignore the errors.
aptitude install binutils libgdal1-1.5.0 postgresql-8.3-postgis postgresql-server-dev-8.3 python-psycopg2 python-setuptools
### Make connecting to postgres easier
echo "local all all trust" > /etc/postgresql/8.3/main/pg_hba.conf
invoke-rc.d postgresql-8.3 reload
### Become the Postgres user to create a spatial template database:
@jiaaro
jiaaro / check_ticketmaster.py
Created September 28, 2011 21:43
Check for radiohead tickets :(
#!/usr/bin/env python
"""
I really *REALLY* wanted to see Radiohead at Roseland ballroom, but so
did everybody else and the tickets sold out in about 10 minutes. I didn't
get one :(
They haven't played in NYC in 3 years!
Here is a script that checks when tickets become available for an event.
NEVER AGAIN!
@jiaaro
jiaaro / gist:1855582
Created February 17, 2012 21:30
Dotsies
"""notes:
Vowels all touch the top center and bottom except "O" which touches outlines
the center.
This is to give visual cues about the top and bottom of the line.
Consonants designed to be small and visually oriented around the center dot
for the most common letters, and as frequency of usage goes down, the dot
patterns that are oriented around the center dot are used.
@jiaaro
jiaaro / ..setup_brubeck_with_gunicorn_for_heroku.sh
Created May 11, 2012 02:21
Brubeck on heroku with gunicorn
#!/bin/bash
#
# Note: This is the only file you *really* need. I've copied the contents
# of the important files that are part of our git repo for easier reading
# below :)
#
# I've prefixed this file with two dots to make it rise to the top of the
# gist. you can ignore those
#
@jiaaro
jiaaro / defer
Created July 27, 2012 15:58
Automate life
#!/usr/bin/env python
"""
sleep the specified amount of time
accepts seconds, minutes, hours, days, and years like so:
10 seconds: 10s
15 minutes: 15m
4 hours: 4h
90 days: 90d
@jiaaro
jiaaro / rb_request_signing.php
Created August 14, 2012 20:21
Rootbuzz Request signing
<?php
function apisig($salt, $dataDict) {
# sort the data by key
ksort($dataDict);
# url encode the data
$dataStr = http_build_query($dataDict);
# %20 is more robust than + for spaces
@jiaaro
jiaaro / checklist.md
Created August 24, 2012 15:52
Rootbuzz theming guide

Rootbuzz Theming Guide

  • Step 1: See the getting started video

  • Step 2: Do research on the theme you're matching

  • Look for elements that are consistent across many pages on the primary site

  • Look for a blog. Possible source of theme elements.

    What you're looking for is thematic elements such as:

    • what color the links should be
  • what should the sidebar look like

@jiaaro
jiaaro / magicsuper.py
Last active December 10, 2015 18:49
Magical, automatic super class caller in python (a terrible idea)
import inspect
def magicsuper(*args, **kwargs):
frame = inspect.currentframe().f_back
first_arg_name = frame.f_code.co_varnames[0]
self = frame.f_locals[first_arg_name]
super_klass = super(self.__class__, self)
return getattr(super_klass, frame.f_code.co_name)(*args, **kwargs)