Skip to content

Instantly share code, notes, and snippets.

Avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / Immutable Data Types with Jackson and Lombok.md
Last active Feb 7, 2019
Example tests and notes for making Jackson work with Lombok
View Immutable Data Types with Jackson and Lombok.md

Examples for getting Jackson and Lombok to work together to create immutable data types.

Demonstrates use of:

  • Nullable Types
  • Optional
  • immutable java.util.List
  • immutable array
  • validating custom types on instantiate/unmarshalling
  • use & customize Lombok-@Builder with Jackson
@eeichinger
eeichinger / assertThatWithSpinWait.java
Last active Aug 12, 2016
in asychronous test cases it sometimes is necessary to wait for a condition to occur
View assertThatWithSpinWait.java
@SneakyThrows
private static <T> void assertThatWithSpinWait(Callable<T> actual, Matcher<? super T> matcher, long timeoutMillis) {
long endMillis = System.currentTimeMillis() + timeoutMillis;
while (System.currentTimeMillis() < endMillis) {
try {
assertThat("", actual.call(), matcher);
return;
} catch (AssertionError ignored) {
// ignore
}
@eeichinger
eeichinger / readme.md
Last active Sep 30, 2020
Pimp my OSX - list of tools & utilities on OSX I can't live without
View readme.md
@eeichinger
eeichinger / git toolkit
Last active Jul 11, 2022
Recursively execute git commands, find unpushed commits, ...
View git toolkit
#
# Description:
# Various additional git utility commands
#
# git recursive <command>:
# from the current working folder search recursively for local git repos and run 'git <command>' on each of them.
#
# git recursive-exec <command>:
# from the current working folder search recursively for local git repos and run '<command>' on each of them.
#
@eeichinger
eeichinger / git_cheatsheet.adoc
Last active Jun 29, 2016
Git Cheatsheet - git commands I found useful every day
@eeichinger
eeichinger / iswin.py
Created Jun 14, 2016
Python script to enum OSX windows and corresponding process id
View iswin.py
#!/usr/bin/env python
# from https://github.com/sjitech/mac_list_windows_pids/blob/master/lswin.py
# requires Quartz framework installed
# $pip install pyobjc-framework-Quartz
import Quartz
#wl = Quartz.CGWindowListCopyWindowInfo( Quartz.kCGWindowListOptionOnScreenOnly | Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID)
wl = Quartz.CGWindowListCopyWindowInfo( Quartz.kCGWindowListOptionAll, Quartz.kCGNullWindowID)
View sample-resttemplate_pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-resttemplate</artifactId>
<groupId>com.github.eeichinger.blogs</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@eeichinger
eeichinger / example_request.java
Last active Jun 28, 2018
Apache HttpClient 4.5.x Usage with NTLM Proxy Authentication, ignore SSL Certificate
View example_request.java
@Test
public void fetch_something() throws Exception {
URI uri = UriBuilder.fromPath(path)
.resolveTemplates(ImmutableMap.<String, Object>builder()
.put("country", VALID_COUNTRY)
.put("language", VALID_LANGUAGE)
.build()
)
.build();
@eeichinger
eeichinger / mapping.json
Last active Jan 15, 2016
Wiremock un-gzip recorded traffic
View mapping.json
{
"priority": 10,
"request": {
"method": "ANY",
"urlPattern": ".*"
},
"response": {
"proxyBaseUrl" : "https://other.com",
"additionalProxyRequestHeaders": {
"Accept-Encoding": "identity"
@eeichinger
eeichinger / SomeTest_with_wiremockrule.java
Last active Jan 15, 2016
Use WireMockRule in Recording mode against a https backend
View SomeTest_with_wiremockrule.java
@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig()
.port(0)
.trustStorePath("/path/to/my/keystore.jks")
.trustStorePassword("changeit")
) {
{
enableRecordMappings();
}