Skip to content

Instantly share code, notes, and snippets.

View njbartlett's full-sized avatar

Neil Bartlett njbartlett

View GitHub Profile
@njbartlett
njbartlett / cc-by-sa-4.0.txt
Last active October 4, 2018 14:07
cc-by-sa-4.0
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
@njbartlett
njbartlett / reaper.pony
Last active February 24, 2018 17:30
Docker Container Reaper in Ponylang (a learning exercise)
use "collections"
use "json"
use "net"
use "net/http"
use "time"
actor Main
"""
This is my learning exercise for the Pony language (ponylang.org). It is a
port of a Java application that:
This file has been truncated, but you can view the full file.
@njbartlett
njbartlett / gist:5161077
Created March 14, 2013 12:53
Declarative Services multiple reference example
@Component
public class Example {
private ServiceA svcA;
private ServiceB svcB;
@Reference
public void setServiceA(ServiceA a) {
this.svcA = a;
}
@njbartlett
njbartlett / gist:4708423
Created February 4, 2013 18:10
Baffling exception from Jini when running on a JRE, but not on a JDK.
Caused by: java.lang.RuntimeException: Unexpected exception
at com.sun.jini.logging.Levels.createLevel(Levels.java:142)
at com.sun.jini.logging.Levels.<clinit>(Levels.java:52)
... 18 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2557)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1294)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1950)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1874)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1756)
@njbartlett
njbartlett / gist:4268406
Created December 12, 2012 15:00
OSGi bundle unit testing
package org.example.tests;
import junit.framework.TestCase;
import org.example.exchange.api.Exchange;
import org.example.exchange.api.ExchangeListener;
import org.example.model.orders.Order;
import org.example.model.orders.OrderHelper;
import org.example.model.orders.Side;
import org.mockito.Mockito;
@njbartlett
njbartlett / gist:4266809
Created December 12, 2012 10:42
Gatekeeper component example
package org.example.exchange.gatekeeper;
import java.io.File;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.example.osgi.utils.components.ComponentHelper;
import org.osgi.service.component.ComponentContext;
@njbartlett
njbartlett / gist:3874679
Created October 11, 2012 18:52
p2 repository in ANT
<!-- Generate the p2 repository and index -->
<target name="p2" depends="build,features.dir,plugins.dir" description="Generate the p2 repository">
<java jar="${workspacedir}/cnf/eclipse-3.5.2/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar" fork="true" failonerror="true">
<!-- <arg line="-consoleLog"/> -->
<arg line="-application org.eclipse.ant.core.antRunner"/>
<arg line="-data ${target}"/>
<arg line="-buildfile build.xml __internal_p2"/>
</java>
<!-- Append the category info -->
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] Nexus OBR (Parent)
[INFO] Nexus OBR :: Plugin
[INFO] Nexus OBR :: Testsuite
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Nexus OBR (Parent) 2.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:09.370s
[INFO] Finished at: Tue Oct 02 17:01:52 BST 2012
[INFO] Final Memory: 142M/268M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT:setup-environment (default) on project nexus-ldap-plugin-it: Execution default of goal org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT:setup-environment failed: Plugin org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.sonatype.aether:aether-util:jar:1.13.1, org.sonatype.plexus:plexus-cipher:jar:1.5, org.sonatype.plugins:port-allocator-maven-plugin:jar:1.2: Failure to transfer org.sonatype.