Skip to content

Instantly share code, notes, and snippets.

View philandstuff's full-sized avatar

Philip Potter philandstuff

View GitHub Profile
@philandstuff
philandstuff / tarai.clj
Created December 7, 2011 07:16 — forked from kawabata/tarai.clj
tarai mawashi in overtone
(ns tarai.core
(:use [overtone.live])
(:use [clojure.algo.monads :only [state-t cont-m run-cont domonad]]))
(def m (metronome 400))
;; basic.clj より
(defsynth foo [freq 200 dur 0.5]
(let [src (saw [freq (* freq 1.01) (* 0.99 freq)])
low (sin-osc (/ freq 2))
@philandstuff
philandstuff / gist:1579755
Created January 8, 2012 21:25 — forked from samaaron/gist:1377020
Mostly Lazy Satie Bumper
(ns polynome-satie.core
(:use [clojure.core.match :only [match]]
[polynome core launchpad]
[overtone.live]
[overtone.inst sampled-piano]))
;;Erik Satie Gnossienne No. 1
(def phrase1a [:v :vii :vi# :v :v :iv# :v :iv#])
(def phrase1b [:v :vii :vi# :v :vii# :i+ :vii# :i+])
(def phrase1c [:v :vii :vi# :v :v :iv# :iii :ii :i :ii :i :ii :iii :ii :ii :i])
@philandstuff
philandstuff / gist:1579825
Created January 8, 2012 21:48 — forked from samaaron/gist:1309367
Simple coordinated ping mechanism - only plays the ping if two buttons are pressed at the "same" time
(ns examples.coordination
(:use [overtone.live]
[overtone.inst.synth])
(:require [polynome.core :as poly]))
;;ping
(def m (poly/init "/dev/tty.usbserial-m64-0790"))
(poly/on-press m (fn [x y s]
@philandstuff
philandstuff / definst_star.clj
Created February 14, 2012 07:28
Composable insts
(ns definst2.core
(:use [overtone.core]))
(defmacro definst* [name params & form]
(let [cgen-name (symbol (str name "-cgen"))
param-list (partition 2 params)
cgen-params (vec (mapcat (fn [[name default-val]] [name {:default default-val :doc ""}]) param-list))]
`(do
(definst ~name ~params ~@form)
(defcgen ~cgen-name ~cgen-params
@philandstuff
philandstuff / neo_loading.rb
Created June 10, 2012 12:51 — forked from mneedham/neo_loading.rb
Loading stuff into neo via the batch API
# So the problem is inserting data into neo using the batch API. So we have a bunch of people and we want to put them into the graph and also
# add to to the index so that we can search for them.
# The way the batch API works is that you can refer to previous commands by referencing their index in the list of commands (zero indexed)
# e.g. if I want to reference the person added in the first command I would reference that node as {0}
# You should be able to see how that works in the code below.
neo_people_to_load = Set.new
neo_people_to_load << { :name => "Mark Needham", :id => 1 }
neo_people_to_load << { :name => "Jenn Smith", :id => 2 }
neo_people_to_load << { :name => "Chris Ford", :id => 3 }
@philandstuff
philandstuff / haproxy-statsd.rb
Created October 8, 2012 09:34
script to pump haproxy stats into statsd
#!/usr/bin/ruby
require 'socket'
HOSTNAME = `facter hostname`.chomp
SOCKET = UDPSocket.new
IO.popen(["curl","http://localhost:8000/haproxy;csv"]) do |haproxy_csv|
header_line = haproxy_csv.gets
header_line.gsub!(/# /,'')
HEADERS = header_line.split(/,/)[0..-2]
@philandstuff
philandstuff / 99-bottles.pl
Created March 18, 2013 14:14
perl 99 bottles of beer
@a=(@b=(++$a,bottle.$&,of,beer),on,the,wall),s/^/
Take one down and pass it around, @a.
@a, @b./,/s/until/
99/;print"99$'
Go to the store and buy some more, @a."
@philandstuff
philandstuff / project.clj
Created June 18, 2013 14:23
project.clj for vcloud-director with pallet
(defproject pallet-tmp "0.1.0-SNAPSHOT"
:description "FIXME Pallet project for pallet-tmp"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.cloudhoist/pallet "0.7.4"]
[org.cloudhoist/pallet-jclouds "1.5.2"]
;; To get started we include all jclouds compute providers.
;; You may wish to replace this with the specific jclouds
;; providers you use, to reduce dependency sizes.
[org.jclouds/jclouds-allblobstore "1.5.5"]
[org.jclouds/jclouds-allcompute "1.5.5"]
@philandstuff
philandstuff / russ-garrett.org
Created March 7, 2014 15:53
russ garrett talking about postgres

russ garrett on postgres

  • I like it as a default database when I don’t know what database I want to use

schemas

  • I like schemas and I hate schemaless databases
  • it’s useful to be able to enforce your schema before the data gets written to disk
    • rather than in your ORM!
    • CHECK constraints: ensure balance >= 0

schema changes often aren’t great

  • this is why people don’t like schemas
@philandstuff
philandstuff / scale-summit.org
Last active August 29, 2015 13:57
scale-summit 2014

Scale Summit 2014

Intro, MBS

ideas for sessions

  • bootstrapping environments (without object stores)
  • service discovery
  • removing spofs