Skip to content

Instantly share code, notes, and snippets.

View jeremyjbowers's full-sized avatar

Jeremy Bowers jeremyjbowers

View GitHub Profile
import re
import json
ws_re = re.compile("\s+")
line_num_re = re.compile("\s\d+\s{2,}", re.M)
# first, pdftotext -layout <pdf> <text>
with open("12-307_jnt1.txt", "r") as f:
data = f.read()
Traceback (most recent call last):
File "/Users/jbowers/.virtualenvs/playgrounds2/lib/python2.7/site-packages/fabric/main.py", line 717, in main
*args, **kwargs
File "/Users/jbowers/.virtualenvs/playgrounds2/lib/python2.7/site-packages/fabric/tasks.py", line 299, in execute
multiprocessing
File "/Users/jbowers/.virtualenvs/playgrounds2/lib/python2.7/site-packages/fabric/tasks.py", line 198, in _execute
return task.run(*args, **kwargs)
File "/Users/jbowers/.virtualenvs/playgrounds2/lib/python2.7/site-packages/fabric/tasks.py", line 112, in run
return self.wrapped(*args, **kwargs)
File "/Users/jbowers/Projects/playgrounds2/fabfile.py", line 456, in deploy
@jeremyjbowers
jeremyjbowers / states.py
Created July 15, 2013 20:29
A Python list of the 50 US states plus the district of columbia.
US_STATES = ['AL','AK','AZ','AR','CA','CO','CT','DE','DC','FL','GA','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY']
@jeremyjbowers
jeremyjbowers / inspections.conf
Last active December 20, 2015 15:09
Basic uWSGI configuration for inspections project.
# Ubuntu Linux uses a program called Upstart
# for handling jobs that run at startup.
# We call these "daemons" because of reasons.
# Hit the google for details.
# Give our app a description because it's
# nice to do that sort of thing.
description "uWSGI server for Inspections"
# Start up if we're running the server.
@jeremyjbowers
jeremyjbowers / nginx.conf
Last active December 20, 2015 15:09
Basic Nginx configuration for Inspections project.
# One process because we only have one core.
worker_processes 1;
# The Web server should run as a separate user
# because if it is compromised, it won't have
# permissions to do evil things.
user www-data;
# Where to keep the process id.
# /var/run is standard.
@jeremyjbowers
jeremyjbowers / varnish.vcl
Last active December 20, 2015 15:09
Basic Varnish configuration for Inspections project.
# Okay, so, let's start by setting up a backend.
# Varnish needs to know where to send requests
# that fail to find an object in the cache.
# We'll send requests back to Nginx on port 8001.
backend default {
.host = "127.0.0.1";
.port = "8001";
}
# Varnish has some subfunctions (subroutines?) that start
@jeremyjbowers
jeremyjbowers / varnish
Last active December 20, 2015 15:09
Basic Varnish configuration for /etc/default/varnish
# Oh, wow. So those other configuration files
# looked pretty readable. This one, though,
# looks OOOOOLLLD. It is old. And so it's
# less readable. But let's talk about it.
# Run on startup? Yes.
START=yes
# Set the number of files this daemon can
# touch. We need los of them because each
@jeremyjbowers
jeremyjbowers / app.py
Last active December 20, 2015 15:18
Basic WSGI app for Inspections.
# Finally, something written in Python again.
# It's like drinking clean water after taking
# a mouthful of mud.
# Import OS so we can do some things to the
# operating system.
import os
# Set an environment variable exporting our
# Django settings module.
{
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"draw_indent_guides": true,
"draw_white_space": "selection",
"file_exclude_patterns":
[
".DS_Store",
@jeremyjbowers
jeremyjbowers / veggie_stock.md
Last active January 2, 2016 08:19
Veggie ramen broth. Because sometimes, just sometimes, you need to feed a vegan who suffers from Celiac disease.

Veggie Stock for Ramen

This is a two-part stock. It starts as an umami-heavy kombu/mushroom dashi and then adds a vegetable backbone. Intended to mimic the "two-broth" style of non-vegetarian ramen stock.

Ingredients

Dashi

Note these are estimates. You can vary by more than double without ruining anything.

  • 1 medium package (3-4 oz) of dried mushrooms
  • 3 sheets of kombu kelp

Vegetables