Skip to content

Instantly share code, notes, and snippets.

Michael Jared Lumpe jlumpe

  • San Francisco, CA
Block or report user

Report or block jlumpe

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
jlumpe / pp_export.js
Created May 13, 2019
Tampermonkey script for fast BibTeX export in Paperpile app
View pp_export.js
// ==UserScript==
// @name Paperpile BibTeX export button
// @version 0.1
// @author Jared Lumpe
// @match http*://
// @grant unsafeWindow
// ==/UserScript==
(function() {
'use strict';
jlumpe /
Last active Nov 8, 2019
My set of custom LaTeX macros
# Create and install tex package for macros
set -ex
TEXMFHOME=`kpsewhich -var-value=TEXMFHOME`
mkdir -p "$dir"
./ sty > "$dir/mymath.sty"
jlumpe /
Created Jun 29, 2017
Python JSON encoder that makes more of an effort to encode non-builtin types
from json import JSONEncoder
from numbers import Integral, Real
from import Sequence, Mapping
class BetterJSONEncoder(JSONEncoder):
"""JSON encoder that makes more of an effort to encode non-builtin types."""
def default(self, o):
jlumpe /
Last active May 13, 2017
Python class for a mutable set of trees with indexed nodes containing arbitrary data.
from collections import MutableMapping, Set
class SetProxy(Set):
"""Read-only proxy for a set type."""
def __init__(self, set_):
self._set_ = set_
def __len__(self):
jlumpe /
Last active Oct 5, 2016
Bijection class in Python (aka bidirectional dictionary).
A simple implementation of a bijection, which can be thought of as a
bidirectional ``dict``.
Author: Jared Lumpe
from collections import Set, MutableMapping, Hashable
jlumpe /
Created Jul 29, 2016
Scrape Netflix ratings
from bs4 import BeautifulSoup
def parse_rating(li):
rating = dict()
title_elem, ='div.title > a')
rating['title'] = title_elem.text
jlumpe /
Created Jul 13, 2016
.npy info #numpy
import struct, ast
def npy_info(fh):
"""Get information about a .npy file, without reading in all the data.
# Check magic number
if != b'\x93NUMPY':
You can’t perform that action at this time.