Skip to content

Instantly share code, notes, and snippets.

Michael Simons michael-simons

Block or report user

Report or block michael-simons

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@michael-simons
michael-simons / log4j2.xml
Created Jun 28, 2019
log4j: Route only subpackage to different appender
View log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Appenders>
<Console name="ConsoleAppenderA" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="mainlog> %m%n%ex"/>
</Console>
<Console name="ConsoleAppenderB" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="sublog> %m%n%ex"/>
</Console>
View WIthInitializer
@NeedsCausalCluster
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration(initializers = { BookmarkLoadTest.Initializer.class })
public class BookmarkLoadTest {
@Neo4jUri
private static String clusterUri;
static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
View gist:437c17847012e8e1f6ba7c0572346945
Ich guck hier auf den Stack drauf und verstehe ihn nicht:
```
2019-03-19 14:27:52,947 INFO [io.quarkus] (main) Quarkus 0.11.0 started in 0.036s. Listening on: http://127.0.0.1:8080
2019-03-19 14:27:52,991 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb]
WARNING: The sunec native library, required by the SunEC provider, could not be loaded. This library is usually shipped as part of the JDK and can be found under <JAVA_HOME>/jre/lib/<platform>/libsunec.so. It is loaded at run time via System.loadLibrary("sunec"), the first time services from SunEC are accessed. To use this provider's services the java.library.path system property needs to be set accordingly to point to a location that contains libsunec.so. Note that if java.library.path is not set it defaults to the current working directory.
2019-03-19 14:27:55,597 INFO [Driver] (XNIO-1 task-1) Direct driver instance 1633194162 created for server address localhost:7687
2019-03-19 14:27:55,598 WARNING [org.neo.dri.int.sha.io.net
View Doublecheck.java
// Double-check idiom for lazy initialization of instance fields
private volatile FieldType field;
private FieldType getField() {
FieldType result = field;
if (result == null) { // First check (no locking)
synchronized(this) {
if (field == null) // Second check (with locking)
field = result = computeFieldValue();
View load-connections.cypher
WITH 2407988 as parentRel
MATCH (p:Network {externalId: parentRel})
WITH p
CALL apoc.load.xml("https://api.openstreetmap.org/api/0.6/relation/" + p.externalId + "/full") YIELD value AS v
WITH p, [c IN v._children WHERE c._type = 'relation' AND ANY (t IN c._children WHERE t._type = 'tag' and t.k = 'network' and t.v = 'rcn')] as relations
SET p.name = [r IN relations WHERE r.id = toString(p.externalId) | [t IN r._children WHERE t._type = 'tag' and t.k = 'name' | t.v][0] ][0]
WITH p, relations
UNWIND relations AS relation
WITH p, [t IN relation._children WHERE t._type = 'tag' and t.k ='note' and t.v =~ "\\d+-\\d+"] as connection
WHERE size(connection) = 1
@michael-simons
michael-simons / Test.java
Created Sep 19, 2018
JDK11 String#isBlank and Predicate.not
View Test.java
import java.util.List;
import java.util.function.Predicate;
public class Test {
public static void main(String...a) {
var strings = List.of("foo", " ", "bar", "", "\t");
var isNotBlank = Predicate.not(String::isBlank);
strings.stream().filter(isNotBlank).forEach(System.out::println);
}
}
@michael-simons
michael-simons / META-INF_slash_spring.factories
Created Sep 18, 2018
A quick scribble how to provide defaults for configuration properties in Spring Boot without defaulting. to them in code or condig
View META-INF_slash_spring.factories
org.springframework.boot.diagnostics.FailureAnalyzer=\
com.example.propswithdefault.MyFailureAnalyzer
@michael-simons
michael-simons / Application.kt
Last active Jul 4, 2019
Minimal Kotlin/Gradle Example for Neo4j OGM
View Application.kt
package so
import org.neo4j.ogm.annotation.GeneratedValue
import org.neo4j.ogm.annotation.Id
import org.neo4j.ogm.annotation.NodeEntity
import org.neo4j.ogm.annotation.Relationship
import org.neo4j.ogm.config.Configuration
import org.neo4j.ogm.session.SessionFactory
@NodeEntity
@michael-simons
michael-simons / TransactionandcustomsessionApplication.java
Created Aug 28, 2018
Use Spring Data Neo4js injectable OGM Session
View TransactionandcustomsessionApplication.java
package soquestions.transactionandcustomsession;
import java.util.Map;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.session.Session;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.neo4j.annotation.Query;
@michael-simons
michael-simons / CustomPagerequestApplication.java
Created Aug 28, 2018
Enforce a concrete implementation of Pageable for paged Queries with Spring Data (Neo4j)
View CustomPagerequestApplication.java
package soquestions.custompagerequest;
import static java.util.stream.Collectors.*;
import java.io.Serializable;
import java.util.stream.IntStream;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.session.Session;
import org.springframework.boot.CommandLineRunner;
You can’t perform that action at this time.