Skip to content

Instantly share code, notes, and snippets.

Avatar

nicoulaj

  • France
View GitHub Profile
View docker-compose.yml
version: '2.2'
networks:
traefik:
external: true
guacamole:
external: true
services:
guacamole:
View ComparatorCheck.java
/**
* 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 Dec 3, 2016
PointsCloud VM environment
@nicoulaj
nicoulaj / test-master.sh
Created Jun 2, 2016
SGE -notify and -inherit
View test-master.sh
#!/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
View ArrayListBenchmark.java
public class ArrayListAddBenchmark extends ListBenchmark {
@Override
protected List<Object> newInstance() {
return new ArrayList<Object>();
}
}
@nicoulaj
nicoulaj / pom.xml
Created May 4, 2013
Using JMH in a Maven project.
View pom.xml
<?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 Sep 20, 2012
What signals can your JRE handle ?
View java-signals-test.sh
#!/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 Sep 6, 2012
Runtime.availableProcessors() gives info about available resources, not affinity which occurs at scheduling level
View java-cpu-affinity-unaware.sh
#!/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 Aug 7, 2012
Clean Java hsperfdata files
View clean-hsperfdata.sh
#!/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
Clean Steam install files
View steam-clean.bat
@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"
You can’t perform that action at this time.