Skip to content

Instantly share code, notes, and snippets.

View stefanbirkner's full-sized avatar

Stefan Birkner stefanbirkner

View GitHub Profile
@stefanbirkner
stefanbirkner / nexusdeb.sh
Last active October 27, 2020 17:30
Nexusdeb build a debian package of the Nexus server.
#!/bin/bash
# nexusdeb builds a debian package of the Nexus repository manager. nexusdeb
# downloads nexus by itself. You run it by
# nexusdeb.sh <version> <maintainer>
# Example:
# nexusdeb.sh 2.0.5 "Denny Colt <d.colt@eisner.qcg>"
#
# The script has been tested with version 2.0.5.
if [ -z $1 ]
@stefanbirkner
stefanbirkner / nexus-server.sh
Created June 8, 2012 14:02
Installing a Nexus server
#!/bin/bash
#install Java 7
add-apt-repository -y ppa:webupd8team/java
apt-get -y update
apt-get -y install oracle-java7-installer
#install tomcat, which uses Java 7
apt-get -y install tomcat7
sed -i 's/#JAVA_HOME/JAVA_HOME/' /etc/default/tomcat7
@stefanbirkner
stefanbirkner / playdeb.sh
Created April 18, 2012 15:48
Playdeb builds a debian package of the play framework.
#!/bin/bash
# playdeb builds a debian package of the play framework. playdeb downloads
# the playframework by itself. You run it by
# playdeb.sh <version> <maintainer>
# Example:
# playdeb.sh 1.2.3 "Denny Colt <d.colt@eisner.qcg>"
#
# The script has been tested with version 1.2.3.
if [ -z $1 ]
@stefanbirkner
stefanbirkner / twitterspring.jsp
Created April 17, 2012 22:19
Twitter Bootstrap meets Spring Form Tag library
<form:errors path="a" cssClass="alert alert-error" element="div"/>
<form:errors path="*" cssClass="alert alert-error" element="div" delimiter='</div><div class="alert alert-error">'/>
@stefanbirkner
stefanbirkner / junit4template.java
Created March 13, 2012 10:19
IntelliJ Idea Template for a JUnit4 test.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import static org.junit.rules.ExpectedException.none;
public class ${NAME} {
@Rule
public final ExpectedException thrown = none();
}
@stefanbirkner
stefanbirkner / intellijidea.desktop
Created March 2, 2012 09:50
Desktop file for Intellij Idea
[Desktop Entry]
Type=Application
Name=IntelliJ IDEA
Comment=IntelliJ Integrated Development Environment
Icon=/opt/idea/bin/idea128.png
Exec=/opt/idea/bin/idea.sh
Terminal=false
StartupWMClass=Intellij_IDEA
Categories=Development;IDE;Java;
@stefanbirkner
stefanbirkner / numberOfDuplicates.sql
Created January 11, 2012 10:29
list duplicate rows with the number of duplicates
-- replace myfield1, myfield2 and mytable with appropriate names
select COUNT(*) AS num, myfield1, myfield2 from mytable group by myfield1, myfield2 HAVING COUNT(*) > 1;
@stefanbirkner
stefanbirkner / link2text.sh
Created October 4, 2011 21:51
Replace links with simple text
#!/bin/bash
grep -Rl "a href=" dirname | while read item
do
sed -i 's/<a href=".*">\(.*\)<\/a>/\1/' $item
done
@stefanbirkner
stefanbirkner / easyMock2Mockito
Created July 20, 2011 15:38
Convert tests from EasyMock to Mockito
#!/bin/bash
fgrep -Rl "EasyMock" testsrc | fgrep -v ".svn" | while read item
do
sed -i 's/org.easymock.EasyMock.createNiceMock/org.mockito.Mockito.mock/g' $item
sed -i 's/org.easymock.EasyMock.createMock/org.mockito.Mockito.mock/g' $item
sed -i 's/org.easymock.EasyMock.expect/org.mockito.Mockito.when/g' $item
sed -i 's/org.easymock.EasyMock/org.mockito.Mockito/g' $item
sed -i 's/EasyMock/Mockito/g' $item
sed -i 's/createNiceMock/mock/g' $item
sed -i 's/createMock/mock/g' $item
@stefanbirkner
stefanbirkner / addNewLine.sh
Created June 22, 2011 14:41
Add a new line at the beginning of a text file
#!/bin/sh
#adds the line 'the new first line' at the beginning of file 'filename'
sed -i '1 i\the new first line' filename