Skip to content

Instantly share code, notes, and snippets.

View dmichael's full-sized avatar

David Michael dmichael

View GitHub Profile
# Make.believe
# A class that creates any class real just by believing.
class Make
class << self
def believe(dream)
classify(dream)
realize(dream)
end
pcm.dmix51 {
type dmix
ipc_key 1024
ipc_key_add_uid false
ipc_perm 0666
slave {
pcm "hw:1,0"
channels 6
period_time 0
period_size 1024
dmichael@ubuntu:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AudioPCI [Ensoniq AudioPCI], device 0: ES1371/1 [ES1371 DAC2/ADC]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AudioPCI [Ensoniq AudioPCI], device 1: ES1371/2 [ES1371 DAC1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Aureon51MkII [Aureon5.1MkII], device 0: USB Audio [USB Audio]
dmichael@ubuntu:~$ aplay -L
pulse
Playback/recording through the PulseAudio sound server
front:CARD=AudioPCI,DEV=0
Ensoniq AudioPCI, ES1371 DAC2/ADC
Front speakers
rear:CARD=AudioPCI,DEV=0
Ensoniq AudioPCI, ES1371 DAC1
Rear speakers
# Add Scala and bin directory to your PATH
SCALA_HOME=/Users/dmichael/bin/scala
PATH=$SCALA_HOME/bin:$HOME/bin:$PATH
$ mkdir -p ~/bin && cd ~/bin
$ cp ~/Downloads/scala-2.8.0.final ~/bin
$ ln -s scala-2.8.0.final scala
module ROXML
class XMLHashRef
def update_hash(hash, instance)
raise "not implemented"
end
end
class XMLAttributeRef
def update_hash(hash, instance)
ap self.class
@dmichael
dmichael / gist:1299158
Created October 19, 2011 18:08
Link gnuplot
sudo ln -s /Applications/GnuPlot.app/Contents/Resources/bin/gnuplot /usr/bin/gnuplot
x = linspace(-pi, pi, 100);
y = sin(x);
plot(x, y);
@dmichael
dmichael / gist:1329765
Created November 1, 2011 03:14
logistic-regression-cost.m
function [J, grad] = costFunction(theta, X, y)
% Logistic Regression cost function and partial derivative (gradient)
m = length(y); % number of training examples
cost = (y' * log(h)) + ((1-y')*log(1-h));
J = -1/m * cost;
grad = 1/m * (X' * (h - y));