Skip to content

Instantly share code, notes, and snippets.

View eeichinger's full-sized avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / start_wait.sh
Created April 1, 2015 14:15
Tomcat start & wait until success
#!/bin/sh
# Usage:
# start_wait <modulename> <servername>
# Default vals for args
# http://stackoverflow.com/questions/9332802/how-to-write-a-bash-script-that-takes-optional-input-arguments
TIMEOUT=90
@eeichinger
eeichinger / CatchOperatorTest.java
Created May 20, 2015 05:56
an rxjava catch-like operator
package myrx;
import org.junit.Test;
import rx.Observable;
import rx.Producer;
import rx.Subscriber;
import rx.exceptions.Exceptions;
import rx.functions.Func1;
import rx.plugins.RxJavaPlugins;
@eeichinger
eeichinger / pom.xml
Created May 20, 2015 08:34
maven plugins to compile java 1.8 syntax but target jvm 1.7
<!--
compile java 1.8, target java 1.7
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<encoding>utf-8</encoding>
<source>1.8</source>
@eeichinger
eeichinger / pom.xml
Created May 20, 2015 08:42
A pom template, use for- set file encoding- compile java 8, target java 7 jvm- embed manifests with jenkins build info into jar and war- configure enforcer plugin- define various commonly used libs + versions (slf4j, logback, logstash, spring, spring-cloud, hystrix, rxjava, dropwizard, concordion, wiremock, guava, jolokia)
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>@@GROUPID@@</groupId>
<artifactId>@@ARTIFACTID@@</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>
A default pom template - use for
- set file encoding
@eeichinger
eeichinger / SomeTest_with_wiremockrule.java
Last active January 15, 2016 16:34
Use WireMockRule in Recording mode against a https backend
@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig()
.port(0)
.trustStorePath("/path/to/my/keystore.jks")
.trustStorePassword("changeit")
) {
{
enableRecordMappings();
}
@eeichinger
eeichinger / mapping.json
Last active January 15, 2016 16:37
Wiremock un-gzip recorded traffic
{
"priority": 10,
"request": {
"method": "ANY",
"urlPattern": ".*"
},
"response": {
"proxyBaseUrl" : "https://other.com",
"additionalProxyRequestHeaders": {
"Accept-Encoding": "identity"
@eeichinger
eeichinger / example_request.java
Last active June 28, 2018 08:15
Apache HttpClient 4.5.x Usage with NTLM Proxy Authentication, ignore SSL Certificate
@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 / sample-resttemplate_pom.xml
Created May 5, 2016 12:06
resttemplate usage sample
<?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 / iswin.py
Created June 14, 2016 15:56
Python script to enum OSX windows and corresponding process id
#!/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)
@eeichinger
eeichinger / git_cheatsheet.adoc
Last active June 29, 2016 12:39
Git Cheatsheet - git commands I found useful every day