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_packing.js
Last active August 29, 2015 13:56
Lay out IFCB ROIs using JS impl of Jim Scott's rectangle packer
// now refactored as jquery plugin
(function($) {
$.fn.extend({
packedMultiImage: function(width, height) {
return this.each(function() {
var k = 4; // FIXME hardcoded
var $this = $(this);
// set up the rectangle packer
var rootNode = new Node();
rootNode.rect = new Rect(0, 0, width, height);
@joefutrelle
joefutrelle / sb.xml
Created February 12, 2014 20:49
resolver config for sb imgs
<resolvers>
<resolver name="pid">
<var name="root">/mnt/svalbard/dives</var>
<match var="pid" pattern="((([A-Z]+)\.)?((\d{6})\d\d)\.(\d+)\.(\d+))(\.(\w+))?"
groups="lid _ pfx ymd ym ts1 ts2 _ ext">
<!-- high-priority cruises -->
<match var="ym" value="200303">
<path var="dir" match="${root}/200303_OC387/processed/color_corrected/*">
<path match="${dir}/${lid}.jpeg"/>
</path>
@joefutrelle
joefutrelle / flatness3.ipynb
Created February 18, 2014 21:04
lightfield flatness metrics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / radix.py
Created March 14, 2014 19:12
Example of conversion to non-base-10 base for Sean
DIGITS='0123456789ABCDEF'
k=34587
n=16
result = ''
while k > 0:
digit = k % n
result = DIGITS[digit] + result
k = (k-digit) / n
@joefutrelle
joefutrelle / flatness4.ipynb
Created March 17, 2014 19:41
large-scale lightmap flatness test and descriptive graphics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / effective_resolution_distance_map.ipynb
Last active September 21, 2015 15:13
Effective resolution of distance map
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / ifcb_segmentation.ipynb
Last active August 29, 2015 13:57
H. Sosik image segmentation workflow, Octave implementation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / ns.py
Created July 25, 2014 14:36
example of (rather convoluted) way to parse prefixed tag names using etree
from StringIO import StringIO
import xml.etree.ElementTree as ET
mvco_ns = 'http://ifcb-data.whoi.edu/mvco/'
lid = 'IFCB5_2011_033_041857'
nsmap = {'mvco': mvco_ns}
def parse_id(pfx_id, nsmap={}):
ns_statements = ' '.join(['xmlns:%s="%s"' % (k,v) for k,v in nsmap.items()])
xml = '<%s %s/>' % (pfx_id, ns_statements)