Skip to content

Instantly share code, notes, and snippets.

@vdavez
vdavez / docx_mailmerge.py
Last active November 26, 2018 18:18
A way to mailmerge Word documents using Python
#!/usr/bin/env python
import zipfile
import string
from lxml import etree
def read_docx(filepath):
# todo: Add test to make sure it's a docx
zfile = zipfile.ZipFile(filepath)
# return the xml
@vdavez
vdavez / config.yaml
Last active August 29, 2015 14:14
legalmd-gist
levels:
- form: 'Sec. $x. '
num: 1
- form: '($x)'
num: a
- form: ($x)
num: 1
@vdavez
vdavez / config.yaml
Created February 21, 2015 21:24
legalmd-gist
levels:
- form: 'Sec. $x.'
num: 1
- form: '($x) '
num: a
- form: ($x)
num: 1
@vdavez
vdavez / config.yaml
Created February 21, 2015 21:24
legalmd-gist
levels:
- form: 'Sec. $x.'
num: 1
- form: '($x) '
num: a
- form: ($x)
num: 1
@vdavez
vdavez / config.yaml
Created February 21, 2015 21:24
legalmd-gist
levels:
- form: 'Sec. $x.'
num: 1
- form: '($x) '
num: a
- form: ($x)
num: 1
@vdavez
vdavez / inboxes.md
Created March 11, 2015 14:28
Inboxes

Multiple Inboxes in Gmail (or how @LindsayYoung saved me from email hell)

Here at 18F, we use GitHub. A lot of GitHub. Although I was comfortable with GitHub before I arrived here, I was not prepared for the volume of GitHub notifications that would be in my email's inbox. Every pull request, every new repository, every commented upon issue led to inbox bloat.

Confronted with this, I thought my options were bad ones, as follows:

  1. Deal with it and just try and keep up. (yeah, right.)
  2. Unsubscribe to the repos that were uninteresting. (This also seemed unsatisfactory, as I'm supposed to stay current on some of these things).
  3. Try and set up filters and remember to check the folders (yeah, right.)
@vdavez
vdavez / led.py
Created May 24, 2015 20:10
Raspberry Pi scripts
#!/usr/bin/env python3
from time import sleep
import requests
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script")
GPIO.setmode(GPIO.BCM)
@vdavez
vdavez / npralarm.py
Created July 3, 2015 13:46
NPR Alarm
#/usr/bin/env python3
import time
from subprocess import call
while(true):
dt = list(time.localtime())
hour = dt[3]
minute = dt[4]
if hour == 8 and minute == 0:
@vdavez
vdavez / glossary.csv
Created August 8, 2015 04:46
Glossary and D3
term definition url
ATO Authority to Operate
18F a team of top-notch designers, developers, and product specialists inside the General Services Administration, headquartered at 18 and F streets in Washington, D.C. https://18f.gsa.gov
GSA General Services Administration http://gsa.gov
d3 Data-Driven Documents http://d3js.org
@vdavez
vdavez / MCID2.txt
Last active August 29, 2015 14:27
parsing PDF
<</MCID 2 >>BDC 10.9428 0 0 10.9615 171.1056 618.8265 Tm [(P)18(etiti)-27(oners )-86(nonetheless )-86(contend )-86(that )-86(respondents\\222 )-86(clai)-18(m )-86(is )]TJ -1 -1.182 Td [(l)-18(ike )-114(the )-114(pre-empted )-114(war)-27(ni)-18(ng )-104(neutra)-27(l)-18(i)-18(zati)-27(on )-114(clai)-18(m )-114(because )-114(it )]TJ 0 -1.182 TD [(is )-14(based )-23(on )-14(st)-18(atements )-23(that )-14(\\223might )-23(create )-14(a )-23(fa)-27(lse )-14(i)-18(mpressi)-27(on\\224 )]TJ T* [(rather )-250(than )-241(st)-18(atements )-250(that )-250(are )-241(\\223)-36(i)-18(nherently )-250(fa)-27(lse)27(.)-54(\\224 )-750(Br)-27(ief )]TJ T* [(for )-141(P)18(etiti)-27(oners )-132(39. )-750(But )-141(the )-141(extent )-132(of )-141(the )-132(fa)-27(lsehood )-141(a)-27(l)-18(leged )]TJ T* [(does )-4(not )-4(a)-27(lter )-4(the )-4(nature )-14(of )-4(the )-4(clai)-18(m. )-750(N)36(oth)-27(i)-18(ng )-4(i)-18(n )-4(the )-4(Label\\255)]TJ T* [(i)-18(ng )-50(A)55(c)-18(t\\222)55(s )-41(text )-50(or )-41(pur)-18(pose )-50(or