Skip to content

Instantly share code, notes, and snippets.

View trevorbernard's full-sized avatar

Trevor Bernard trevorbernard

View GitHub Profile
public class Example {
public static void main(String[] args) {
ZContext context = null;
try {
context = new ZContext();
new Application(args).start() // blocking call and will close it's resources when finished
} finally {
try { context.close() } catch( Exception e ) {}
}
}
@trevorbernard
trevorbernard / PushPullTest.java
Created November 22, 2014 22:01
Experimental ZeroMQ Socket API with Context automagically managed for you
package org.zeromq.zmq;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.junit.Test;
import static org.zeromq.zmq.ZMQ.*;
public class PushPullTest {
Verifying that +trevorbernard is my openname (Bitcoin username). https://onename.io/trevorbernard
package io.txb.eventstore;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
hQEMA9+8P1iiiALAAQf+N0N45Rf896XSq3pMokBCiTOHKNojFpbvGEg/53Kj4u55
S9NQ6IvjLBe8gQRWjt9jHYBWouJky9pCnX3PzeoCCtpuTPP6QjfQejRR8UIJA7vG
mc74FJ584Riw7SbauTZYqYLJ/ZHxjDSrmHwm137HYuiZl8krpd0k9uqZImv5ReJT
SedlFMflbvrtE61nVHTD3621vysl8JPsb1rJiorbNpPFBj1RWdr8X9ihWCB6aiHF
LsZmcEgRlLKCo18OLHh62TFEhZFpASAw3rcv4ZqFlJ0rDGAm2bfAR0CqQ2crfVm7
N3JJnThBMMZKkmTfpEFbVjurxO0g2XU1zxlno2/oQNJgAU32qMIZFQetm+yKzAZe
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
* What went wrong:
Execution failed for task ':install'.
> Could not publish configuration 'archives'
> org.codehaus.plexus.PlexusContainerException: Cycle detected in component graph in the system:
public interface Callback {
void work(Object... args);
}
class Foobar implements Callback {
void work(Object... args) {
Object first = args[0];
Object second = args[1];
// do work
}
@trevorbernard
trevorbernard / clojure.clj
Created July 31, 2013 02:49
Super simple way to send and receive Clojure data over ØMQ
(ns cljzmq-examples.serialization.clojure
(:require [clojure.edn :as edn]
[zeromq.zmq :as zmq]))
(defn send-clj
([socket clj-data]
(send-clj socket clj-data 0))
([socket clj-data flags]
(let [data (-> clj-data
(pr-str)
'''
An authentication module for pyzmq modelled on zauth from czmq.
The certificates used for CURVE authentication are assumed to be identical to
those generated by czmq.
'''
import glob
import json
import os