Skip to content

Instantly share code, notes, and snippets.

int length = 50;
Mouche[] mouches = new Mouche[length];
void setup() {
size(500, 500);
int i;
for(i = 0; i < length; i++) {
mouches[i] = new Mouche();
@Becojo
Becojo / gist:10006713
Created April 6, 2014 14:15
Reverse polish notation
(ns rpn
(:use clojure.test))
(defn rpn [expr]
(first (reduce
(fn [stack n]
(if (fn? n)
(cons (n (second stack) (first stack))
(drop 2 stack))
(cons n stack)))
@Becojo
Becojo / adsf.pde
Last active August 29, 2015 14:01
Something something
float r = 0;
PVector pos = new PVector(0, 0);
void setup() {
size(screen.width, screen.height);
}
void draw() {
translate(pos.x, pos.y);
rotate(r);
@Becojo
Becojo / gist:35e0e314ef9f0d0189ed
Created August 16, 2014 20:55
Simple template to render a 3D path using cylindrical coordinates in Processing
float resolution = TWO_PI / 360.0;
int scale = 150;
void setup() {
size(500, 500, P3D);
smooth();
noFill();
strokeWeight(10);
}

Hello

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

void setup() {
	size(500, 200);
}

void draw() {
@Becojo
Becojo / pwm.R
Created October 9, 2014 23:17
Probability weighted moments
pwm <- function(sample, r = 0) {
n <- length(sample)
sorted <- sort(sample)
j <- (r+1):n
sum(choose(j - 1, r) * sorted[j]) / (choose(n - 1, r) * n)
}
@Becojo
Becojo / chol22.R
Created October 9, 2014 23:27
2x2 Cholesky decomposition
chol22 <- function(A) {
stopifnot(length(A) == 4)
a <- sqrt(A[1,1])
b <- A[1,2] / a
c <- sqrt(A[2,2] - b^2)
matrix(c(a, 0, b, c), ncol=2)
}
@Becojo
Becojo / Readme.md
Created October 16, 2014 22:27
proce5.in not found

Not found

What does it mean? Are you perhaps lost?

sed '
s/^>//
t
s/^ *$//
t
s/^/-- /
' in.lhs > out.hs
// Very Smooth
// BCJ - 2014
// http://log.becojo.me/post/106249890689
int n = 360;
float a = TWO_PI / n,
d = 150,
z = 100,
p = 50,
v = 2,