Skip to content

Instantly share code, notes, and snippets.

"""
Elias Omega code in Python
http://en.wikipedia.org/wiki/Elias_omega_coding
Peter Elias, "Universal codeword sets and representations of the integers", IEEE Trans. Information Theory 21(2):194-203, Mar 1975.
Also known as the log* (or "logstar") code in Rohan Baxter's 1996 PhD thesis.
Type 'python EliasOmega.py' to run the tests.
"""
@mpacer
mpacer / mathjax_bug.png
Last active November 26, 2015 06:35
Demonstrates a bug in jupyter notebook rendering of Mathjax/LaTeX where the LaTeX syntax depends on delimiter
mathjax_bug.png
@mpacer
mpacer / proseclock.py
Last active February 10, 2016 20:54
Prose clock: an extensible framework for regularly clocking how much prose (in tex) you've written + some other stats
import os
import re
import os.path
import datetime
import csv
import pandas as pd
from difflib import SequenceMatcher
def map_feat_to_vals(features,vals,f,words,contents):
return {f:v for f,v in zip(features,vals)}
@mpacer
mpacer / unfinished_ipython_genutils_project_generator.ipynb
Created November 21, 2016 17:25
Broken solution to automatically scrape a package to find the use of ipython_genutils
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
site "http*://mail.google.com/*"{
unmap x
unmap k
unmap j
unmap o
unmap O
unmap N
unmap g
unmap t
unmap c
@mpacer
mpacer / IPython-dl.ipynb
Last active May 19, 2017 23:13
IPython-dl graphs improved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mpacer
mpacer / tags.js
Created September 19, 2017 00:21
(not-so) Quick prototype of adding tags w/ react components
// pages/tags.js
// At 127.0.0.1:3000/tags on a next dev run
import React from "react";
function appendTag(tags, newTag) {
// Since arrays are mutable, we use `concat` to return a copy of the original
// array with our new tag
// Question: is the reason to not just change it mutably that that isn't clean
// and against the ethos of React?
@mpacer
mpacer / tags.js
Created September 20, 2017 03:06
Nicer tags
// pages/tags.js
// At 127.0.0.1:3000/tags on a next dev run
import React from "react";
const ButtonStyle = {
border: "none",
backgroundColor: "#c3e2e9",
display: "inline-block",
textDecoration: "none",
padding: ".25em 0.5em",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.