Skip to content

Instantly share code, notes, and snippets.

View how-i-met-ph.md

How I met Pieter Hintjens

Preface

I wanted to write it when I realized Pieter is dying. Thanks God he have been waiting on my article all the time! It is not well thought or structured, just a simple dump of my memory.

Chapter one

View b.sh
#!/bin/sh
set -x
gcc -std=c99 -Werror -ggdb demo.c -lczmq -lmlm -o test \
&& ./test
View malamute.cfg
# Malamute configuration
# Apply to the whole broker
server
timeout = 10000 # Client connection timeout, msec
background = 0 # Run as background process
workdir = . # Working directory for daemon
verbose = 1 # Do verbose logging of activity?
# auth
# verbose = 1 # Debug authentication steps?
View i.c
/*
* Test the fact it's not a good idea to call mlm_client API when zsys_interrupted == 1;
*/
#define MLM_BUILD_DRAFT_API
#include <malamute.h>
int main ()
{
@vyskocilm
vyskocilm / mariadb-embeded.poc
Created Mar 7, 2016
PoC of using embeded mariadb with tntnet
View mariadb-embeded.poc
#include <mysql/mysql.h>
#include <tntdb.h>
// g++ -ggdb -std=c++11 test.cc -ltntdb -lcxxtools -lmysqld
static char *server_args[] = {
"this_program", /* this string is not used */
"--datadir=./__db__",
"--key_buffer_size=32M"
};
@vyskocilm
vyskocilm / loop.c
Created Feb 24, 2016
demo on zloop_t
View loop.c
#include <czmq.h>
static int
xzloop_add_fd (zloop_t *self, int fd, zloop_fn handler, void *arg)
{
assert (self);
zmq_pollitem_t *fditem = (zmq_pollitem_t*) zmalloc (sizeof (zmq_pollitem_t));
assert (fditem);
fditem->fd = fd;
fditem->events = ZMQ_POLLIN;
@vyskocilm
vyskocilm / pool.cc
Last active Jan 26, 2016
pool of mlm_client_t
View pool.cc
#include <memory>
#include <iostream>
#include <cstdio>
#include <cxxtools/pool.h>
#include <malamute.h>
using namespace cxxtools;
class MlmClient
@vyskocilm
vyskocilm / malamute.cfg
Last active Aug 29, 2015
test case for malamute issue 81
View malamute.cfg
# Malamute configuration
# Apply to the whole broker
server
timeout = 10000 # Client connection timeout, msec
background = 0 # Run as background process
workdir = . # Working directory for daemon
verbose = 0 # Do verbose logging of activity?
auth
verbose = 1 # Debug authentication steps?
View debsize.py
import subprocess
import collections
import io
import sys
import os
import shlex
__doc__ = """
Tool for printing dependency tree for Debian systems including size of package. Might help with
stripping down dependencies.