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 / channel.c
Created April 25, 2016 14:39
Sharing a thread safe ZMQ_SCATTER socket between multiple threads with inproc transport - very golang channel like. :)
#include <czmq.h>
#include <pthread.h>
#define NUMTHREADS 4
#define MESSAGES 10000000
void *
sender (void *arg)
{
zsock_t *scatter = (zsock_t *) arg;
module(
load="imczmq"
authenticator="on"
authtype="CURVESERVER"
clientcertpath="/etc/curve.d/"
servercertpath="/etc/curve.d/server_cert"
)
module(
load="omczmq"
module(
load="imczmq"
servercertpath="/etc/curve.d/server"
clientcertpath="/etc/curve.d/"
authtype="CURVESERVER"
authenticator="on"
)
module(
load="omczmq"
@taotetek
taotetek / curltest.c
Created May 25, 2016 19:23 — forked from aaronhurt/curltest.c
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* Requirements:
*
* json-c - https://github.com/json-c/json-c
* libcurl - http://curl.haxx.se/libcurl/c
*
ruleset(name="kafka_publish_raw") {
action(
name="to_kafka"
type="omkafka"
broker=["prod-kafka01",
"prod-kafka02",
"prod-kafka03"]
topic="rawlogs"
confParam=["socket.keepalive.enable=true","socket.timeout.ms=1000"]
partitions.auto="on"
input(type="imfile" File="/var/log/myfile.log" ruleset="myrule")
ruleset(name="myrule) {
<actions here>
}
module(
load="imczmq"
)
input(
type="imczmq"
endpoints="@tcp://*:24555"
socktype="PULL"
)
module(
load="imczmq"
)
input(
type="imczmq"
endpoints="@tcp://*:24555"
socktype="PULL"
rule="testme"
)

Keybase proof

I hereby claim:

  • I am taotetek on github.
  • I am taotetek (https://keybase.io/taotetek) on keybase.
  • I have a public key whose fingerprint is D2D4 E077 E060 6F84 CABF 4FA2 4905 9E02 3498 810F

To claim this, I am signing this object:

GO VERSION 1.7 - BENCHMARKING zeromq/goczmq
--------------------------------------------
go version
go version go1.7.1 linux/amd64
BenchmarkChanneler-8 200000 5371 ns/op 190.64 MB/s
BenchmarkPollerSendFrame1k-8 500000 2863 ns/op 357.62 MB/s
BenchmarkPollerSendFrame4k-8 300000 4063 ns/op 1008.04 MB/s
BenchmarkPollerSendFrame16k-8 200000 8259 ns/op 1983.66 MB/s
BenchmarkProxySendFrame1k-8 1000000 2328 ns/op 439.78 MB/s