Skip to content

Instantly share code, notes, and snippets.

/usr/local/java-apps
├── bin
│   └── myapp -> ../myapp/bin/myapp
└── myapp
├── bin
│   └── myapp
└── lib
├── dependency1.jar
├── dependency2.jar
├── dependency3.jar
repositories {
maven { url 'http://internalrepo.example.com' }
}
dependencies {
runtime 'mygroup:myapp:1.0'
}
apply plugin: 'application'
@calid
calid / upload-archives-workaround.gradle
Last active November 3, 2015 15:04
Manually substitute '+' version specifier in Gradle generated pom
uploadArchives {
repositories {
mavenDeployer {
repository url: 'file:///tmp/testRepo'
pom.whenConfigured { p ->
// get all unresolved dependencies in our pom
def unresolved = p.getDependencies()
.grep { it.version == '+' }
@calid
calid / 00-preamble.md
Last active October 3, 2022 10:45
ZeroMQ Perl Performance Comparison: FFI vs XS bindings

ØMQ Perl Performance Comparison: FFI vs XS bindings

Comparison of the performance of FFI vs XS zeromq bindings. For FFI the ZMQ::FFI bindings are used, first using FFI::Raw on the backend and then using FFI::Platypus. For XS ZMQ::LibZMQ3 is used.

Comparison is done using the zeromq weather station example, first by timing wuclient.pl using the various implementations, and then by profiling wuserver.pl using Devel::NYTProf. When profiling the server is changed to simply publish 1 million messages and exit.

use Sys::SigAction qw(timeout_call);
my $timed_out = timeout_call 3, sub { # schedules SIGALRM
my $ctx = ZMQ::FFI->new();
my $s = $ctx->socket(ZMQ_REQ);
$s->connect("ipc:///tmp/test-zmq-ffi-$$");
$s->send('ohhai');
$s->close(); # bug here, linger not set
@calid
calid / bad-zmq-undbind.c
Last active August 29, 2015 14:17
zmq_unbind fail
#include <zmq.h>
#include <assert.h>
#include <stdio.h>
int main(void)
{
int rc;
void *context = zmq_ctx_new();
void *socket = zmq_socket(context, ZMQ_SUB);
@calid
calid / 00-bad_ev.pl
Last active August 29, 2015 14:17
EV 3 Segfault w/ ZMQ::FFI & FFI::Platypus
use strict;
use warnings;
use Test::More;
use AnyEvent;
use EV;
use ZMQ::FFI;
use ZMQ::FFI::Constants qw(ZMQ_PUSH ZMQ_PULL);
@calid
calid / Java
Last active August 29, 2015 14:17
zguide Node Coordination (syncpub/syncsub) Issues
$ for i in {{1..10}}; do ./run syncsub & done
[1] 2719
[2] 2720
[3] 2721
[4] 2722
[5] 2723
syncsub with jeromq
[6] 2725
syncsub with jeromq
syncsub with jeromq
@calid
calid / 01-zmq_hang.py
Created March 19, 2015 00:56
pyzmq hanging on exit
import zmq
c = zmq.Context()
s = c.socket(zmq.DEALER)
s.connect('ipc://*')
s.send_string('ohhai')
s.send_string('ohhai')
s.send_string('ohhai')
print('Done')
@calid
calid / 00-noprint-after-undef.pl
Last active August 29, 2015 14:17
Perl DESTROY Scoping Semantics
local *Foo::c = sub { print "IN MY C\n" };
my $f = Foo->new();
Foo::c();
Foo::d();
e();
undef $f;
__END__
Output