Skip to content

Instantly share code, notes, and snippets.

View eeichinger's full-sized avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / git toolkit
Last active March 29, 2024 06:18
Recursively execute git commands, find unpushed commits, ...
#
# 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 / readme.md
Last active October 16, 2023 14:26
Pimp my OSX - list of tools & utilities on OSX I can't live without
@eeichinger
eeichinger / assertThatWithSpinWait.java
Last active August 12, 2016 17:19
in asychronous test cases it sometimes is necessary to wait for a condition to occur
@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 / Immutable Data Types with Jackson and Lombok.md
Last active February 7, 2019 15:56
Example tests and notes for making Jackson work with Lombok

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 / Observable#zipN.java
Created September 24, 2016 11:17
typed Observable.zipN for input observables of same type
@SuppressWarnings("unchecked")
static <R, T> Observable<R> zip(Iterable<? extends Observable<T>> ws, Func1<List<T>, ? extends R> zipFunction) {
FuncN<R> funcN = (Object[] array) -> {
List<T> l = new ArrayList<T>();
for (Object o : array) {
l.add((T) o);
}
return zipFunction.call(l);
};
@eeichinger
eeichinger / CachingCloseableHttpAsyncClientTest.java
Last active October 7, 2016 08:44
experiment testing Apache HttpAsyncClient HttpCache behaviour
package de.porsche.pcc.instrumentation;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpException;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
@eeichinger
eeichinger / jenkins-decrypt.groovy
Created October 19, 2016 19:36 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password
#To Decrypt Jenkins Password from credentials.xml
#<username>jenkins</username>
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase>
#go to the jenkins url
http://jenkins-host/script
#In the console paste the script
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J'
@eeichinger
eeichinger / resolve_paths.sh
Created April 19, 2017 17:37
Various ways to resolve a script path in bash
#!/usr/bin/env bash
#
# For my own reference in the future demo's various ways to resolve a script's full qualified path
# Usage: copy this file to /tmp/resolve_paths_demo.sh and run it from root
#
# Note: this script uses the 'realpath' utility - to get this on OSX, you need to install 'brew install coreutils'
if [ -z "${doit+x}" ]; then # for if [exists $var] technique, see http://stackoverflow.com/a/13864829/51264
scriptfilereal=$(realpath -P "$0")
@eeichinger
eeichinger / generate_clone_all_bitbucket_repos.sh
Last active March 26, 2024 20:57
script to clone all repositories in a bitbucket server (aka stash) project
# this script uses syntax for bitbucket server.
# For bitbucket cloud see https://confluence.atlassian.com/bitbucket/use-the-bitbucket-cloud-rest-apis-222724129.html
#
# Note: replace username, password and PROJECTNAME with your values
USERNAME=xxxx
PASSWORD=xxxx
PROJECTNAME=xxxxx
# jq syntax helpful links:
@eeichinger
eeichinger / .profile_aws.sh
Created May 1, 2017 11:32
AWS CLI utilities to hook into e.g. ~/.profile
# it's inconvenient to pollute knownhosts with temporary AWS EC2 instances - use aws_ssh instead of ssh to ssh into EC2 instances
alias aws_ssh='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
#
# This function allows to easily switch between AWS CLI profiles. If necessary, it will assume the given role
#
# usage:
# set-aws-profile rolename[@accountname]
#
# "rolename": the profilename as defined in your ~/.aws/config