Skip to content

Instantly share code, notes, and snippets.

@tnn
tnn / jenkins-swarm-client
Last active May 26, 2020 15:29
Systemd service for Jenkins swarm client
# location of java
JAVA=/usr/bin/java
# For the JVM runtime default encoding
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANGUAGE=en_US.UTF-8
# Java options
JAVA_OPTS="-Djava.io.tmpdir=/var/lib/jenkins/tmp/"
@tnn
tnn / RestResources.java
Created December 2, 2016 21:13
Generate Jersey (JAX-RS) RAML-ish list of all resources declared
@Path("/rest")
public class RestResource {
@GET
@Path("resources")
@Produces({MediaType.TEXT_PLAIN})
public Response getJaxRSResources(@Context final Application application) {
final TreeMap<String, List<String>> res = new TreeMap<>();
for (Class<?> aClass : application.getClasses()) {
if (isAnnotatedResourceClass(aClass)) {
@tnn
tnn / riak.conf
Created September 15, 2015 12:08
Riak upstart script
# riak - Basho Riak key/value database
#
# A distributed Key/value database
#
description "Riak key/value database"
author "Troels Norgaard <tnn@tradeshift.com>"
# Ensure that we only start Riak once
# the filesystem is ready
start on local-filesystems filesystem mounted
@tnn
tnn / pom.xml
Last active August 29, 2015 14:10
docker-maven-plugin example v0.1
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>my-component</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
@tnn
tnn / Dockerfile
Last active August 29, 2015 14:10
Build Oracle Java Debian (.deb) packages on Ubuntu trusty
#
# Builder for Oracle Java Debian (.deb) packages on Ubuntu trusty
#
# Pull base image.
FROM dockerfile/ubuntu
ENV JAVA_VERSION 8u25
COPY jdk-$JAVA_VERSION-linux-x64.gz /tmp/jdk-$JAVA_VERSION-linux-x64.tar.gz
COPY jre-$JAVA_VERSION-linux-x64.gz /tmp/jre-$JAVA_VERSION-linux-x64.tar.gz
@tnn
tnn / gist:6595703
Created September 17, 2013 15:12
MessageFuture
@Path("service")
public class CSResource extends ContextAdwareResource {
@GET
@Path("states")
public void getApDocumentStates(@Suspended final AsyncResponse resp) {
MessageService<CSProtocol, Exception> service = new CSService();
service.request(new Msg("getCSStates"))
.then((value) -> resp.resume(convertToExternal(value)))
.catchError((error) -> resp.resume(Response.Status.INTERNAL_SERVER_ERROR),
@tnn
tnn / zonetemplate.zonecfg
Created October 1, 2012 15:46
SmartOS / SmartMachine zonecfg template
{
"brand": "joyent",
"dataset_uuid": "",
"alias": "",
"autoboot": true,
"cpu_shares": 128,
"dns_domain": "",
"hostname": "",
"max_physical_memory": 128,
"quota": 10,
@tnn
tnn / nexus.smf.xml
Created September 27, 2012 13:14
Nexus SmartOS/Solaris 11 SMF service manifest
<?xml version='1.0' ?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
Service Manifest for Nexus
-->
<service_bundle type='manifest' name='application/nexus'>
<service name='application/nexus' type='service' version='1'>
<create_default_instance enabled='false' />
@tnn
tnn / domain1.xml
Created September 16, 2012 18:05
Glassfish 3 SMF manifest for Domain1
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
@tnn
tnn / jenkins.smf.xml
Created July 8, 2012 21:09
Jenkins Solaris 11 / illumos / SmartOS SMF service manifest
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='jenkins'>
<service name='application/jenkins' type='service' version='1'>
<create_default_instance enabled='false' />
<!-- Only one instance of Hudson should ever run per server -->
<single_instance />