Skip to content

Instantly share code, notes, and snippets.

View jordanorelli's full-sized avatar
🎴

Jordan Orelli jordanorelli

🎴
View GitHub Profile
@jordanorelli
jordanorelli / sight.pde
Created June 10, 2012 20:37
ChucK -> Processing communication demo
import oscP5.*;
import netP5.*;
PGraphics pg;
OscP5 oscP5;
NetAddress inbound;
float minFreq = 140;
float maxFreq = 1600;
float[] notes;
package main
import (
"fmt"
"time"
)
func chatter() {
for {
fmt.Println(time.Now())
@jordanorelli
jordanorelli / heterogenous.go
Created June 19, 2012 17:17
sorting heterogenous slices in go
package main
import (
"fmt"
"sort"
)
type CommonCollection []Convertible
func (c CommonCollection) Len() int { return len(c) }
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
Go 61 691 529 5236
Javascript 3 90 66 446
HTML 1 0 0 62
Bourne Again Shell 1 2 0 6
--------------------------------------------------------------------------------
SUM: 66 783 595 5750
--------------------------------------------------------------------------------
@jordanorelli
jordanorelli / id.go
Created June 23, 2012 18:32
fast unique id generation in Go
package main
import (
"crypto/md5"
"encoding/binary"
"fmt"
"os"
"sync/atomic"
"time"
)
@jordanorelli
jordanorelli / recv.ck
Created July 7, 2012 17:21
receive monome key presses in chuck
OscRecv recv;
27647 => recv.port;
recv.listen();
recv.event("/monome/grid/key", "iii") @=> OscEvent oe;
while(true) {
int x;
int y;
int down;
oe => now;
@jordanorelli
jordanorelli / tonecalc.ck
Created July 7, 2012 17:31
musical pitch calculator in ChucK for making 1 and 2 dimensional tone arrays
/*
Copyright (C) 2011 by Jordan Orelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jordanorelli
jordanorelli / webserver.go
Created July 12, 2012 02:41
gracefully handle SIGINT on a Go webserver
package main
import (
"net"
"log"
"net/http"
"io"
"time"
"os"
"os/signal"
@jordanorelli
jordanorelli / timeoutserver.go
Created July 13, 2012 21:36
why does this not time out?
package main
import (
"net/http"
"time"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
time.Sleep(10 * time.Second)
@jordanorelli
jordanorelli / gist:3137497
Created July 18, 2012 17:07
confusing...
jordanorelli@yupa[0] ~: cat 1
[2]: no such file or directory
jordanorelli@yupa[0] ~: cat \1
[2]: no such file or directory
jordanorelli@yupa[0] ~: cat ./1
[2]: no such file or directory
jordanorelli@yupa[0] ~: vim 1
jordanorelli@yupa[0] ~: rm 1
jordanorelli@yupa[0] ~: cat 1
cat: 1: No such file or directory