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
<project
name = "normz"
description = "zeromq microservice for log normalization"
script = "zproject.gsl"
email = "bknox@digitalocean.com"
>
<include filename = "license.xml" />
<version major = "0" minor = "1" patch = "0" />
<use project = "czmq">
$  ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I config --force -I config
configure.ac:138: error: AC_SUBST: `json-c_CFLAGS' is not a valid shell variable name
../../lib/autoconf/general.m4:1511: AC_ARG_VAR is expanded from...
/usr/share/aclocal/pkg.m4:106: PKG_CHECK_MODULES is expanded from...
configure.ac:138: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
@taotetek
taotetek / credit.c
Last active July 12, 2018 15:11
Updated Credit Based Flow Control Example ( See: http://hintjens.com/blog:15 )
#include "czmq.h"
// DEBUG - set to true for some output
#define DEBUG false
#define TRANSIT_TOTAL 1024 * 1024
#define TRANSIT_SLICE TRANSIT_TOTAL / 4
#define FRAGMENT_SIZE 65536
#define SERVER_HWM (TRANSIT_TOTAL / FRAGMENT_SIZE) * 2
#define TICK_SECONDS 5
module(load="imczmq")
input(
type="imczmq"
endpoints=">tcp://127.0.0.1:31337"
socktype="ROUTER"
authtype="CURVESERVER"
clientcertpath="/home/bknox/.curve/"
servercertpath="/home/bknox/.curve/logging_server_cert"
)
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
"net"
"os"
"strings"
package captainslog
import "sync"
type Queue struct {
q []SyslogMsg
lock *sync.Mutex
}
func NewQueue(max int) *Queue {
#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);
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)
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\":\"")
package main
import (
"fmt"
"log"
"time"
"github.com/zeromq/goczmq"
)