Skip to content

Instantly share code, notes, and snippets.

@roger2000
roger2000 / chan_test.go
Created May 11, 2017 15:27 — forked from atotto/chan_test.go
golang channel benchmark
package chan_test
import (
"testing"
)
func BenchmarkStructChan(b *testing.B) {
ch := make(chan struct{})
go func() {
for {
@roger2000
roger2000 / reader.go
Created October 22, 2015 13:49 — forked from jedy/reader.go
processes communicate with shared memory in golang
package main
// #include <stdlib.h>
// #include "wrapper.c"
import "C"
import "unsafe"
import "fmt"
func read(filename string) string {
f := C.CString(filename)
@roger2000
roger2000 / atoi_test.go
Created October 7, 2015 18:45 — forked from evalphobia/atoi_test.go
golang benchmark: String and Int conversions
package bench
import (
"strconv"
"testing"
)
var smallStr = "35"
var bigStr = "999999999999999"
@roger2000
roger2000 / bench_test.go
Created October 7, 2015 18:22 — forked from SchumacherFM/bench_test.go
GoLang Benchmark: Map, StringSlice, Array, StructSlice
package main
// run with: $ go test --bench=. -test.benchmem .
// @see https://twitter.com/karlseguin/status/524452778093977600
import (
"math/rand"
"strconv"
"testing"
)
(ns explore-overtone.beethoven
(:use [overtone.live]))
;; Beginning with some of the ideas in Sam Aaron's example[1],
;; let's see about trying to get rid of the limitation on sequence
;; length.
;;
;; I'd like to create a composition outside the server in "beat space"
;; (play note N at beat B). This should allow for composing notes via
;; an abstraction that a library like Leipzig [2] provides. But,
(ns explore-overtone.leipzig-poly-player
(:use
leipzig.melody
leipzig.scale
leipzig.canon)
(:require [overtone.live :as o]
[overtone.inst.sampled-piano :as p]))
;; "un-scale" -- the inverse translations to go from raw pitches 60,
;; 62, etc. to scale indices 0, 1, etc. Then, you can "re-scale" in
package pointerTagging
import (
"unsafe"
"math/rand"
"time"
)
type vector struct {
x int