Skip to content

Instantly share code, notes, and snippets.

View taotetek's full-sized avatar
💭
Left for Gitlab. Microsoft still contracts with ICE.

taotetek taotetek

💭
Left for Gitlab. Microsoft still contracts with ICE.
View GitHub Profile
@taotetek
taotetek / testparse.nim
Created June 13, 2015 03:09
scratch parser test
import os, streams, parsexml, strutils
if paramCount() < 1:
quit("Usage: parse filename[.xml]")
var filename = addfileExt(paramStr(1), "xml")
var s = newFileStream(filename, fmRead)
if s == nil: quit("Cannot open the file" & filename)
var x: XmlParser
open(x, s, filename)
@taotetek
taotetek / thoughts.txt
Created June 11, 2015 11:41
thoughts
actor:
function function_ref:
commands:
command "FRONTEND":
stuff ...
command "PAUSE":
stuff ...
command "RESUME:
stuff ...
@taotetek
taotetek / wow.nim
Last active August 29, 2015 14:22
import czmq
var pull = zsock_new(ZMQ_PULL)
var rc = zsock_connect(pull, "inproc://zsock_test")
var push = zsock_new(ZMQ_PUSH)
rc = zsock_bind(push, "inproc://zsock_test")
for i in countdown(100000000, 1):
@taotetek
taotetek / lotsofroutines.go
Created June 6, 2015 14:30
playing around
BenchmarkSetGetMutex 2000000 668 ns/op
@taotetek
taotetek / resultsmutex.txt
Created June 6, 2015 14:02
results of mutex on laptop
go test -bench=.
testing: warning: no tests to run
PASS
BenchmarkSetGet 2000000000 0.61 ns/op
BenchmarkSetGetMutex 10000000 119 ns/op
ok github.com/taotetek/mutextest 2.622s
package goczmq
import (
"sync"
"testing"
)
// WITHOUT MUTEX
type WithoutMutex struct {
@taotetek
taotetek / encode.go
Created May 24, 2015 16:59
ReadWriter support in goczmq
package main
import (
"encoding/gob"
"fmt"
"github.com/zeromq/goczmq"
)
// person is an example type we will encode, send, and decode
func benchmarkChanneler(size int, b *testing.B) {
pullSock := NewSock(Pull)
pullSock.Bind("inproc://benchChan")
defer pullSock.Destroy()
channeler := NewChanneler(pullSock, false)
time.Sleep(10 * time.Millisecond)
go func() {
pushSock := NewSock(Push)
func benchmarkLogtalez(size int, b *testing.B) {
endpoints := []string{"inproc://benchmark"}
topics := []string{""}
servercert := "./example_certs/example_curve_server_cert"
clientcert := "./example_certs/example_curve_client_cert"
go func() {
lt, err := New(endpoints, topics, servercert, clientcert)
if err != nil {
panic(err)
package goczmq
import (
"fmt"
)
func ExampleTraditionalRequestResponder() {
go func() {
responder := NewSock(Rep)
_, err := responder.Bind("inproc://traditional")