Skip to content

Instantly share code, notes, and snippets.

@bzinberg
bzinberg / append_only_ordered_dict.jl
Last active Jul 9, 2020
`AppendOnlyOrderedDict` with sequential indexing
View append_only_ordered_dict.jl
"""
Append-only dictionary that:
* Preserves insertion order
* Supports concise and efficient linear indexing into the sequence of `(key,
value)` pairs
* Supports concise and efficient linear indexing into the sequence of values.
Example:
@bzinberg
bzinberg / copy_addr.sh
Created Jan 11, 2020
Automated keyboard & mouse events to copy Payee Details from web page to spreadsheet
View copy_addr.sh
#!/bin/bash
#
# Script to copy various text fields from the Chase Bill Pay "Payee
# Details" page into rows of a spreadsheet. (There is an export tool
# for wire transfer payees, but no export for Bill Pay payees.)
#
# The hard-coded numbers are specific to the web page, browser, font
# sizes, etc. It was easier in this case to do automated mouse and key
# presses in the browser than to write a custom scraper.
@bzinberg
bzinberg / baseline.py
Last active Aug 29, 2015
Python baseline
View baseline.py
import utils as u
import numpy as np
from numpy.random import random as rand
# Hyperparameters for the distribution of mu
mu_hyp = 0.0
sigma_hyp = 1.0
# Hyperparameters for the distribution of sigma
k_hyp = 1.0
@bzinberg
bzinberg / zhred.py
Last active Aug 29, 2015
Scraper to get the materials from zhongwenred.com
View zhred.py
from lxml import html
import requests
import sys
import urlparse
import os
import errno
# Gives fancy display string for links
def linkf(link):
return '"%s" (%s)' % (link.text, link.attrib['href'])
@bzinberg
bzinberg / dirgm.py
Last active Aug 29, 2015
Directed graphical model with dumps and simulators for the nodes
View dirgm.py
from random import random as rand
from numpy import log
def SIM_MISSING(*args):
raise Exception('Simulator missing')
class Node:
def __init__(self, name='untitled'):
self.name = name
self.children = []