Skip to content

Instantly share code, notes, and snippets.

View aperiodic's full-sized avatar

Dan Lidral-Porter aperiodic

  • BlackBerry
  • Seattle, WA
View GitHub Profile
@aperiodic
aperiodic / quil-kinect.core.clj
Created April 13, 2012 09:12
Classloader changes between defsketch and setup
(ns quil-kinect.core
(import SimpleOpenNI.SimpleOpenNI)
(:use quil.core
[quil.applet :only [current-applet applet-close]]))
(def kinect (atom nil))
(defn setup []
(let [_ (println (.getClassLoader clojure.lang.IDeref))
kinect-obj (new SimpleOpenNI (current-applet))
@aperiodic
aperiodic / boxplots.clj
Created August 18, 2012 08:07
Visual Marginalia Example Usage if I Made All the Decisions
(ns c2-cljs-examples.boxplots
(:use-macros [c2.util :only [bind!]])
(:require [c2.core :as c2]
[c2.event :as event]
[c2.scale :as scale]
[c2.svg :as svg])
(:use [c2.maths :only [extent]]))
(defn crisp
"This makes things look nice and sharp using a magic SVG attribute."
@aperiodic
aperiodic / Error & Trace
Created August 18, 2012 22:39
Singult Lazy Sequence Bug Example
Uncaught TypeError: Object div.child,[object Object] has no method 'match' main.js:25735
singult.coffee.canonicalize_hiccup main.js:25735
singult.coffee.canonicalize main.js:25725
(anonymous function) main.js:25751
singult.coffee.canonicalize_hiccup main.js:25744
singult.coffee.canonicalize main.js:25725
merge_BANG_ main.js:26213
bug main.js:28309
goog.events.Listener.handleEvent main.js:27214
goog.events.fireListener main.js:27548
@aperiodic
aperiodic / mountains.clj
Created December 3, 2012 00:48
C2P0 Problem
(ns examples.mountains
(:require [c2po.core :refer [c2po]]
[c2po.geom :as geom]
[c2po.scale :as scale]
[c2po.livereload-server :refer [render!]]))
(def animals
;; episode 2: mountains
{:gelada-baboon {:pop 200000, :child-rate 0.5, :unit 15}
:walia-ibex {:pop 500, :child-rate 1, :unit 10}
@aperiodic
aperiodic / leds.cpp
Created December 14, 2012 19:26
Driving a 5x5 RGB LED grid with 5-bit PWM using only some shift registers, a demuxer, and a timer interrupt.
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#define __spi_clock 13 // SCK - hardware SPI
#define __spi_latch 10
#define __spi_data 11 // MOSI - hardware SPI
#define __spi_data_in 12 // MISO - hardware SPI (unused)
#define __brightness_levels 32 // 0...15 above 28 is bad for ISR ( move to timer1, lower irq freq ! )
#define __max_brightness __brightness_levels-1
@aperiodic
aperiodic / gist:8358814
Created January 10, 2014 17:35
My work machine public key.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfXZDic/NA+CUb5poRGpSOLct5T5rNaXeRuPvGeGWZkH05c4FvvpUbCjT/OEHYJzgsJI99iCTKvusC9oG5uSKPYT/7p8m+vWvhX3wyT0zOhuyDMuGIMeWq6JYEqUhMi180Z/tn/Pl3gDXD7nGGi7lwu4BgDoHw+bpBjutXzToCqxTsagOOxVcGi+Gv/SOXGeXH/18nxThJNkffoQmGSVbeTymuxa73n5dfwl/HEfeAj/JaZ30gb+6b8+hO/JyZdgit7+FJHaw+OipuwdA/G2FzYKOfCCzbAURMJqpZy8XLiV5VxVorgKOWerYeXqw01mjWoNp7/gkIH085w4T0XUdz [email protected]
@aperiodic
aperiodic / fizzbuzz.clj
Created November 14, 2014 19:19
Fizzbuzz Without if, when, and, or, or predicates.
(ns conditionless-fizzbuzz.core)
(defn if-divisible-by-n
[n then-fn else-fn]
(fn [x]
(let [remainder (mod x n)
chosen-fn ({0 then-fn} remainder else-fn)]
(chosen-fn x))))
(def fizzbuzzer
@aperiodic
aperiodic / transform.clj
Created December 12, 2014 19:37
transform-n
(defn transform-n
[n words]
(->> words
(partition n 1)
(reduce (fn [acc [w next-w]]
(update-in acc
[w next-w]
(fnil inc 0)))
{})))
@aperiodic
aperiodic / gist:8bef823d038cdfbd57dd
Created January 12, 2015 00:28
Traceroute to duckduckgo, 2015-1-11 16:28 UTC-8
traceroute to ddg.gg (96.45.82.53), 30 hops max, 60 byte packets
1 gateway (192.168.1.1) 1.199 ms 3.065 ms 4.014 ms
2 96.120.60.193 (96.120.60.193) 19.886 ms 19.903 ms 20.948 ms
3 xe-11-3-1-0-sur04.troutdale.or.bverton.comcast.net (68.85.150.213) 21.460 ms 21.511 ms 21.886 ms
4 ae-53-0-ar03.troutdale.or.bverton.comcast.net (68.87.222.197) 21.205 ms 21.273 ms 78.964 ms
5 he-2-2-0-0-10-cr01.seattle.wa.ibone.comcast.net (68.86.95.97) 29.863 ms pos-2-3-0-0-cr01.newyork.ny.ibone.comcast.net (68.86.94.233) 29.110 ms 28.145 ms
6 he-0-6-0-0-cr01.350ecermak.il.ibone.comcast.net (68.86.88.154) 30.536 ms 22.994 ms 17.981 ms
7 ix-0-2-2-0.tcore1.00S-Seattle.as6453.net (64.86.123.9) 17.206 ms 17.879 ms 17.134 ms
8 if-0-0-0-2.core1.00S-Seattle.as6453.net (64.86.123.2) 39.976 ms if-13-0-0-4.core1.00S-Seattle.as6453.net (64.86.124.13) 40.301 ms if-1-0-0-3.core1.00S-Seattle.as6453.net (64.86.123.6) 40.398 ms
9 if-5-1-0-0.tcore2.CT8-Chicago.as6453.net (206.82.141.9) 104.992 ms 105.976
@aperiodic
aperiodic / pt-frf-results.txt
Created February 9, 2015 08:57
PT FRF Metagame & Winning Record Conversion rates (WRC)
Top Decks:
Aggro / Midrange:
Affinity - 8
Burn - 18
BW Tokens - 2
Hate Bears - 1
Jeskai Tempo - 1
Junk - 33
Jund - 1
Merfolk - 3