Skip to content

Instantly share code, notes, and snippets.

Erich Eichinger eeichinger

Block or report user

Report or block eeichinger

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
@eeichinger
eeichinger / Makefile
Created Apr 3, 2019
Makefile 'init' target for setting up a virtual python environment (using pyenv)
View Makefile
# automatically initialise a local python env
# requires:
# - pyenv installed (see https://github.com/pyenv/pyenv)
# - ./requirements.txt to manage dependencies via pip
PYENV_VERSION:="3.7.2"
all: init
.PHONY: clean
View file_encode_decode_base64.py
# from https://stackoverflow.com/questions/22734401/base64-encode-decode-to-from-files-in-chunks-with-python-2-7
#
# write_base64_file_from_file
# write_file_from_base64_file
# - must run with python 2.7
# - must process data in chunks to limit memory consumption
# - base64 data must be JSON compatible, i.e.
# use base64 "modern" interface,
# not base64.encodestring() which contains linefeeds
#
@eeichinger
eeichinger / clone-repos-generate.sh
Last active Jul 19, 2019
Generate a script to clone all repos within a specific project from bitbucket server and bitbucket cloud
View clone-repos-generate.sh
# generate a script ./clone-repos.sh from a list of repos fetched via Bitbucket API
# note: requires 'curl' and 'jq' to be installed
set -e
echo -n '' > clone-repos.sh
chmod +x clone-repos.sh
ONPREM_USER=xxxxx
ONPREM_PASS=......
View keybase.md

Keybase proof

I hereby claim:

  • I am eeichinger on github.
  • I am eeichinger (https://keybase.io/eeichinger) on keybase.
  • I have a public key ASDxtzTW3lx3A2x-vRF-8yIANoqhSNzFcuSP2Hc6Ok9xuwo

To claim this, I am signing this object:

@eeichinger
eeichinger / .profile_aws.sh
Created May 1, 2017
AWS CLI utilities to hook into e.g. ~/.profile
View .profile_aws.sh
# 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
@eeichinger
eeichinger / generate_clone_all_bitbucket_repos.sh
Last active Aug 15, 2018
script to clone all repositories in a bitbucket server (aka stash) project
View generate_clone_all_bitbucket_repos.sh
# 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 / resolve_paths.sh
Created Apr 19, 2017
Various ways to resolve a script path in bash
View resolve_paths.sh
#!/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")
View jenkins-decrypt.groovy
#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 / CachingCloseableHttpAsyncClientTest.java
Last active Oct 7, 2016
experiment testing Apache HttpAsyncClient HttpCache behaviour
View CachingCloseableHttpAsyncClientTest.java
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 / Observable#zipN.java
Created Sep 24, 2016
typed Observable.zipN for input observables of same type
View Observable#zipN.java
@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);
};
You can’t perform that action at this time.