Skip to content

Instantly share code, notes, and snippets.

View vyskocilm's full-sized avatar

Michal Vyskocil vyskocilm

View GitHub Profile
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.
@vyskocilm
vyskocilm / malamute.cfg
Last active August 29, 2015 14:25
test case for malamute issue 81
# 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?
@vyskocilm
vyskocilm / pool.cc
Last active January 26, 2016 14:15
pool of mlm_client_t
#include <memory>
#include <iostream>
#include <cstdio>
#include <cxxtools/pool.h>
#include <malamute.h>
using namespace cxxtools;
class MlmClient
@vyskocilm
vyskocilm / loop.c
Created February 24, 2016 12:49
demo on zloop_t
#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 / mariadb-embeded.poc
Created March 7, 2016 15:40
PoC of using embeded mariadb with tntnet
#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"
};
/*
* 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 ()
{
# 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?
#!/bin/sh
set -x
gcc -std=c99 -Werror -ggdb demo.c -lczmq -lmlm -o test \
&& ./test

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

@vyskocilm
vyskocilm / buildzmq.sh
Created December 5, 2016 02:47
buildzmq.sh
#!/bin/bash
# build ZeroMQ stack and install to /usr/local/
die () {
echo "FATAL: $@" >&2
exit 1
}
touch /usr/local/_test || die "Make /usr/local accessible again (chmod a+rwx)"