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
import sys
import time
import zmq
from multiprocessing import Process
def ventilator():
# Initialize a zeromq context
context = zmq.Context()
# Set up a channel to send work
import eventlet
from eventlet.green import socket
import zmq
import sys
PORT=3001
def read_socket(writer, reader):
line = reader.readline()
while line:
@taotetek
taotetek / nodesimple.js
Created January 9, 2014 14:07
playing with node bindings for zeromq
var zmq = require('zmq');
// SUBSCRIBER
subsock = zmq.socket('sub');
subsock.connect ('ipc:///tmp/node.ipc');
subsock.subscribe('HELLOWORLD:');
console.log('Subscriber connected to ipc:///tmp/node.ipc');
subsock.on('message', function(msg) {
@taotetek
taotetek / statdump
Created January 13, 2014 02:30
Dump from stats socket in meatspace
var zmq = require('zmq'), sock = zmq.socket('sub');
sock.subscribe("");
sock.bindSync ('ipc:///tmp/meatcounter.ipc');
sock.on('message', function(msg) {
console.log('RECEIVED: %s', msg.toString());
});
#include <zmq.h>
#include <czmq.h>
#include "include/dbg.h"
#define DEBUG 1
int
main (void)
{
void *ctx = zmq_ctx_new ();
client.On("connect", func(ns *socketio.NameSpace) {
log.Println("connected")
ns.Emit("ping", nil)
})
@taotetek
taotetek / stats.sql
Created March 22, 2014 21:53
meatspace stats query
select
date_trunc ('day', interval) as meatdate,
topic,
sum(total) as total,
hll_cardinality(hll_union_agg(users)) as uniques
from
daily_stats
where
topic in ('meatspace.incoming', 'meatspace.outgoing')
group by
package main
import (
"log"
"github.com/howeyc/fsnotify"
)
func SetWatch(dir string, ce chan *fsnotify.FileEvent) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
package main
import (
"log"
"github.com/howeyc/fsnotify"
)
func SetWatch(dir string, ce chan *fsnotify.FileEvent) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
func main() {
evChan := make(chan *fsnotify.FileEvent)
lnChan := make(chan *tail.Line)
done := make(chan string)
conf := new(Config)
err := conf.LoadConf("./goforward.json")
if err != nil {
log.Fatal(err)
}