Skip to content

Instantly share code, notes, and snippets.

View gugek's full-sized avatar

Sean Chen gugek

View GitHub Profile
@gugek
gugek / court_abbrev.py
Last active June 18, 2018 18:55
Court Abbreviations
{ "M.D. Ala.": "Middle District of Alabama",
"N.D. Ala.": "Northern District of Alabama",
"S.D. Ala.": "Southern District of Alabama",
"D. Alaska": "District of Alaska",
"D. Ariz.": "District of Arizona",
"E.D. Ark.": "Eastern District of Arkansas",
"W.D. Ark.": "Western District of Arkansas",
"C.D. Cal.": "Central District of California",
"E.D. Cal.": "Eastern District of California",
"N.D. Cal.": "Northern District of California",
@gugek
gugek / run_rsync.py
Last active November 9, 2015 18:43
Run rysnc commands on GovTrack.us to download bill data
"""Run rysnc commands on GovTrack.us to download bill data"""
try:
import subprocess32 as subprocess
except:
import subprocess
import os
congresses = range(103, 114)
for congress in congresses:
@gugek
gugek / emacs.rb
Last active August 29, 2015 14:07
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftpmirror.gnu.org/emacs/emacs-24.3.tar.gz'
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.3.tar.gz'
sha256 '0098ca3204813d69cd8412045ba33e8701fa2062f4bff56bedafc064979eef41'
option "cocoa", "Build a Cocoa version of emacs"
option "srgb", "Enable sRGB colors in the Cocoa version of emacs"
@gugek
gugek / model.py
Last active September 16, 2020 00:00
SQLAlchemy Model for Citation Relations (Association Proxy)
"""Schema for bibliographic and citation datbaase
Uses a two-way association proxy to handle relationship between article
and creators.
"""
import argparse
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql import func
from sqlalchemy import Column, UnicodeText, Integer, ForeignKey
@gugek
gugek / test_writing_unicode_leader.py
Created October 28, 2011 13:24
test_writing_unicode_leader
def test_writing_unicode_leader(self):
"""Test serializing a record with a unicode leader"""
record = Record()
record.add_field(Field(245, ['1', '0'], ['a', unichr(0x1234)]))
record.leader = u' a '
writer = MARCWriter(open('test/foo', 'w'))
writer.write(record)
writer.close()
reader = MARCReader(open('test/foo'), to_unicode=True)