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 / ThingEntity.java
Last active Jan 27, 2020
An example on how to use Hibernate-Spatial with Spring Data JPA Repositories
View ThingEntity.java
@Entity
@Table(name = "things")
public class ThingEntity {
@Id
private Long id;
// Needed for use with Hibernate Spatial 4.x
// @Type(type = "org.hibernate.spatial.GeometryType")
private Geometry geometry;
@michael-simons
michael-simons / batch-rsync.sh
Created Jan 24, 2020
zsh script for "batching" rsync of a large tree alphabetically
View batch-rsync.sh
#!/bin/zsh
for x in {a..z}
do
rsync --delete -cav --include="[${x}${x:u}]*/***" --exclude="*" /largeSourceFolder/ /Backup/
done
@michael-simons
michael-simons / DemoApplication.java
Last active Dec 22, 2019
Simple JDK 11+ HTTP Client usage, POST'ing formdata
View DemoApplication.java
package com.example.demo;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse.BodyHandlers;
View PlainAccessToAura.java
import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Config;
import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.Session;
public class AccessAura {
public static void main(String... a) {
Config config = Config.builder().withEncryption().build();
View Dafuq.java
import static java.lang.System.*;
public class Dafuq {
public static void main(String[] args) {
/*
\u002a\u002f
\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u004e\u006f\u0022\u0029\u003b
\u000d\u000a\u0065\u0078\u0069\u0074\u0028\u0030\u0029\u003b
\u002f\u002a
@michael-simons
michael-simons / README.md
Last active Nov 1, 2019
Detect and migrate string properties of nodes to dedicated types
View README.md
View gist:46d69881e04665935bb3b7520a48be61
<script th:inline="javascript">
/*<![CDATA[*/
...
var username = /*[[${session.user.name}]]*/ 'Sebastian';
...
/*]]>*/
</script>
@michael-simons
michael-simons / ExecutableSyntaxTest.java
Last active Aug 30, 2019
JS, Ruby, Python and R versions of Graal Values that are immediately executable
View ExecutableSyntaxTest.java
package scripts;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
import org.junit.jupiter.api.Test;
/**
@michael-simons
michael-simons / build.gradle
Created Aug 22, 2019
Update Jackson's BOM in Spring Boot with Gradle
View build.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'
View EnumTests.java
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
class EnumTests {
enum YourFriendlyEnumMostPeopleUse {
THING1, THING2
}
You can’t perform that action at this time.