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 / build.gradle
Created August 22, 2019 06:02
Update Jackson's BOM in Spring Boot with Gradle
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
//JAVA 17
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.neo4j.driver:neo4j-java-driver:5.2.0
import java.util.List;
import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.GraphDatabase;
// You need to import the Neo4j record, otherwise you will have ambiguous imports
import org.neo4j.driver.Record;
# Most interactions / mentions, excluding myself.
{ sed -e '1s/.*/[/' -e '$d' tweets.js && sed '1s/.*/,/' tweets-part1.js; } | \
jq '
[.[].tweet.entities.user_mentions[] | select(.screen_name != "rotnroll666") | {handle: .screen_name}] |
group_by(.handle) | map(.[0] + {"count": length}) |
sort_by(-.count,.handle|=ascii_downcase) | limit(20;.[]) |
"@\(.handle) (\(.count))"
'
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;
@michael-simons
michael-simons / Neo4jGraphqlJava.java
Last active September 15, 2022 12:23
Brings up a Neo4jGraphQL Java server.
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 16
//JAVAC_OPTIONS -source 16
//DEPS info.picocli:picocli:4.6.1
//DEPS io.javalin:javalin:3.13.9
//DEPS org.neo4j.driver:neo4j-java-driver:4.3.3
//DEPS org.neo4j:neo4j-graphql-java:1.3.0
//DEPS com.fasterxml.jackson.core:jackson-databind:2.10.5
//DEPS org.slf4j:slf4j-simple:1.7.31
package com.example.graphqlplain;
@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;

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