Skip to content

Instantly share code, notes, and snippets.

@nicoulaj
nicoulaj / docker-compose.yml
Last active April 8, 2021 05:50
Guacamole docker
version: '2.2'
networks:
traefik:
external: true
guacamole:
external: true
services:
guacamole:
/**
* Check comparator respects its contract against a given collection.
*
* @param elements
* collection
* @param comparator
* comparator
*/
public static <T> void checkComparatorContract(Collection<T> elements, Comparator<? super T> comparator) {
@nicoulaj
nicoulaj / .gitignore
Last active December 3, 2016 17:54
PointsCloud VM environment
.vagrant
@nicoulaj
nicoulaj / test-master.sh
Created June 2, 2016 14:54
SGE -notify and -inherit
#!/bin/bash
# Trap signals
for signal in HUP INT QUIT ABRT KILL SEGV USR1 USR2 TERM; do
trap "echo 'master : Received signal ${signal}...'" ${signal}
done
# Submit slaves
slave_id=0; while read host slots queue procs; do
for slot in $(seq $slots); do
public class ArrayListAddBenchmark extends ListBenchmark {
@Override
protected List<Object> newInstance() {
return new ArrayList<Object>();
}
}
@nicoulaj
nicoulaj / pom.xml
Created May 4, 2013 11:07
Using JMH in a Maven project.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<!-- Benchmark code goes into src/test/java -->
<dependencies>
<dependency>
@nicoulaj
nicoulaj / java-signals-test.sh
Created September 20, 2012 20:08
What signals can your JRE handle ?
#!/bin/bash
# Get temp dir
tmpdir=$(mktemp -d)
# Generate test
cat > ${tmpdir}/ListenToSignal.java <<EOF
import sun.misc.Signal;
import sun.misc.SignalHandler;
public class ListenToSignal {
@nicoulaj
nicoulaj / java-cpu-affinity-unaware.sh
Created September 6, 2012 19:17
Runtime.availableProcessors() gives info about available resources, not affinity which occurs at scheduling level
#!/bin/sh
cat > PrintAvailableProcs.java <<EOF
public class PrintAvailableProcs {
public static void main(String[] args) {
System.out.println(Runtime.getRuntime().availableProcessors());
}
}
EOF
javac PrintAvailableProcs.java
@nicoulaj
nicoulaj / clean-hsperfdata.sh
Created August 7, 2012 15:08
Clean Java hsperfdata files
#!/bin/sh
# Looks for /tmp/hsperfdata_* files leaved by unclean Java processes
# shutdowns and remove them.
# This should be executed by a user without sufficient rights to delete
# other users files...
for hsperfdata in /tmp/hsperfdata_*/*; do
ps -p `basename ${hsperfdata}` &> /dev/null || rm -vf $hsperfdata
done
@nicoulaj
nicoulaj / steam-clean.bat
Created May 2, 2012 20:21
Clean Steam install files
@echo off
REM This one-liner does the same as http://sourceforge.net/projects/tikione
for /R "C:\Program Files (x86)\Steam\steamapps" %%I in ("") do if exist "%%~dpIredist" rmdir /s /q "%%~dpIredist"