This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Departement INSEE | Region INSEE | Departement ISO | Region ISO | Departement | Region | |
---|---|---|---|---|---|---|
01 | 84 | FR-01 | FR-ARA | Ain | Auvergne-Rhône-Alpes | |
02 | 32 | FR-02 | FR-HDF | Aisne | Hauts-de-France | |
03 | 84 | FR-03 | FR-ARA | Allier | Auvergne-Rhône-Alpes | |
04 | 93 | FR-04 | FR-PAC | Alpes-de-Haute-Provence | Provence-Alpes-Côte d'Azur | |
05 | 93 | FR-05 | FR-PAC | Hautes-Alpes | Provence-Alpes-Côte d'Azur | |
06 | 93 | FR-06 | FR-PAC | Alpes-Maritimes | Provence-Alpes-Côte d'Azur | |
07 | 84 | FR-07 | FR-ARA | Ardèche | Auvergne-Rhône-Alpes | |
08 | 44 | FR-08 | FR-GES | Ardennes | Grand Est | |
09 | 76 | FR-09 | FR-OCC | Ariège | Occitanie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Objects; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
/** | |
* Only these three version shemes are supported: | |
* <ul> | |
* <li>major[.minor[.incremental]][-buildnumber]</li> | |
* <li>major[.minor[.incremental]][-qualifier]</li> | |
* <li>qualifier</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spike; | |
import com.sun.net.httpserver.Filter; | |
import com.sun.net.httpserver.HttpHandler; | |
import com.sun.net.httpserver.HttpServer; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.net.InetSocketAddress; | |
import java.nio.charset.StandardCharsets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM install a certificate | |
REM ======================= | |
set KEYTOOL=C:\Workspace\opt\Java\jdk1.8.0_162\bin\keytool | |
set FILE=D:\home\kristof\Downloads\wildca.cer | |
set KEYSTORE=C:\Workspace\opt\Java\jdk1.8.0_162\jre\lib\security\cacerts | |
set ALIAS=certinga.wildca.intermediate | |
%KEYTOOL% -import -trustcacerts ^ | |
-alias %ALIAS% ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.time.ZonedDateTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usage | |
final List<String> x = findByX( | |
"select dummy FROM dual WHERE dummy = ?", | |
ps -> ps.setString(1, "X"), | |
rs -> rs.getString("dummy")); | |
private static <T> List<T> findByX(String sql, ThrowingConsumer<PreparedStatement> parameterSetter, ThrowingFunction<ResultSet, T> rowMapper) { | |
try (final Connection con = ds.getConnection(); | |
final PreparedStatement ps = con.prepareStatement(sql)) { | |
ps.setQueryTimeout(10 /*seconds*/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static byte[] compress(final byte[] bytes) throws IOException { | |
if (bytes == null || bytes.length == 0) { | |
return new byte[0]; | |
} | |
final ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
try (final OutputStream gzip = new GZIPOutputStream(out)) { | |
gzip.write(bytes); | |
} | |
return out.toByteArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.TimeUnit; | |
public class Chronometer implements Comparable<Chronometer> { | |
boolean started = false; | |
boolean stopped = false; | |
long start; | |
long end; | |
public void start() { | |
started = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
final ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |
final XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(bos); | |
writer.writeStartDocument("UTF-8", "1.0"); | |
writer.writeStartElement("a"); | |
writer.writeDefaultNamespace(NS); | |
writer.writeStartElement("b"); | |
writer.writeStartElement("c"); | |
writer.writeCharacters("d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
magick img.png -background #FFFFFF -rotate 0 -crop 64x64+0+0 page0.png | |
magick img.png -background #FFFFFF -rotate 10 -crop 64x64+0+0 page10.png | |
magick img.png -background #FFFFFF -rotate 20 -crop 64x64+0+0 page20.png | |
magick img.png -background #FFFFFF -rotate 30 -crop 64x64+0+0 page30.png | |
magick img.png -background #FFFFFF -rotate 40 -crop 64x64+0+0 page40.png | |
magick img.png -background #FFFFFF -rotate 50 -crop 64x64+0+0 page50.png | |
magick img.png -background #FFFFFF -rotate 60 -crop 64x64+0+0 page60.png | |
magick img.png -background #FFFFFF -rotate 70 -crop 64x64+0+0 page70.png | |
magick img.png -background #FFFFFF -rotate 80 -crop 64x64+0+0 page80.png | |
magick img.png -background #FFFFFF -rotate 90 -crop 64x64+0+0 page90.png |