Skip to content

Instantly share code, notes, and snippets.

View briansorahan's full-sized avatar
🎯
Focusing

Brian Sorahan briansorahan

🎯
Focusing
View GitHub Profile
@briansorahan
briansorahan / ubuntu-install-chuck
Created February 25, 2013 22:50
bash script to install ChucK on ubuntu systems
#!/bin/bash
main() {
# exit if not root
if [ $(id -u) -ne 0 ]; then
echo "This installer must be run as root."
exit 4
fi
# install deps
apt-get install g++ bison flex libasound2-dev libjack-jackd2-dev
@briansorahan
briansorahan / zml
Last active December 24, 2015 06:29
run magic lantern bash files to enfuse images
#!/bin/bash
# Run magic lantern bash files
function run_scripts {
local -i n=$1; shift
local scripts="$@"
while [[ $(echo $scripts | tr ' ' '\n' | wc -l) -gt $n ]]
do
local head=$(echo $(echo $scripts | tr ' ' '\n' | head -"$n"))
@briansorahan
briansorahan / unmute-alsa
Created September 30, 2013 03:00
unmute-alsa-mixer
#!/bin/bash
function main {
local card="$1"; shift
local vol="$1"; shift
for n in 0 1 2 3 4 5 6 7 8 9
do
amixer -c $card sset Multi,$n ${vol}%,${vol}% unmute
done
}
@briansorahan
briansorahan / mkcd
Created October 1, 2013 15:08
bash alias for a 'mkcd' command which creates a dir and cd's into it
mkcd() { mkdir -p "$@" && cd "$@"; }
@briansorahan
briansorahan / rsudo
Created October 2, 2013 19:09
Expect script to execute commands over ssh. e.g. $ rsudo brian@10.50.50.34 mypassword cat /etc/passwd
#!/usr/bin/env expect
set login [lindex $argv 0]
set password [lindex $argv 1]
set cmd [lrange $argv 2 end]
spawn ssh $login
expect {
"assword:" {
@briansorahan
briansorahan / rscp
Created October 3, 2013 16:07
Use expect to automate scp with password
#!/usr/bin/env expect
set timeout 120
set login [lindex $argv 0]
set password [lindex $argv 1]
set f [lindex $argv 2]
set r [lindex $argv 3]
spawn scp $f $login:$r
@briansorahan
briansorahan / read_packet.c
Created October 13, 2013 22:02
Read a MIDI SDS data packet
static int
read_packet(midi_t midi,
unsigned char *buf,
unsigned int channel_num,
unsigned int modded_packet_num,
err_t err) {
const int checksum_byte = 125;
const time_t timeout_sec = 1;
int raw_bytes_read, bytes_read;
char strbuf[500]; strbuf[0] = '\0';
@briansorahan
briansorahan / convertToWav.bash
Last active August 29, 2015 13:59
Convert sound files to wav with mpg123 and sndfile-convert
#!/bin/bash
#
# Convert all soundfiles of a particular type located in the
# current directory to wav.
#
function convertToWav {
local ext="$1"; shift
for f in *.${ext}; do
@briansorahan
briansorahan / gist:10681572
Created April 14, 2014 20:47
testing piping a gist to String.interpret
{ SinOsc.ar }.play;