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 / mp-patch.md
Last active January 4, 2018 04:04
Notes on diving into the vcvrack source code.

All modules will implement a stepStream method that is called in the realtime callback. Instead of processing a single sample at a time, they will process a block of samples.

How to pass the sample output of one module to the sample input of the next?

After initializing the stream in openStream we allocate a buffer of blockSize and let modules write into this as we traverse the graph.

package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
@briansorahan
briansorahan / worker-pool.go
Created February 1, 2017 15:01
Go worker pool. Just toying with ideas.
package main
import (
"fmt"
"math/rand"
"time"
)
type StringsWorker struct {
Errors chan<- error
package main
// swagger:route GET /foo Gets all the foo.
//
// Gets all the foo.
//
// Produces:
// - application/json
//
// Schemes: http, https
@briansorahan
briansorahan / go-precommit-hook.sh
Last active September 16, 2015 12:57
Setup a simple pre-commit hook for go projects
#!/bin/bash
add_precommit_hook() {
local dir=$1
local sample=$dir/pre-commit.sample
local file=${sample/%.sample/}
rm -f $sample
echo '#!/bin/bash' > $file
echo 'exec go test -race' >> $file
chmod +x $file
@briansorahan
briansorahan / geometry.go
Last active August 29, 2015 14:27
golang geometry package
package geometry
import "math"
type Geom interface {
Area() float64
}
type circle float64
@briansorahan
briansorahan / path-problem.sh
Last active August 29, 2015 14:23
praxent pather
#!/bin/sh
cat <<PROB
Given that the text file 'input.txt' contains a rectangular block of dot
characters ('.') and two or more hash characters ('#'), write a program 'pather'
which writes out to 'output.txt' the same data with the two '#' characters
joined by asterisks ('*'). The command will be invoked like this:
pather input.txt output.txt
Your job is to implement 'pather' in this directory. This script will run it
@briansorahan
briansorahan / delete rax server
Last active August 29, 2015 14:21
attempt to delete rax server with ansible
- hosts: 127.0.0.1
connection: local
gather_facts: false
tasks:
- name: Destroy servers
rax: name=rax-ord-pub-01 image="Ubuntu 15.04 (Vivid Vervet) (PVHVM)" flavor=2 region="{{ rax_region | default('DFW') }}" state=absent
@briansorahan
briansorahan / PlayBufExample
Created May 15, 2015 03:12
json representation of a synthdef that uses PlayBuf
{
"name": "PlayBufExample",
"constants": [
1,
0,
2
],
"initialParamValues": [
0
],
@briansorahan
briansorahan / uiowamis.sh
Last active December 15, 2017 17:39
organize the music instrument samples from http://theremin.music.uiowa.edu/MIS.html
#!/bin/sh
#
# organize the university of iowa samples by instrument type
#
function usage {
>&2 echo "Usage"
>&2 echo "$ $0 COMMAND"
>&2 echo ""
>&2 echo "COMMANDS"
>&2 echo " download: Download all the samples with wget"