Skip to content

Instantly share code, notes, and snippets.

View mfergie's full-sized avatar

Martin Fergie mfergie

View GitHub Profile
# Run in ipython. Download the anaconda python distribution
import numpy as np
import matplotlib.pyplot as plt
%matplotlib
x = np.linspace(-1, 1, 100)
def f(x, a, b):
y = np.zeros(x.shape)
@mfergie
mfergie / pillow-tiff-string-buffer.py
Created November 14, 2014 12:33
pillow-tiff-string-buffer.py
#!/usr/bin/env python
import PIL.Image
import numpy as np
# Create a floating point image.
fpimage = np.zeros((1000,1000), dtype=np.float32)
fpimage[200:400,200:400] = 1
import io
@mfergie
mfergie / gist:f383302f38f25a12a5ed
Created October 24, 2014 11:04
Print out all available cmake variables
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
@mfergie
mfergie / wma_to_ogg.py
Created November 17, 2012 13:06
Script for converting all WMA files in a directory to OGG
import os
import subprocess
from multiprocessing import Pool
def convert(name):
command = 'avconv -i "{}.wma" -acodec libvorbis -aq 100 -y "{}.ogg"'.format(
name, name)
@mfergie
mfergie / generate_figexampledata.m
Created October 31, 2012 07:54
Generate Fig example data
function [ output_data, mixture] = generate_figexampledata( no_points )
%GENERATE_FIGEXAMPLEDATA Summary of this function goes here
% Detailed explanation goes here
mixture = gmm(2, 4, 'full');
mixture.priors = [0.3, 0.3, 0.3, 0.1];
mixture.centres = [-4, -4;
-4, -4;
@mfergie
mfergie / figexampledata.txt
Created October 30, 2012 18:00
Script and data for scikit-learn/#393
-2.844059489096403048e+00 -3.390078096791193651e+00
-2.246556725692058443e+00 -4.134951453470232963e+00
-2.882040217945443406e+00 -2.989992710367860074e+00
-3.557989559969744420e+00 -4.874133498203447878e+00
-4.276468588458921083e+00 -4.949100415222556393e+00
-4.063084646541525125e+00 -4.965449471424126848e+00
-4.149768316170935556e+00 -4.304566658733071982e+00
-3.397283783389075218e+00 -2.450041447189784449e+00
-6.116576211048087686e+00 -4.566201068837830945e+00
-4.549464218962874895e+00 -4.120424270357679220e+00