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
# modifying and extending code from sphinx | |
# https://github.com/skerit/cmusphinx/blob/master/SphinxTrain/python/cmusphinx/divergence.py#L47 | |
import numpy as np | |
import itertools | |
def gau_kl(pm, pv, qm, qv): | |
""" | |
Kullback-Liebler divergence from Gaussian pm,pv to Gaussian qm,qv. | |
Also computes KL divergence from a single Gaussian pm,pv to a set | |
of Gaussians qm, qv. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/env bash | |
# First download cudnn to a directory /tmp/binaries. | |
# The filename should be cudnn-9.2-linux-x64-v7.1.tgz | |
set -e | |
# Install driver | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt-get update |
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 z3 import * | |
# find the (distinct) integers in 0..9 that make this equation work: | |
# | |
# SEND | |
# + MORE | |
# ------ | |
# MONEY | |
S = Int('S') |
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 sys import version_info | |
assert version_info.major == 3 and version_info.minor >= 3, \ | |
'requires PEP 362; Python 3.3 or later; python.org/dev/peps/pep-0362/' | |
from inspect import signature | |
class memoise(dict): | |
def __init__(self, func): | |
self.func, self.signature = func, signature(func) | |
def __missing__(self, key): | |
args, kwargs = key |
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 __future__ import print_function | |
import subprocess | |
from threading import Thread, Event | |
# https://stackoverflow.com/questions/1191374/using-module-subprocess-with-timeout | |
def kill_on_timeout(done, timeout, proc): | |
if not done.wait(timeout): | |
proc.kill() | |
def exec_command(command, shell=False, timeout=None): |
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
for i in {1..100}; do | |
filepath=$(printf "http://caliban.mpipz.mpg.de/haeckel/kunstformen/Tafel_%03d_300.jpg" $i) | |
wget $filepath; | |
done |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.12000.org/my_notes/mma_matlab_control/KERNEL/KEse82.htm | |
# https://faculty.washington.edu/rjl/fdmbook/matlab/poisson.m | |
# https://wiki.scinet.utoronto.ca/wiki/images/b/be/Rcp8Lecture8.pdf | |
# http://people.sc.fsu.edu/~jpeterson/notes_fd.pdf | |
# http://people.bu.edu/andasari/courses/Fall2015/LectureNotes/Lecture14_27Oct2015.pdf | |
import matplotlib | |
matplotlib.use("Agg") | |
import numpy as np | |
from scipy.misc import imresize | |
import scipy.sparse as spa |