This file contains hidden or 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 my-filter-cons | |
"Filter a sequence, implemented with reduce and cons" | |
[pred sequence] | |
(reduce (fn [seq x] | |
(if (pred x) (cons x seq) seq)) '() sequence)) | |
(defn my-filter-conj | |
"Filter a sequence, implemented with reduce and conj" | |
[pred sequence] | |
(reduce (fn [seq x] |
This file contains hidden or 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
;;Excerpt "Clojure for the Brave and True" by Daniel Higginbotham: | |
;;"If you want an exercise that will really blow your hair back, try implementing map using reduce..." | |
;;This actually took me a really long time to come up with, have to keep thinking about how reduce expands to (fn (fn (fn... | |
;;Tried cons first, but couldn't figure it out - needed to think about the order arguments are applied in within the anonymous | |
;;function AND the order of arguments for reduce. That was more obvious after I tried using conj | |
(defn my-map-conj | |
"map implemented in terms of reduce and conj" | |
[f coll] |
This file contains hidden or 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
function timer(){ | |
var fivePM = new Date(); | |
fivePM.setHours(17); | |
fivePM.setMinutes(0); | |
fivePM.setSeconds(0); | |
var startTime = Date.now(); | |
var secondsTilEOD = Math.floor((fivePM.getTime() - startTime) / 1000); | |
var secondsLeft = secondsTilEOD; | |
var secondsElapsed = 0; | |
function tick(){ |
This file contains hidden or 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 | |
#map laptop's touch screen to appropriate display (the laptop screen) | |
TOUCH_ID=`xinput list | grep SYNAPTIC | awk -F '\t' '{print $2}' | cut -c 4-` | |
xinput --map-to-output $TOUCH_ID eDP1 |
This file contains hidden or 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/bash | |
if [ -n "`jack_control status | grep started`" ] | |
then | |
echo "jack already started, stopping it..." | |
jack_control stop | |
else | |
echo "let's get this owl hootin'" | |
jack_control eps realtime true | |
jack_control ds alsa |
This file contains hidden or 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
#Rule to run script when Arduino Uno is connected | |
KERNEL=="ttyACM0",ACTION=="add",RUN+="/path/to/script" |
This file contains hidden or 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
( | |
SynthDef(\sineGrain, {|out, freq=440, sustain=0.02, amp=0.1, pan| | |
var wavetable = Buffer.alloc(s, 512, 1, { |buf| buf.chebyMsg([1,0,1,1,0,1])}); | |
var env = EnvGen.ar(Env.sine(sustain, amp), doneAction: 2); | |
var sound = SinOsc.ar(freq) * env; | |
sound = Shaper.ar(wavetable, sound) * 0.1; | |
Out.ar(out, Pan2.ar(sound, LFNoise1.kr(40, 2, -1))) | |
}).add; | |
SynthDef(\verb, { arg outBus = 0, inBus; |
This file contains hidden or 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
import gab.opencv.*; | |
import org.opencv.imgproc.Imgproc; | |
import org.opencv.core.Core; | |
import org.opencv.core.MatOfPoint; | |
import org.opencv.core.MatOfPoint2f; | |
import org.opencv.core.Point; | |
import org.opencv.core.Size; | |
import org.opencv.core.Mat; |
NewerOlder