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
private static Properties readUtf8Properties(Path path) throws IOException { | |
final Properties properties = new Properties(); | |
final int UTF8_BOM = (int) '\uFEFF'; | |
try (final BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) { | |
reader.mark(1); | |
if (reader.read() != UTF8_BOM) { | |
reader.reset(); | |
} | |
properties.load(reader); | |
} |
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
// adapted from MIT licensed handlebars | |
var escape = { | |
'&': '&', | |
'<': '<', | |
'>': '>', | |
'"': '"', | |
"'": ''', | |
'`': '`', | |
'=': '=', |
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 xyz; | |
import java.io.Writer; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import javax.xml.stream.XMLOutputFactory; | |
import javax.xml.stream.XMLStreamWriter; | |
public class Main { |
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.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.charset.StandardCharsets; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import javax.xml.transform.OutputKeys; | |
import javax.xml.transform.Result; |
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 class DeflateUtil { | |
public static byte[] compressBytes(final byte[] input) { | |
final ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |
final byte[] buf = new byte[1024]; | |
final Deflater compresser = new Deflater(Deflater.BEST_COMPRESSION); | |
compresser.setInput(input); | |
compresser.finish(); | |
while (!compresser.finished()) { | |
final int compressedDataLength = compresser.deflate(buf); | |
bos.write(buf, 0, compressedDataLength); |
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
<?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> | |
<groupId>x</groupId> | |
<artifactId>y</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>y</name> |
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
System\.out\.printf\("([^%]*?)%s([^%]*?)%n"(,[^,]*?)\); | |
logger.info("$1{}$2"$3); | |
System\.out\.println\((".*?")\); | |
logger.info($1); | |
System\.out\.printf\((".*?",.*?)\); | |
logger.info(String.format($1)); | |
<dependency> |
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
private static void printBytesAsByteArray(String name, byte[] bytes) { | |
StringBuilder sb = new StringBuilder(); | |
sb.append("byte[] ").append(name).append(" = new byte[] {"); | |
if (bytes.length != 0) { | |
int i = 0; | |
for (byte aByte : bytes) { | |
if (i == 0) { | |
sb.append("\n "); | |
} |
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
<profiles> | |
<profile> | |
<id>draft</id> | |
<properties> | |
<!-- org.apache.maven.plugins:maven-surefire-plugin | |
org.apache.maven.plugins:maven-failsafe-plugin --> | |
<skipTests>true</skipTests> | |
<maven.test.skip>true</maven.test.skip> | |
<!-- org.apache.maven.plugins:maven-enforcer-plugin --> | |
<enforcer.skip>true</enforcer.skip> |
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
SELECT name, | |
modifieddate, | |
( | |
( | |
(TIMESTAMP '1970-01-01 00:00:00 UTC') | |
+ NUMTODSINTERVAL(modifieddate/1000, 'SECOND') | |
) AT TIME ZONE 'Europe/Brussels' | |
) AS "Date", | |
TRUNC( | |
( |