Skip to content

Instantly share code, notes, and snippets.

View jamesdavidson's full-sized avatar

James Davidson jamesdavidson

View GitHub Profile
@jamesdavidson
jamesdavidson / README.md
Last active August 29, 2015 13:57 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

{-# OPTIONS -Wall #-}
module Main where
import Control.Concurrent (threadDelay)
import System.Environment (getArgs)
import System.INotify
main :: IO ()
main = do
@jamesdavidson
jamesdavidson / microphone.clj
Last active April 13, 2020 16:20 — forked from BurkeB/microphone.clj
Microphone Clojure test
(import
[javax.sound.sampled TargetDataLine AudioFormat AudioSystem AudioInputStream AudioFileFormat$Type DataLine$Info]
[java.io File ByteArrayInputStream])
(def audio-format (new AudioFormat 44100 16 2 true true))
(def info (new DataLine$Info TargetDataLine audio-format))
(assert (AudioSystem/isLineSupported info))
(def line (AudioSystem/getTargetDataLine audio-format))
(.open line)
(.start line)