Skip to content

Instantly share code, notes, and snippets.

View wearpants's full-sized avatar

Pete Fein wearpants

View GitHub Profile
@wearpants
wearpants / file_scraper.py
Last active March 27, 2017 19:54
groupby file scraper
from itertools import groupby
import csv
def parse(self, response):
with open(self.csv_file) as f:
rows = csv.DictReader(f)
for source, group in groupby(rows, lambda r: r.get('Source Url')):
meta = {

Keybase proof

I hereby claim:

  • I am wearpants on github.
  • I am wearpants (https://keybase.io/wearpants) on keybase.
  • I have a public key whose fingerprint is A38C C3FE C7A3 9977 3114 72EA 9CE9 978F FDF3 2315

To claim this, I am signing this object:

uwsgi_cache_path /var/www/catapp/CACHE keys_zone=CACHE:10m;
server {
listen 80;
server_name yourdomain.cat;
location /static {
alias /var/www/catapp/STATIC;
}
@wearpants
wearpants / bluesmote_example.py
Created January 13, 2012 18:50
Bluesmote Example
#!/usr/bin/env python
"""input: blocks output: (domain_name, count)"""
from mrjob.job import MRJob
import re
# a good enough regex for matching IP addresses
ip_re = re.compile(r"""^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$""")