Skip to content

Instantly share code, notes, and snippets.

@mattmcd
mattmcd / two_compartment.py
Created December 23, 2016 11:25
PyStan version of two compartment model from "Stan: A probabilistic programming language for Bayesian inference and optimization" Gelman, Lee, Guo (2015)
import pystan
import numpy as np
# Two compartment model from
# "Stan: A probabilistic programming language for
# Bayesian inference and optimization" Gelman, Lee, Guo (2015)
# http://www.stat.columbia.edu/~gelman/research/published/stan_jebs_2.pdf
a = np.array([0.8, 1.0])
b = np.array([2, 0.1])

Keybase proof

I hereby claim:

  • I am mattmcd on github.
  • I am mattmcd (https://keybase.io/mattmcd) on keybase.
  • I have a public key ASC3HfvXMCZ-vnJ4gWwCe_hsgtgEHRNrV2qtHOK8iU40Bgo

To claim this, I am signing this object:

@mattmcd
mattmcd / FTSE100.csv
Created May 8, 2016 08:41
Files for scheduled stock data download on EC2
ticker name premium_code free_code
ADN Aberdeen Asset Management GOOG/LON_ADN
ADM Admiral Group EOD/ADM GOOG/LON_ADM
AGK Aggreko GOOG/LON_AGK
AMEC AMEC GOOG/LON_AMEC
AAL Anglo American plc EOD/AAL GOOG/LON_AAL
ANTO Antofagasta GOOG/LON_ANTO
ARM ARM Holdings GOOG/LON_ARM
ABF Associated British Foods GOOG/LON_ABF
AZN AstraZeneca EOD/AZN GOOG/LON_AZN
@mattmcd
mattmcd / test_foo.py
Last active May 5, 2016 07:57
Test framework boilerplate in Python
# Test framework
from unittest import TestCase
from nose.tools import raises
# Objects under test
from foo import bar
class TestBar(TestCase):
def test_cool_bar_thing1(self):
self.assert(1==1)
@mattmcd
mattmcd / opencv_clj_setup.txt
Created February 10, 2016 06:57
Instructions for setting up OpenCV development in Clojure on Ubuntu
# Instructions for setting up OpenCV development in Clojure on Ubuntu
# Copied from http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html
# Install opencv
sudo apt-get install libopencv-dev
# Get location of latest .jar and .so
dpkg -L libopencv2.4-java | grep jar
dpkg -L libopencv2.4-jni | grep .so
@mattmcd
mattmcd / Makefile
Created June 8, 2013 10:32
Trying out lambdas and std::function in C++11
all: test_Factory
test_Factory: test_Factory.cpp
$(CXX) -std=c++0x -o test_Factory test_Factory.cpp
@mattmcd
mattmcd / CFunction.g
Created April 21, 2013 12:25
ANTLR3 version of Wrapper Generator
grammar CFunction;
options {
output = AST;
ASTLabelType = CommonTree;
}
tokens {
SCALAR;
ARRAY;
@mattmcd
mattmcd / saddle_install.txt
Created April 7, 2013 11:23
Shell history from installing Saddle: Scala Data Library http://saddle.github.io/ A couple of extra steps above the standard install were required in order to update my Java install to Java 7.
# Change location to where External Code is installed
cd ~/Work/ExternCode/
# Install conscript, a tool for installing and updating Scala software
# programs.
curl https://raw.github.com/n8han/conscript/master/setup.sh > conscript_setup.sh
less conscript_setup.sh
chmod 755 conscript_setup.sh
./conscript_setup.sh
@mattmcd
mattmcd / gist:5277466
Created March 30, 2013 17:03
Installing ANTLR 4.0 in TerminalIDE on a Nexus 7
1. Modify ~/system/bin/dx to increase memory size:
#dx helper script
dalvikvm -Xms256m -Xmx512m -cp $APK com.spartacusrex.spartacuside.external.dx $@
2. Download [Complete ANTLR 4.0 Java binaries jar](http://www.antlr.org/download/antlr-4.0-complete.jar) and copy to ~/bin. Change to this directory.
3. Convert jar to dex so that it can run on Android (takes about 20mins with power connected):
dx --dex --output=antlr-4.0.dex.jar antlr-4.0-complete.jar
@mattmcd
mattmcd / Makefile
Created March 30, 2013 11:55
Identifying FX Arbitrage as a linear programming problem using COIN-OR Linear Program Solver (CLP).
all: fx_solver
fx_solver: fx_solver.cpp
clang++ -std=c++0x -I/usr/include/coin -o fx_solver fx_solver.cpp -lClp
# Install CLP:
# sudo apt-get install coinor-libclp0 coinor-libclp-doc