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
package main
import (
"fmt"
czmq "github.com/zeromq/goczmq"
)
func main() {
serverCert, _ := czmq.NewCertFromFile("/etc/curve.d/example_curve_server_cert")
module(load="omczmq")
template(name="PUBSUBTEST" type="list" option.json="on") {
property(name="hostname")
constant(value=".")
property(name="syslogtag" position.from="1" position.to="32")
constant(value="|")
property(name="msg")
}
@taotetek
taotetek / zeromq.conf
Created April 18, 2015 14:58
rsyslog + zeromq with curve encryption
module(load="omczmq")
template(name="pubsub_host_tag" type="list" option.json="on") {
property(name="hostname")
constant(value=".")
property(name="syslogtag" position.from="1" position.to="32")
constant(value="|")
property(name="rawmsg")
}
@taotetek
taotetek / miniclient.c
Created May 10, 2015 16:30
minimal logtalez client example
#include <czmq.h>
int
main (void)
{
zsock_t *client = zsock_new (ZMQ_SUB);
assert (client);
zsock_set_subscribe (client, "");
zcert_t *server_cert = zcert_load ("home/example_user/.cu
package goczmq
import (
"fmt"
)
func ExampleTraditionalRequestResponder() {
go func() {
responder := NewSock(Rep)
_, err := responder.Bind("inproc://traditional")
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)
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)
@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
package goczmq
import (
"sync"
"testing"
)
// WITHOUT MUTEX
type WithoutMutex struct {
@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