This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module( | |
load="imczmq" | |
servercertpath="/etc/curve.d/server" | |
clientcertpath="/etc/curve.d/" | |
authtype="CURVESERVER" | |
authenticator="on" | |
) | |
module( | |
load="omczmq" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module( | |
load="imczmq" | |
authenticator="on" | |
authtype="CURVESERVER" | |
clientcertpath="/etc/curve.d/" | |
servercertpath="/etc/curve.d/server_cert" | |
) | |
module( | |
load="omczmq" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
#include <pthread.h> | |
#define NUMTHREADS 4 | |
#define MESSAGES 10000000 | |
void * | |
sender (void *arg) | |
{ | |
zsock_t *scatter = (zsock_t *) arg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"time" | |
"github.com/zeromq/goczmq" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template(name="cee_syslog" type="list") { | |
constant(value="{\"@timestamp\":\"") | |
property(name="timereported" dateFormat="rfc3339") | |
constant(value="\",\"syslog_host\":\"") | |
property(name="hostname") | |
constant(value="\",\"syslog_program\":\"") | |
property(name="programname") | |
constant(value="\",\"syslog_severity\":\"") | |
property(name="syslogseverity-text") | |
constant(value="\",\"syslog_facility\":\"") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestExternalServer(t *testing.T) { | |
client := NewClient(NewSecurityNull()) | |
err := client.Connect("tcp://127.0.0.1:31337") | |
if err != nil { | |
t.Error(err) | |
} | |
err = client.Send([]byte("HELLO")) | |
if err != nil { | |
t.Error(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "czmq.h" | |
int | |
main (void) | |
{ | |
zsock_t *server = zsock_new (ZMQ_SERVER); | |
assert (server); | |
zsock_bind (server, "tcp://127.0.0.1:31337"); | |
char *msg = zstr_recv (server); | |
printf ("msg: %s", msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package captainslog | |
import "sync" | |
type Queue struct { | |
q []SyslogMsg | |
lock *sync.Mutex | |
} | |
func NewQueue(max int) *Queue { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"encoding/json" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
"strings" |