Skip to content

Instantly share code, notes, and snippets.

@vdavez
vdavez / index.html
Last active August 12, 2020 01:34
Sparklines!!!
<!-- Load d3.js -->
<head>
<script src="https://d3js.org/d3.v4.js"></script>
</head>
<body>
<!-- Create a div where the graph will take place -->
<div id="sparkline"></div>
<script src="./sparklines.js"></script>
@vdavez
vdavez / long_tail_elements.ipynb
Created January 26, 2020 16:15
Long tail of federal data elements
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vdavez
vdavez / .block
Created October 23, 2019 16:22 — forked from domoritz/.block
Vega-Lite Bl.ocks example
license: bsd-3-clause
@vdavez
vdavez / FBOParser.ipynb
Created April 28, 2019 23:00
FedBizOpps Parser
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vdavez
vdavez / fedregparse.py
Created December 18, 2018 17:04
Parsing through the Federal Register
import os
from lxml import etree
import csv
import sys
titles = {}
for title in range(1,50):
titles[title] = 0
for froot, dirs, files in os.walk('.', topdown=True):
@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 / docker_install.sh
Last active October 22, 2017 17:13
setup scripts
#!/bin/bash
# Install docker on a Ubuntu box
# Installation script taken from https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
sudo apt-get remove -y docker docker-engine docker.io
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
@vdavez
vdavez / pdftojson.js
Created August 3, 2014 03:26
pdftojson
// Take a PDF file & make JSON out of it.
// USAGE: node app.js -f filename.pdf -o filename.json
var fs = require('fs'),
path = require('path'),
exec = require('child_process').exec,
argv = require('minimist')(process.argv.slice(2));
function run(filename, output) {
var data = {}
@vdavez
vdavez / announcement.md
Last active October 14, 2017 14:03
Draft announcement for Innovation Fellow

An Experiment in Government Innovation—Legal Hackers in Residence

In the last two years, my office has been working with civic hackers—Code for DC, DC Legal Hackers, and others—and organizations like US ODI and the OpenGov Foundation to build open-source tools to make DC’s law more accessible. Increasingly, we are working to expand our efforts and join with partner cities through the Free Law Founders. I’ve even learned to code in Python, Node, and am learning Ruby.

In the last year, though, I had a realization: it is time to bring the hackers in-house. It is time for government lawyers to embrace innovation and to retool our practice for the digital age. We need to stop using bad tools—or worse paying overpriced vendors for proprietary software that works some of the time—and instead work with developers. In turn, instead of building one-off applications and fighting with legal teams, developers can be a

@vdavez
vdavez / d3.legend.js
Last active October 14, 2017 14:02
Petit Jury Reporting Rates
// d3.legend.js
// (C) 2012 ziggy.jonsson.nyc@gmail.com
// MIT licence
(function() {
d3.legend = function(g) {
g.each(function() {
var g= d3.select(this),
items = {},
svg = d3.select(g.property("nearestViewportElement")),