Skip to content

Instantly share code, notes, and snippets.

View jsvine's full-sized avatar

Jeremy Singer-Vine jsvine

View GitHub Profile
jsvine /
Last active May 28, 2024 07:18
Installing VisiData via pipx

Installing VisiData via pipx

pipx is a command-line tool that allows you to run Python applications in isolated environments. It's a great way to make VisiData available across your system without worrying that its dependencies will conflict with other Python projects. This short guide will show you how.

Step 0: Uninstall global VisiData

If you have have previously VisiData installed globally, uninstall it by running pip3 uninstall visidata.

Otherwise, you can skip this step.

jsvine / download-craftcans.js
Created May 21, 2017 18:33
Downloading's canned beer database as structured data
// Step 1: Go to
// Step 2: Open your browser's developer console
// Step 3: Paste the code below into the console
(function () {
var getText = function (el) {
return el.textContent.trim().replace(/\n/g, " ");
// Get the last <table> on the page
jsvine / optm-report-to-tsv.js
Created February 10, 2016 12:43
Script to convert Organ Procurement and Transplantation Network website data reports into spreadsheet-friendly tab-separated values (TSV) files.
/* OPTM Report -> TSV
The script below takes reports generated by the Organ Procurement and Transplantation
Network website and converts them into spreadsheet-friendly tab-separated values (TSV) files.
1. Create an advanced data report at In Step 4, keep the default options ("Counts" + "Portrait").
2. On the results page, open up your browser's console.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
jsvine /
Created November 18, 2015 12:30
How to download SIPRI arms transfer data as a CSV file instead of a rich-text file.

The Stockholm International Peace Research Institute's Arms Transfers Database provides a tool to download the data. By default, that output is an .rtf rich-text file — not so easy to analyze with your favorite spreadsheet or statistics software. Luckily, getting a CSV of the data isn't very difficult. Here's how.

To get all transfers for 2014, by seller, run this command in your terminal:

curl --compressed \
    --data 'low_year=2014' \
    --data 'high_year=2014' \
    --data 'seller_country_code=' \
 --data 'buyer_country_code=' \

Keybase proof

I hereby claim:

  • I am jsvine on github.
  • I am jsvine ( on keybase.
  • I have a public key whose fingerprint is 8397 1E4B 55BD 5519 D5B8 7922 E6D8 761D 9F56 510A

To claim this, I am signing this object:

jsvine /
Last active May 10, 2021 13:43
First things to install on a new Mac OSX [WIP]

An Open-Source Thank You

In late October, the WSJ published Waste Lands, an interactive database I helped build and report. Waste Lands draws upon thousands of public records and other sources to trace the history of hundreds of factories and laboratories the government recruited to help develop nuclear weapons during the build-up to the Cold War.

Building the database took considerable time and effort. But it would have been immeasurably more difficult and time-consuming — if not nearly impossible — without the fistfuls of open-source code we were able to rely upon:

jsvine / exemplify.js
Created November 13, 2013 22:33
A bare-bones helper for creating simple demos/tutorials. See example usage here:
var exemplify = function (fn, code_el) {;
var str = fn.toString();
var lines = str.split("\n").slice(1, -1);
var start_index = lines[0].match(/[^\s].*$/).index;
var trimmed = (x) {
return x.slice(start_index);
code_el.innerHTML = trimmed;
jsvine / rolling-average.js
Last active December 27, 2015 05:09
Just a little helper function. Depends on, and hooks into, underscore.
(function () {
var root = this;
var sum = function (arr) {
return _.reduce(arr, function (m, x) {
return m + x;
// n: Size of the stack, i.e., how far to look back