Skip to content

Instantly share code, notes, and snippets.

View ksperling's full-sized avatar

Karsten Sperling ksperling

View GitHub Profile
package sandbox;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import com.github.benmanes.caffeine.cache.CacheWriter;
@ksperling
ksperling / coverage.groovy
Created January 19, 2016 01:57
Multi-module JaCoCo report
// Runs a combined JaCoCo report across all modules in the reactor
// Output is placed in the root project's output directory
def root = session.topLevelProject
def modules = session.projectDependencyGraph.sortedProjects
.findAll { it != project && it.packaging != 'pom' }
if (!modules.empty) {
def jacoco = groovy.xml.NamespaceBuilder.newInstance(ant, 'antlib:org.jacoco.ant')
jacoco.report {
@ksperling
ksperling / ssh-policy
Created October 12, 2015 03:09
Helper for validating commands executed over SSH (via .authorized-keys / SSH_ORIGINAL_COMMAND)
#!/bin/bash -e
# ssh-policy: Helper for validating and running SSH_ORIGINAL_COMMAND
# Patterns are matched via grep -x -z [-F/-B/-E]
function fail() {
echo "$1" >&1
exit 100
}
[ $# == 1 ] || fail "command syntax error, denied"