Skip to content

Instantly share code, notes, and snippets.

@kelsey-sorrels
kelsey-sorrels / markov.clj
Created September 6, 2012 04:46
Overtone Internal Sequencer with Markov chains
(ns overtone.examples.internal-sequencer
(:use [overtone.live]))
;; A fully server-side sample sequencer.
;; =====================================
;; This example demonstrates some of the benefits of moving all synth
;; triggers inside the server itself. For example, it allows you to
;; modify the synthesis with *immediate* effect (rather than waiting for
;; the next bar/chunk to be scheduled) and you can use a global pulse to
@kelsey-sorrels
kelsey-sorrels / gist:3936750
Created October 23, 2012 04:46
rSimulate GeoJSON example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kelsey-sorrels
kelsey-sorrels / gist:3939096
Created October 23, 2012 14:34
rSimulate GeoJSON Draft

Purpose

To define a common data language for applications that simulate entire worlds. When many applications speak the same language, an ecosystem develops that is often more than the sum of its parts.

General

  • All data is UTF-8 encoded.
  • MIME type is application/json
@kelsey-sorrels
kelsey-sorrels / gist:3944237
Created October 24, 2012 05:35
GeoJSON example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* A Processing implementation of izhikevich spiking neural network.
* http://www.izhikevich.org/publications/spikes.pdf
* By Aaron Santos
*/
import java.util.Set;
import java.util.HashSet;
import org.dishevelled.processing.executor.Executor;
import java.util.concurrent.TimeUnit;
@kelsey-sorrels
kelsey-sorrels / LWJGL3Test.java
Created June 1, 2016 02:23
Java translation of Clojure code
package example;
import org.lwjgl.BufferUtils;
import org.lwjgl.stb.STBTruetype;
import org.lwjgl.stb.STBTTFontinfo;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.channels.FileChannel;
@kelsey-sorrels
kelsey-sorrels / core.clj
Created June 4, 2016 04:12
Clojure TTF
(ns ttftest.core
(:require
[taoensso.timbre :as log]
[clojure.java.io :as jio])
(:import
(java.nio ByteBuffer)
(org.lwjgl BufferUtils)
(org.lwjgl.system MemoryStack)
(org.lwjgl.stb STBTruetype STBTTFontinfo)
(org.apache.commons.io IOUtils)))
@kelsey-sorrels
kelsey-sorrels / Main.scala
Created June 18, 2016 03:00
For/yield followed by match
import scala.util.{Try, Success, Failure}
// Where this syntax scans
(for {
x <- Try("3".toInt)
y <- Try("4".toInt)
} yield {
x + y
}) match {
case Success(n) => println(n)
@kelsey-sorrels
kelsey-sorrels / gmm.scala
Last active July 6, 2017 15:58
GMM Identical Clusters
import org.apache.spark.SparkContext
import org.apache.spark.rdd._
import org.apache.spark.mllib.clustering.GaussianMixture
import org.apache.spark.mllib.linalg.{Vector, Vectors}
def sparkContext: SparkContext = {
import org.apache.spark.SparkConf
new SparkContext(new SparkConf().setMaster("local[*]").setAppName("console"))
}
@kelsey-sorrels
kelsey-sorrels / gist.scala
Last active January 19, 2018 12:41
Shapeless Recursive Coproduct
import matryoshka._
import matryoshka.data._
import matryoshka.implicits._
import shapeless._
type SF[A] = Boolean :+: Int :+: String :+: List[A] :+: Map[String, A] :+: CNil
val v0 = Coproduct[SF[Nothing]](1)