Playing with unsafe can be quite fun.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn branch | |
"A recursive branching tree structure with half-cylinder flowers." | |
[level] | |
(if (= 0 level) | |
[(length 1.5) cylinder] | |
[(angle (fn [_] (m/random 3 5))) ry- | |
(length (fn [t] (* (m/random 0.75 1.5) (or (:last-length t) 1.5)))) | |
(map (fn [[a b]] (concat (take 8 (cycle [a b])) (branch (dec level)))) | |
[[ry line] [ry- line] [rx line] [rx- line]])])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn grow [pos rot points len] | |
(let [[x y z] (last rot) ;; :( no M33 and no (g/rotate-xyz _ (vec3 x y z)) | |
corners (map #(-> % (g/rotate-x x) (g/rotate-y y) (g/rotate-z z) (g/+ (last pos))) | |
[(vec3 0 0 0) (vec3 -1 0 0) (vec3 0 -1 0) (vec3 0 1 0) | |
(vec3 -1 0 len) (vec3 0 -1 len) (vec3 0 1 len) (vec3 0 0 len)])] | |
[(conj (pop pos) (last corners)) | |
rot | |
(conj points (map gu/tessellate-3 (g/faces (apply cub/cuboid corners))))])) | |
(defn build-lsystem [l-system angle len] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A script to collect (conserve? steal?) Constant Dullaart's "war" web pages | |
# See: https://twitter.com/constantdull/status/785797564167839744 | |
# Usage: ./war_collector.sh | |
start_from="war.repair" | |
if [ ! -d src ] ; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w/ speed up or slow down: | |
ffmpeg -i INPUT -crf 14 -vf "scale=640:640, setpts=1.0*PTS" -c:a copy -tune grain OUTPUT | |
(adjust crf for compression amount and 1.0*PTS for speed up / down) | |
w/out speed up: | |
ffmpeg -i INPUT -crf 14 -filter:v scale=640:640 -c:a copy -tune grain OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- channel from ofLog | |
- padding from ofLog | |
- nanosThen from ofFpsCounter | |
- secsThen from ofFpsCounter | |
- _mutexBlocks from ofThread | |
- _threadRunning from ofThread | |
- threadBeingWaitedFor from ofThread | |
- prevValue from ofParameter::Value | |
- document from ofXml | |
- element from ofXml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int seed = int(random(999999)); | |
void setup() { | |
size(960, 960, P2D); | |
smooth(8); | |
pixelDensity(2); | |
rectMode(CENTER); | |
generate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
These are the helper functions to store and to restore a 2D vector with a custom 16 floating point precision in a texture. | |
The 16 bit are used as follows: 1 bit is for the sign, 4 bits are used for the exponent, the remaining 11 bit are for the mantissa. | |
The exponent bias is asymmetric so that the maximum representable number is 2047 (and bigger numbers will be cut) | |
the accuracy from 1024 - 2047 is one integer | |
512-1023 it's 1/2 int | |
256-511 it's 1/4 int and so forth... | |
between 0 and 1/16 the accuracy is the highest with 1/2048 (which makes 1/32768 the minimum representable number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isFunction = function(obj) { | |
return typeof obj == 'function' || false; | |
}; | |
class EventEmitter { | |
constructor() { | |
this.listeners = new Map(); | |
} | |
addListener(label, callback) { | |
this.listeners.has(label) || this.listeners.set(label, []); |
OlderNewer