This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Paperpile BibTeX export button | |
// @version 0.1 | |
// @author Jared Lumpe | |
// @match http*://paperpile.com/app | |
// @grant unsafeWindow | |
// ==/UserScript== | |
(function() { | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create and install tex package for macros | |
set -ex | |
TEXMFHOME=`kpsewhich -var-value=TEXMFHOME` | |
dir="$TEXMFHOME/tex/latex/custom" | |
mkdir -p "$dir" | |
./mathmacros.py sty > "$dir/mymath.sty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from json import JSONEncoder | |
from numbers import Integral, Real | |
from collections.abc import Sequence, Mapping | |
class BetterJSONEncoder(JSONEncoder): | |
"""JSON encoder that makes more of an effort to encode non-builtin types.""" | |
def default(self, o): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections.abc import MutableMapping, Set | |
class SetProxy(Set): | |
"""Read-only proxy for a set type.""" | |
def __init__(self, set_): | |
self._set_ = set_ | |
def __len__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple implementation of a bijection, which can be thought of as a | |
bidirectional ``dict``. | |
Author: Jared Lumpe | |
""" | |
from collections import Set, MutableMapping, Hashable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.netflix.com/MoviesYouveSeen""" | |
from bs4 import BeautifulSoup | |
def parse_rating(li): | |
rating = dict() | |
title_elem, = li.select('div.title > a') | |
rating['title'] = title_elem.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct, ast | |
def npy_info(fh): | |
"""Get information about a .npy file, without reading in all the data. | |
See http://docs.scipy.org/doc/numpy/neps/npy-format.html | |
""" | |
# Check magic number | |
if fh.read(6) != b'\x93NUMPY': |