Skip to content

Instantly share code, notes, and snippets.

@bzinberg
bzinberg / dirgm.py
Last active August 29, 2015 14:21
Directed graphical model with dumps and simulators for the nodes
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 = []
@bzinberg
bzinberg / zhred.py
Last active August 29, 2015 14:22
Scraper to get the materials from zhongwenred.com
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 / baseline.py
Last active August 29, 2015 14:22
Python baseline
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 / copy_addr.sh
Created January 11, 2020 17:06
Automated keyboard & mouse events to copy Payee Details from web page to spreadsheet
#!/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 / Filtering log messages in a big Julia package.ipynb
Last active November 2, 2021 16:32
Filtering log messages in a big Julia package
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bzinberg
bzinberg / append_only_ordered_dict.jl
Last active January 29, 2022 15:50
`AppendOnlyOrderedDict` with sequential indexing
"""
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: