Skip to content

Instantly share code, notes, and snippets.

Jeremy Singer-Vine jsvine

Block or report user

Report or block jsvine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jsvine
jsvine / visidata-pipx-installation.md
Last active Aug 16, 2019
Installing VisiData via pipx
View visidata-pipx-installation.md

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
jsvine / download-craftcans.js
Created May 21, 2017
Downloading CraftCans.com's canned beer database as structured data
View download-craftcans.js
// Step 1: Go to http://craftcans.com/db.php?search=all&sort=beerid&ord=desc&view=text
// 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
jsvine / optm-report-to-tsv.js
Created Feb 10, 2016
Script to convert Organ Procurement and Transplantation Network website data reports into spreadsheet-friendly tab-separated values (TSV) files.
View optm-report-to-tsv.js
/* 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.
Instructions:
1. Create an advanced data report at https://optn.transplant.hrsa.gov/converge/LatestData/advancedData.asp. In Step 4, keep the default options ("Counts" + "Portrait").
2. On the results page, open up your browser's console.
View warriors-streak-odds-2015-12-09.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsvine
jsvine / SIPRI-arms-transfer.md
Created Nov 18, 2015
How to download SIPRI arms transfer data as a CSV file instead of a rich-text file.
View SIPRI-arms-transfer.md

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 http://armstrade.sipri.org/armstrade/html/export_trade_register.php --compressed \
    --data 'low_year=2014' \
    --data 'high_year=2014' \
    --data 'seller_country_code=' \
    --data 'buyer_country_code=' \
View keybase.md

Keybase proof

I hereby claim:

  • I am jsvine on github.
  • I am jsvine (https://keybase.io/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
jsvine / installations.md
Last active Sep 24, 2019
First things to install on a new Mac OSX [WIP]
View installations.md
View waste-lands-open-source-thanks.md

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
jsvine / exemplify.js
Created Nov 13, 2013
A bare-bones helper for creating simple demos/tutorials. See example usage here: http://www.jsvine.com/gmap-button/demo/
View exemplify.js
var exemplify = function (fn, code_el) {
fn.call(fn);
var str = fn.toString();
var lines = str.split("\n").slice(1, -1);
var start_index = lines[0].match(/[^\s].*$/).index;
var trimmed = lines.map(function (x) {
return x.slice(start_index);
}).join("\n");
code_el.innerHTML = trimmed;
};
@jsvine
jsvine / rolling-average.js
Last active Dec 27, 2015
Just a little helper function. Depends on, and hooks into, underscore.
View rolling-average.js
(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
You can’t perform that action at this time.