Skip to content

Instantly share code, notes, and snippets.

View michael-simons's full-sized avatar
πŸ‘‹

Michael Simons michael-simons

πŸ‘‹
View GitHub Profile
@michael-simons
michael-simons / checkstyle.xml
Created September 14, 2022 08:49
Checkstyle config enforcing tabs but allowing leading spaces in text blocks.
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value='=\s+"""'/>
<property name="onCommentFormat" value='^\s+.*""";'/>
import java.lang.reflect.Method;
import java.util.stream.Collectors;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Tag;
import org.junit.platform.commons.util.AnnotationUtils;
final class SimpleDisplayNameGeneratorWithTags extends DisplayNameGenerator.Simple {
@Override
@michael-simons
michael-simons / format_cypher.java
Created June 2, 2022 19:34
A simple formatter for Cypher.
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17
//DEPS info.picocli:picocli:4.6.3
//DEPS org.neo4j:neo4j-cypher-dsl-parser:2022.4.0
import picocli.CommandLine;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17
//DEPS info.picocli:picocli:4.6.3
package df;
import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Option;
import picocli.CommandLine.ParameterException;
import picocli.CommandLine.Spec;
WITH duplicate_checksums AS (
SELECT MD5 FROM file_duplicates_develop.files
GROUP BY MD5 HAVING COUNT(*) > 1
)
SELECT * FROM file_duplicates_develop.files
WHERE MD5 = duplicate_checksums.MD5
ORDER BY -Size, MD5;

Howto serialize and deserialize cyclomatic references in Java objects with Jacksons to and from JSON

@michael-simons
michael-simons / README.md
Created March 23, 2022 11:37
Filtering contents of fileB.json with information from fileA.json
@michael-simons
michael-simons / import_tgf_recursive.java
Created March 20, 2022 19:24
Create a bunch of Trivial Graph Format (tgf) files from Maven and import them into Neo4j.
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17
//DEPS info.picocli:picocli:4.6.3
//DEPS org.neo4j.driver:neo4j-java-driver:4.4.5
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
@michael-simons
michael-simons / Peng.java
Created January 1, 2022 20:12
Add text with emojis to an image
import java.awt.Color;
import java.awt.Font;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Peng {
public static void main(String... a) throws IOException {
@michael-simons
michael-simons / jfr-agent.xml
Created December 21, 2021 09:23
JFR Agent description to emit events when queries are executed via Neo4j Java Driver
<?xml version="1.0" encoding="UTF-8"?>
<jfragent>
<config>
<classprefix>__JFREvent</classprefix>
<allowtostring>true</allowtostring>
<allowconverter>true</allowconverter>
</config>
<events>
<event id="bolt.TemplatedQueryRun">
<label>Templated queries</label>