Skip to content

Instantly share code, notes, and snippets.

@mattmcd
mattmcd / CFunction.g4
Created April 21, 2013 12:26
ANTLR4 version of Wrapper Generator
grammar CFunction;
function : retType name args ;
args : '(' arg (',' arg)* ')' ;
arg
: 'double' name # SCALAR_ARG
| 'double' '*' name # ARRAY_ARG
@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 / 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 / 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 / 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 / s3_upload.json
Created May 8, 2016 10:54
IAM policy for uploading files to S3
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:ListAllMyBuckets",
"s3:ListBucket",
"s3:CreateBucket"

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 / 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])
@mattmcd
mattmcd / MaskRCNN_setup.sh
Last active March 31, 2018 07:34
10 minutes to Mask R-CNN
# Amazon #Sagemaker instance
# open Jupyter
# new terminal
cd SageMaker
git clone https://github.com/matterport/Mask_RCNN.git
git clone https://github.com/waleedka/coco.git
cd coco/PythonAPI
source activate tensorflow_p36
make
python setup.py install
@mattmcd
mattmcd / Dockerfile
Created March 20, 2018 10:56
TensorFlow library install on AmazonLinux for AWS Lambda
FROM amazonlinux:latest
MAINTAINER Matt McDonnell "matt@matt-mcdonnell.com"
RUN yum -y -q update
RUN yum -y -q install python27-pip zip
RUN pip install -q virtualenv