Skip to content

Instantly share code, notes, and snippets.

@benhowes
benhowes / gist:3927616
Created October 21, 2012 17:06
Optimal Route for 3 journeys and 2 taxis
Input Journeys
----
processing route: 100 whiteladies road
-> 15 Park Street
route interpreted as: 100 Whiteladies Rd, Clifton, Bristol, City of Bristol BS8, UK
-> 15 Park St, Bristol BS1, UK
route length 1859.06420152
processing route: 6 Tyndalls Park Road
-> Temple Meads Station
@benhowes
benhowes / gist:3873887
Created October 11, 2012 17:00
Empty tree (unless upping max render elements)
include <MCAD/involute_gears.scad>
include <MCAD/bearing.scad>
include <MCAD/boxes.scad>
include <MCAD/nuts_and_bolts.scad>
include <MCAD/units.scad>
include <motor_gearbox.scad>
far_center = [60,0,0];
near_center = [-60,0,0];
@benhowes
benhowes / gist:3867415
Created October 10, 2012 18:13
Empty tree
include <MCAD/involute_gears.scad>
include <MCAD/bearing.scad>
include <MCAD/boxes.scad>
include <MCAD/nuts_and_bolts.scad>
include <MCAD/units.scad>
far_center = [60,0,0];
near_center = [-60,0,0];
end_cube_radius = 15;
stem_thickness = 7;
//c Ben Howes 2012
//the main structure of the arm section
module s1_main(outline=false, tol=0){
far_center = 120;
end_cube_radius = 15;
hole_offset = end_cube_radius-4.75;
@benhowes
benhowes / new.coffee
Created August 23, 2012 21:02
Using array objects
initBuffer = (len)->
buffer = new ArrayBuffer(len)
stack = new Uint8Array(buffer);
for i in [0..len] by 2
stack[i] = 0;
stack[i+1] = 1;
stack
regress = ()->
stack = initBuffer(4)
@benhowes
benhowes / simple.coffee
Created August 23, 2012 20:39
Simple array style
regress = ()->
stack = [0,1,0,1] #regress with stack of 4 and mean of 0
(result)->
stack.push(result)
stack.unshift()
sum = 0
for i in stack
sum += i
sum /= 4
if sum is 0.5 then Math.RandomInteger(0,1)
@benhowes
benhowes / Gamblers Falacy.coffee
Created August 21, 2012 20:16
prove to your intuition that you cannot predict coin tosses any better than chance with a knowledge of the recent flips!
runs = 1000000
Math.RandomInteger = (n, m) ->
if not m then m = 1 # default range starts at 1
max = if n > m then n else m # doesn<q>t matter which value is min or max
min = if n is max then m else n # min is value that is not max
d = max - min + 1 # distribution range
Math.floor(Math.random() * d + min)
@benhowes
benhowes / gist:2377570
Created April 13, 2012 15:13
Pandaboard stereo camera rig

Stereo camera rig.

I am attempting to make a stereo camera rig for the pandaboard. The aim is to release it as an open source hardware project when it is in a working form.

Hardware

Some images of the hardware can be found here: http://imgur.com/a/3L5l8

System layout: