Skip to content

Instantly share code, notes, and snippets.

@Glench
Glench / ubuntu-setup.md
Created April 2, 2012 12:53 — forked from jmondo/ubuntu-setup.md
Setting up Rails server environment on Ubuntu 11.10

Setting up Rails server environment on Ubuntu 11.10

Including Rails, Passenger, RVM, Ruby 1.9.3, SSH keys, Postgres and a test app

Instructions

  • This is tested on a clean install of Ubuntu 11.10 server (with SSH root access), though it should work on whatever install you have now.
  • Replace LOGIN with your ubuntu username
  • Replace SERVER_ADDRESS with the IP address of your server
@Glench
Glench / include_raw.py
Created June 15, 2012 04:52
Better Django include_raw, for escaping included files in templates
# To make this work, put this file in the templatetags directory of your app
# (make it if it doesn't exist, and make sure to add a blank __init__.py file
# if it doesn't already exist). Then from your template call
# {% load include_raw %} {% include_raw 'some_template' %}
from django import template
from django.conf import settings
from django.template.loaders.app_directories import load_template_source
register = template.Library()
@Glench
Glench / state_adjacency.py
Created October 17, 2012 15:08
State adjacency in python
# for use with http://writeonly.wordpress.com/2009/03/20/adjacency-list-of-states-of-the-united-states-us/
import csv
import json
from pprint import pprint
with open('states.csv', 'rb') as csvfile:
state_reader = csv.reader(csvfile)
adjacency_dict = {}
for row in state_reader:
adjacency_dict[row[0]] = [state for state in row[1:]]
@Glench
Glench / adjacent_us_states.json
Created October 17, 2012 15:10
JSON US State Adjacency List
{
"WA": [
"ID",
"OR"
],
"DE": [
"MD",
"PA",
"NJ"
],
@Glench
Glench / former_quarterbacks.txt
Last active December 11, 2015 04:38
all past quarterbacks
Abbott, Faye
Adams, Tony
Adkins, Sam
Aikman, Troy
Ainge, Erik
Albert, Frankie
Allard, Don
Allen, Ermal
Allen, Jared
Anderson, Billy
@Glench
Glench / former_quarterbacks_naive_countries.txt
Last active December 11, 2015 05:08
naive rhyme matching of former quarterbacks to countries, just matches last few letters
Jordan, Homer : ['jordan']
Testaverde, Vinny : ['cape verde']
Riordan, Tim : ['jordan']
Germaine, Joe : ['ukraine']
Lamonica, Daryle : ['dominica']
O'Hara, Pat : ['western sahara']
Dorsey, Ken : ['jersey']
Verica, Marc : ['costa rica', 'south africa']
Froman, Adam : ['oman']
Humphries, Stan : ['french southern territories']
@Glench
Glench / current_quarterbacks.txt
Last active December 11, 2015 05:08
current quarterbacks
Anderson, Derek
Archer, R.J.
Bartel, Richard
Batch, Charlie
Beck, John
Bethel-Thompson, McLeod
Blanchard, Matt
Bradford, Sam
Brady, Tom
Brandstater, Tom
@Glench
Glench / all_countries.txt
Created January 16, 2013 18:55
a decent list of countries
Ascension Island
Andorra
United Arab Emirates
Afghanistan
Antigua and Barbuda
Anguillaal
Albania
Armenia
Netherlands Antilles
Angola
@Glench
Glench / all_quarterbacks_naive_countries.txt
Created January 16, 2013 18:56
a naive matching of countries to all quarterbacks including current ones
Jordan, Homer : ['jordan']
Testaverde, Vinny : ['cape verde']
Riordan, Tim : ['jordan']
Germaine, Joe : ['ukraine']
Lamonica, Daryle : ['dominica']
O'Hara, Pat : ['western sahara']
Dorsey, Ken : ['jersey']
Verica, Marc : ['costa rica', 'south africa']
Froman, Adam : ['oman']
Humphries, Stan : ['french southern territories']
@Glench
Glench / all_quarterbacks_naive_countries_last3letters.txt
Created January 16, 2013 19:03
a naive matching of all quarterbacks to countries this time using only the last 3 letters
Aikman, Troy : ['isle of man', 'oman']
Davis, Bob : ['saint kitts and nevis']
Boeckman, Todd : ['isle of man', 'oman']
Hilger, Rusty : ['niger']
Bomar, Rhett : ['myanmar']
Lamonica, Daryle : ['antarctica', 'costa rica', 'dominica', 'jamaica', 'south africa']
Jaynes, David : ['philippines', 'saint vincent and the grenadines']
Davis, Nate : ['saint kitts and nevis']
Roethlisberger, Ben : ['niger']
Long, Chuck : ['hong kong']