Skip to content

Instantly share code, notes, and snippets.

@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 / 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)
//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 / 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;
@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: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
This file has been truncated, but you can view the full file.
BASEDIR: /home/ben/openscad_deps
DEPLOYDIR: /home/ben/openscad_deps
PATH modified
LD_LIBRARY_PATH modified
LD_RUN_PATH modified
OPENSCAD_LIBRARIES modified
GLEWDIR modified
Please re-run qmake-qt4 and run 'make clean' if necessary
Note: The NUMCPU environment variable can be set for paralell builds
Using basedir: /home/ben/openscad_deps
ben@ben-desktop:~$ dpkg --list | grep boost
ii libboost-all-dev 1.49.0.1 amd64 Boost C++ Libraries development files (ALL) (default version)
ii libboost-chrono-dev 1.49.0.1 amd64 C++ representation of time duration, time point, and clocks (default version)
ii libboost-chrono1.49-dev 1.49.0-3.1ubuntu1.1 amd64 C++ representation of time duration, time point, and clocks
ii libboost-chrono1.49.0 1.49.0-3.1ubuntu1.1 amd64 C++ representation of time duration, time point, and clocks
ii libboost-date-time-dev 1.49.0.1 amd64 set of date-time libraries based on generic programming concepts (default version)
rc libboost-date-time1.42.
$ dpkg --list | grep boost-thread
ii libboost-thread-dev 1.49.0.1 amd64 portable C++ multi-threading (default version)
ii libboost-thread1.42.0 1.42.0-4ubuntu2 amd64 portable C++ multi-threading
rc libboost-thread1.46.1 1.46.1-7ubuntu3 amd64 portable C++ multi-threading
ii libboost-thread1.49-dev 1.49.0-3.1ubuntu1.1 amd64 portable C++ multi-threading
ii libboost-thread1.49.0 1.49.0-3.1ubuntu1.1 amd64 portable C++ multi-threading
ben@ben-desktop:~$ dpkg --list | grep boost
ii libboost-all-dev 1.49.0.1 amd64 Boost C++ Libraries development files (ALL) (defaul
DEBUG:root:UNKNOWN PTP Property d105 changed
DEBUG:root:UNKNOWN PTP Property d108 changed
DEBUG:root:UNKNOWN PTP Property d106 changed
DEBUG:root:UNKNOWN PTP Property d107 changed
DEBUG:root:UNKNOWN PTP Property d109 changed