Skip to content

Instantly share code, notes, and snippets.

View eeichinger's full-sized avatar

Erich Eichinger eeichinger

View GitHub Profile
@eeichinger
eeichinger / git file change statistics
Created December 9, 2013 10:52
as someone who regularly gets on site with a client and has to quickly work himself into an existing codebase, I found these tools interesting. I stole them from Greg Young's excellent talk "How to get productive on a project in 24h" at http://www.youtube.com/watch?v=KaLROwp-VDY The change rate of modules and files over time is especially intere…
# find the modules/folders with highest number of changes
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | head
# find the files with the highest number of changes
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn |
while read frequency sample path
do
[ "blob" == "$(git cat-file -t $sample)" ] && echo "$frequency\t$path";
done
@eeichinger
eeichinger / jenkins_list_git_tags_and_branches.groovy
Created March 25, 2014 13:35
Groovy script to list git tags and branches using jenkins' Dynamic Choices Parameter plugin
def gettags = ("git ls-remote -t -h ssh://jenkins@<mygitpath>/repo/some.git feature/*").execute()
return gettags.text.readLines()
.collect { it.split()[1].replaceAll('refs/heads/', '') }
.unique()
.findAll { it.startsWith('<some more pattern>') }
@eeichinger
eeichinger / StateServiceImpl.java
Created March 31, 2014 13:44
#microservice best practice
@Service("blStateService")
public class StateServiceImpl implements StateService {
@Resource(name="blStateDao")
protected StateDao stateDao;
public List<State> findStates() {
return stateDao.findStates();
}
@eeichinger
eeichinger / ActivityStateManagerImpl.java
Created April 8, 2014 14:17
My favorite "use spring to instantiate but register as a static global singleton" solution
@Service("blActivityStateManager")
public class ActivityStateManagerImpl implements ActivityStateManager {
private static ActivityStateManager ACTIVITY_STATE_MANAGER;
public static ActivityStateManager getStateManager() {
return ACTIVITY_STATE_MANAGER;
}
@PostConstruct
@eeichinger
eeichinger / RunJetty.java
Created October 4, 2014 15:11
Custom Embedded Jetty Runner for easier debugging - run xml free webapps
/**
based on
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<version>9.2.3.v20140905</version>
</dependency>
*/
@eeichinger
eeichinger / jetty-pom.xml
Last active April 1, 2019 16:10
Jetty Configuration multiple war contexts and with web.xml override to avoid windows file locking
<?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>
<groupId>org.sample</groupId>
<artifactId>testwebserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
@eeichinger
eeichinger / AllowCORSRequestFilter.java
Last active August 29, 2015 14:09
CORS Request Filter for debugging/testing purposes
package com.example.web;
import com.google.common.base.Strings;
import com.google.common.net.HttpHeaders;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@eeichinger
eeichinger / svn-tag.sh
Created November 19, 2014 18:03
svn tag command line
svn rm https://svn.example.com/myproject/tags/last-successful-ci/mytag -m "Remove existing Test Tag" --no-auth-cache --non-interactive --username eeichinger --password pass1234
svn copy https://svn.example.com/myproject/trunk@246 https://svn.example.com/myproject/tags/last-successful-ci/mytag -m "Test Tag" --no-auth-cache --non-interactive --username eeichinger --password pass1234
@eeichinger
eeichinger / wrap.sh
Created January 5, 2015 14:18
Wrap raw AAC files in MP4 container and copy ID3v2 tags to MP4 metadata
#!/bin/bash
# Wrap raw AAC files in MP4 container and copy ID3v2 tags to MP4 metadata. Original files are not touched, new files appear besides them with .m4a extension
# requires MP4Box and kid3 (install via homebrew. You may need to install MP4Box manually from http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/. Homebrew had troubles installing mp4box. The executable is found inside the osmo4.app, see below)
# kid3 also has problems with full qualified filepaths as well as spaces in the filenames
for fic in Music/**/*.aac
do
echo processing $fic
@eeichinger
eeichinger / backup_jenkins.sh
Created January 10, 2015 10:09
Backup complete Jenkins config via ssh, excluding archived binaries
ssh <user>@<server> "tar -cvzf - -C /home/jenkins/ . --exclude 'maven-repositories' --exclude 'jobs/*/builds' --exclude 'backup' --exclude 'workspace' " > jenkins_backup.tar.gz