Skip to content

Instantly share code, notes, and snippets.

View joefutrelle's full-sized avatar

Joe Futrelle joefutrelle

  • Falmouth, MA
View GitHub Profile
@joefutrelle
joefutrelle / ifcb_segmentation.ipynb
Last active August 29, 2015 13:57
H. Sosik image segmentation workflow, Octave implementation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / par.cpp
Last active August 29, 2015 14:18
Simple Boost ASIO based parallelization template
#include <iostream>
#include <string>
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#define N_THREADS 4
#define N_JOBS 10
/* compile on Ubuntu using
g++ par.cpp -lboost_thread -lboost_system
@joefutrelle
joefutrelle / webapp.py
Created April 2, 2015 17:56
Flask webapp template
from flask import Flask, Response
app = Flask(__name__)
@app.route('/')
def index():
return Response('<h1>Hello, world.</h1>',mimetype='text/html')
if __name__=='__main__':
app.run(host='0.0.0.0',port=8080,debug=True)
@joefutrelle
joefutrelle / dir_rate.py
Created August 9, 2017 13:09
computes rate of mods to files in a directory and reports in files/hr
from __future__ import print_function
import os
import sys
DIR=sys.argv[1]
times = []
for fn in os.listdir(DIR):
path = os.path.join(DIR, fn)
@joefutrelle
joefutrelle / grosser.sc
Last active November 10, 2017 16:44
Supercollider patch named for Ben Grosser (2004)
(
Routine({
SynthDef("buzz", {arg bufnum;
var dust, pitch, density, amp, env, pan, osc, gate;
var brown1, brown2, brown3, brown4, brown5;
var pitch1, pitch2;
pitch1 = IRand(10,128);
pitch2 = IRand(10,128);
brown1 = LFNoise2.kr(LFNoise2.kr(0.1, 10).abs + 0.1, LFNoise2.kr(0.1, 1.0).abs).abs;
brown2 = LFNoise2.kr(LFNoise2.kr(0.1, 10).abs + 0.1, LFNoise2.kr(0.1, 1.0).abs).abs;
@joefutrelle
joefutrelle / state2dot.sed
Created July 22, 2014 18:02
take a file where each line is "state action state" and turn it into a Graphviz .dot file
#!/bin/sed -e
1i digraph foo {
s/\([[:alnum:]]*\) \([[:alnum:]]*\) \([[:alnum:]]*\)/\1 -> \3 [label="\2"];/
$a }
@joefutrelle
joefutrelle / basic multiprocessing.ipynb
Created August 10, 2016 15:23
Introduction to multiprocessing in iPython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / aaa_nut_reps2netcdf.py
Last active May 1, 2018 17:54
create CF compliant NetCDF files from MVCO nutrient data
import os
from scipy.io import loadmat
import pandas as pd
from pocean.dsg.timeseriesProfile.om import OrthogonalMultidimensionalTimeseriesProfile as OMTP
MAT_FILE = '/vagrant/nut_data_reps.mat'
OUT_DIR = './output'
mat = loadmat(MAT_FILE, squeeze_me=True)
@joefutrelle
joefutrelle / Decision tree cubism.ipynb
Created May 3, 2016 13:58
Cubism using decision tree
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / install-docker.sh
Last active February 1, 2019 13:35
Install Docker in Debian
# current as of 2018-12-10
# install docker-ce: https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update