Skip to content

Instantly share code, notes, and snippets.

View Akai APC Key 25.json
{
"groups": [
{
"rows": 5,
"cols": 8,
"position": [ 0, 0 ],
"dimensions": [30, 18],
"spacing": [36, 24],
"controls": [32, 33, 34, 35, 36, 37, 38, 39,
24, 25, 26, 27, 28, 29, 30, 31,
View creativity.clj
(ns tree-search.creativity
(:require [tree-search.concept-net :as cn]
[com.rpl.specter :as sp]))
(def creativity
'{produces [forms {novel? {always P-creative
sometimes H-creative}
value? hopefully
by [combining knowledge]}]
@triss
triss / Markov.java
Last active Feb 7, 2017
Markov models
View Markov.java
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Random;
public class Markov<E> {
// we'll need a random number generator
Random random;
@triss
triss / core.clj
Created Feb 3, 2017
Markov model's in Clojure
View core.clj
(ns markov.core
(:require [clojure.java.io :as io]
[clojure.string :as str]
[clojure.pprint :refer [pprint]]))
(defn count-n-gram
"Updates count of number of time n-gram has been seen in map."
[m n-gram] (update-in m n-gram #(inc (or % 0))))
(defn next-word
@triss
triss / core.clj
Last active Nov 25, 2016
Getting ranges from specs...
View core.clj
;; Specs for matching
(defn- fn-wrapped-spec
[spec]
(s/spec (s/cat :fn #{'clojure.core/fn}
:args #{['%]}
:form (s/spec spec))))
(s/def ::int-in-range?-form
(s/cat :fn #{'clojure.spec/int-in-range?}
@triss
triss / core.clj
Created Oct 13, 2016
IDEA implimentation
View core.clj
(ns idea.core)
(defn rand-audience
"Generates a random audience with n members."
[n] (repeatedly n (fn [] {:well-being (dec (rand 2))
:effort (rand)})))
(defn measure-audience
"apply f to every item in audience, and average and weight the result."
[weight f audience]
@triss
triss / pitch-amp-osc-fwd.sc
Created May 9, 2016
Pitch/amp following OSC forwarder
View pitch-amp-osc-fwd.sc
// Pitch follower SynthDef
SynthDef.new(\pitchFollower, {
var amp, freq, hasFreq;
var input;
var osc;
var oscTrigger;
input = SoundIn.ar(0);
amp = Amplitude.kr(input);
#freq, hasFreq = Pitch.kr(input);
@triss
triss / gist:52adf56989ce0123011d
Created Feb 3, 2015
Clojure errors with 0.2.2
View gist:52adf56989ce0123011d
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
registering src/cljx [:create :modify]
registering src/cljx/rum-xox [:create :modify]
registering src/cljs [:create :modify]
registering src/cljs/rum_xox [:create :modify]
registering src/cljs/rum_xox/ui [:create :modify]
registering src/clj [:create :modify]
registering src/clj/rum_xox [:create :modify]
sending change event
watch service closed
View gist:5e6ea6885c1a92698c99
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
registering src/cljx [:create :modify]
registering src/cljx/rum-xox [:create :modify]
registering src/cljs [:create :modify]
registering src/cljs/rum_xox [:create :modify]
registering src/cljs/rum_xox/ui [:create :modify]
registering src/clj [:create :modify]
registering src/clj/rum_xox [:create :modify]
sending change event
watch service closed
@triss
triss / gist:16df998b1230209d6d2a
Created Feb 3, 2015
CLJX namespace can't be found from ClojureScript
View gist:16df998b1230209d6d2a
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
registering src/cljx [:create :modify]
registering src/cljx/rum-xox [:create :modify]
registering src/cljs [:create :modify]
registering src/cljs/rum_xox [:create :modify]
registering src/cljs/rum_xox/ui [:create :modify]
registering src/clj [:create :modify]
registering src/clj/rum_xox [:create :modify]
sending change event
watch service closed