Skip to content

Instantly share code, notes, and snippets.

Avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / .gitconfig
Created Aug 11, 2011
Default Git global config fule
View .gitconfig
[user]
name = <committer name>
email = <email address>
[gui]
encoding = utf-8
[core]
autocrlf = off
ignorecase = true
[format]
pretty = format:%h %cr %cN: %s
@eeichinger
eeichinger / gist:1956717
Created Mar 2, 2012
Enable global statement result listeners in Esper
View gist:1956717
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 / LazyBeanDefinitionDocumentReader.java
Created Mar 5, 2012
enforce loading spring beans with default-lazy-init=true
View LazyBeanDefinitionDocumentReader.java
public class LazyBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {
@Override
protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root, BeanDefinitionParserDelegate parentDelegate) {
root.setAttribute("default-lazy-init", "true");
BeanDefinitionParserDelegate delegate = super.createHelper(readerContext, root, parentDelegate);
return delegate;
}
}
@eeichinger
eeichinger / winupdatefix.cmd
Created Mar 8, 2012
Windows Update Fix Script
View winupdatefix.cmd
rem windows update fix
rem taken from http://www.akaplan.com/blog/wp-content/uploads/2011/11/WindowsUpdateFix_cmd.txt
ipconfig /flushdns
Cd /d %windir%
del /s *.chk;*.rip;*.tmp;~*.*
msiexec /regserver
sc config msiserver start= auto
net stop msiserver
msiexec /unreg
@eeichinger
eeichinger / pom.xml
Created May 14, 2012
configure maven-compiler-plugin with different compilers
View pom.xml
<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 / ConcordionSpringJunit4ClassRunner.java
Created May 17, 2012
Spring Test / Concordion integration - integrate Concordion with Spring's test runner
View ConcordionSpringJunit4ClassRunner.java
package testsupport;
import org.concordion.api.ResultSummary;
import org.concordion.internal.FixtureRunner;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@eeichinger
eeichinger / LogbackSocketHubAppender.java
Created Nov 26, 2012
A logback SocketHubAppender implementation - shamelessly stolen from log4j and adapted to logback. Just copy & paste into your project
View LogbackSocketHubAppender.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@eeichinger
eeichinger / MapBuilderSupport
Last active Dec 10, 2015
A Fluent API for manipulating java Maps. Useful for e.g. creating header maps in REST responses.
View MapBuilderSupport
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 / UnhandledExceptionFilter.java
Last active Apr 1, 2016
Suppress calls to sendError to prevent servlet containers from sending error pages to the client
View UnhandledExceptionFilter.java
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 / update_vagrant_vsphere_plugin.sh
Created Nov 1, 2013
vagrant-vsphere plugin - build script
View update_vagrant_vsphere_plugin.sh
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