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'
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
@calid
calid / ae_ev_explosion.out
Last active August 29, 2015 14:17
AnyEvent uses EV by default
t/fd.t .......... EV: error in callback (ignoring): zmq_msg_recv: Bad address at /home/calid/git/zmq-ffi/lib/ZMQ/FFI/ErrorHelper.pm line 83.
ZMQ::FFI::ErrorHelper::fatal(ZMQ::FFI::ZMQ3::Socket=HASH(0x200ced8), "zmq_msg_recv") called at /home/calid/git/zmq-ffi/lib/ZMQ/FFI/ZMQ3/Socket.pm line 125
ZMQ::FFI::ZMQ3::Socket::recv(ZMQ::FFI::ZMQ3::Socket=HASH(0x200ced8)) called at t/fd.t line 24
main::__ANON__(EV::IO=SCALAR(0x1a7dbe8), 1) called at /home/calid/.perlbrew/libs/perl-5.20.1@local/lib/perl5/x86_64-linux/AnyEvent/Impl/EV.pm line 88
eval {...} called at /home/calid/.perlbrew/libs/perl-5.20.1@local/lib/perl5/x86_64-linux/AnyEvent/Impl/EV.pm line 88
AnyEvent::CondVar::Base::_wait(AnyEvent::CondVar=HASH(0x1a7e2f0)) called at /home/calid/.perlbrew/libs/perl-5.20.1@local/lib/perl5/x86_64-linux/AnyEvent.pm line 1994
AnyEvent::CondVar::Base::recv(AnyEvent::CondVar=HASH(0x1a7e2f0)) called at t/fd.t line 49
^C
@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 == '+' }