Skip to content

Instantly share code, notes, and snippets.

View eeichinger's full-sized avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / gist:1956717
Created March 2, 2012 08:13
Enable global statement result listeners in Esper
Configuration config = new Configuration();
// must select both streams to get oldEvents as well
config.getEngineDefaults().getStreamSelection().setDefaultStreamSelector(StreamSelector.RSTREAM_ISTREAM_BOTH);
AuditPath.isAuditEnabled = true;
// get serviceProvider and register global statement result listener to get notified of all events created or removed
epService = EPServiceProviderManager.getDefaultProvider(config);
EPServiceProviderSPI spi = (EPServiceProviderSPI) epService;
((MetricReportingServiceSPI)spi.getMetricReportingService()).addStatementResultListener(new StatementResultListener() {
@eeichinger
eeichinger / pom.xml
Created May 14, 2012 22:56
configure maven-compiler-plugin with different compilers
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<!--<compilerId>javac</compilerId>-->
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
@eeichinger
eeichinger / MapBuilderSupport
Last active December 10, 2015 13:48
A Fluent API for manipulating java Maps. Useful for e.g. creating header maps in REST responses.
package utils;
import org.springframework.util.MultiValueMap;
import java.util.List;
import java.util.Map;
/**
* A Fluent API for manipulating arbitrary maps<br/>
*<br/>
@eeichinger
eeichinger / update_vagrant_vsphere_plugin.sh
Created November 1, 2013 11:07
vagrant-vsphere plugin - build script
mkdir ~/tmpbuild
cd ~/tmpbuild
git clone git://github.com/nsidc/vagrant-vsphere.git
cd vagrant-vsphere
gem build vSphere.gemspec
vagrant plugin install vagrant-vsphere-0.0.1
@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 / UnhandledExceptionFilter.java
Last active April 1, 2016 11:20
Suppress calls to sendError to prevent servlet containers from sending error pages to the client
package servletutils;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@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