Skip to content

Instantly share code, notes, and snippets.

View mattearnshaw's full-sized avatar

Matt Earnshaw mattearnshaw

View GitHub Profile
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
@mattearnshaw
mattearnshaw / gist:6f1525d580e7fc966fac
Last active August 29, 2015 14:14
Parkinson Cuts
/* Contributions from B0s→φµ+µ−decays
Candidates are rejected if
- 5321<mK(π→K)µµ<5411MeV/c2 and either:
- 1010<mK(π→K)<1030MeV/c2 and the pion satisfies DLLKπ>−10;
- or 1030<mK(π→K)<1075MeV/c2 and the pion satisfies DLLKπ>10. */
RooFormulaVar B0stoPhimm("B0stoPhimm", "!((5321<@0<5411) && "
"((1010<@1<1030 && @2>-10) ||"
"(1030<@1<1075 && PI_PIDK>10)))",
RooArgList(B0_MM, B0_kpiswapMass, Pi_PIDK));
(def scaffold (load-sample "scaffold.flac"))
(def park (load-sample "hyde-park.flac"))
(def valetta (load-sample "valettasnip.flac"))
(def buf1 (buffer 2048))
(def buf2 (buffer 2048))
(definst spectralblend [buf-a 0 buf-b 1 hold-time 60 x-over-time 10]
(let [amp1 2.5
amp2 1.4540 ; magic numbers for amplitude correction
@mattearnshaw
mattearnshaw / gist:ba3928a256d55341e288
Created July 20, 2015 12:49
kraehenbuehl harmonizing algorithm
(ns kraehenbuehl.core
(:require [leipzig.scale :as scale]
[leipzig.chord :refer [root triad inversion]]
[overtone.music.pitch :refer [find-note-name]]))
;eg. (kraehenbuehl (comp scale/G scale/major) [62 64 62 60 59])
;=> ((43 55 59 62) (52 55 59 64) (47 54 59 62) (38 54 57 60) (43 50 55 59))
(declare pitch-class)
(declare triad-with-top)
@mattearnshaw
mattearnshaw / viz.pde
Last active July 9, 2016 14:14
schizviz
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput output;
MultiChannelBuffer buf;
AudioRecordingStream stream;
FilePlayer player;
(ns music.so-empty-forms
(:use [overtone.live]))
(declare fade-envelope)
(declare line-osc)
; Six Empty Forms (for Agnes Martin) – Mark So (2006)
(definst I []
(let [t (* 22 60)]
(ns music.chord-catalogue
(:use [overtone.live] [overtone.inst.piano]
[clojure.math.combinatorics :only [combinations]]))
(declare gen-chords)
(declare play-chord-seq)
; The Chord Catalogue - Tom Johnson
(def chord-catalogue
(mapcat (partial gen-chords 4) (range 2 14)))
(ns quil-site.examples.tree
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]))
(def grid-spacing 20)
(def copies 5)
(defn setup []
(q/no-smooth)
(q/background 255)
// white
$('body').css('background', 'white');
$('.nav-tabs > li > a').css('background', 'rgba(211,211,211,0.5)');
$('.activeExperiment').css('background-color', 'rgba(84, 32, 0, 0.2)');
$('.nthTr').css('background', 'rgba(71, 58, 51, 0.8)');
$('.dropDownButtonContainer').css('background', 'rgba(211,211,211,0.5)');
$('#experiments, #console').css('background', 'rgba(211,211,211,0.8)');
$('.btn').css('background', 'rgb(211,211,211)');
$('.ui-dialog').css('background', 'white');
// in src/main/webapp/js/components/interface/3dCanvas/ThreeDEngine.js
create3DCylinderFromNode: function (cylNode, material, radiusMultiplier) {
+
+ if (radiusMultiplier === undefined) radiusMultiplier = 1
var bottomBasePos = new THREE.Vector3(cylNode.position.x, cylNode.position.y, cylNode.position.z);
var topBasePos = new THREE.Vector3(cylNode.distal.x, cylNode.distal.y, cylNode.distal.z);
@@ -978,6 +982,7 @@ define(['jquery'], function () {
var midPoint = new THREE.Vector3();