Skip to content

Instantly share code, notes, and snippets.

View helpermethod's full-sized avatar
⌨️
hacking

Oliver Weiler helpermethod

⌨️
hacking
View GitHub Profile
@helpermethod
helpermethod / assorted-scripts.md
Last active June 9, 2019 14:08
Assorted Bash scripts
# kill all processes listening on port 2181
lsof -i :2181 | tail  -n+2 | awk '{ print $2 }' | xargs kill -9
@helpermethod
helpermethod / kick-ass-cd.md
Last active July 25, 2019 13:12
Kick ass CD with Maven CI friendly versions and GitLab CI

Maven CI friendly versions

Speed up initial checkouts with shallow cloning

❓ Does GitLabCI skip shallow clones on merge requests?

variables:
  DEPTH: 1
@helpermethod
helpermethod / grit.md
Last active September 16, 2019 07:01
grit - a modern jgit wrapper

grit.commit(g -> g .message("") .author() );

@helpermethod
helpermethod / json-schema.java
Created September 2, 2019 15:29
JSON Serializer which infers schema
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.kafka.common.errors.SerializationException;
import org.apache.kafka.common.serialization.Serializer;
import org.apache.kafka.connect.data.Timestamp;
import java.lang.reflect.Field;
public class PhoneNumber {
private final String areaCode;
private final String phoneNumber;
private PhoneNumber(String areaCode, String phoneNumber) {
this.areaCode = areaCode;
this.phoneNumber = phoneNumber;
}
public static PhoneNumber create(String areaCode, String phoneNumber) {
@helpermethod
helpermethod / pipe.groovy
Last active March 11, 2020 11:37
A pipe function in 7 lines of Groovy
def pipe(fn, ...fns) {
return {
fns.inject(fn(it)) { acc, value ->
value(acc)
}
}
}
@helpermethod
helpermethod / sdkman-local.sh
Last active March 3, 2020 00:45
.sdkrc support for sdkman
#!/usr/bin/env bash
__sdk_local() {
[[ ! -f .sdkrc ]] || return
local line
while IFS= read -r line; do
local candidate=${line%=*}
local version=${line#*=}