Skip to content

Instantly share code, notes, and snippets.

@gerjantd
gerjantd / listreqattrs.jsp
Created April 9, 2013 12:44
Java/JSP: list request attributes
<HTML>
<BODY>
<%
out.println("<DL>");
java.util.Enumeration attrs = pageContext.getRequest().getAttributeNames();
while (attrs.hasMoreElements()) {
String attr = (String) attrs.nextElement();
Object val = pageContext.getRequest().getAttribute(attr);
out.println("<DT>"+attr+"</DT><DD>"+val.toString()+"<DD/>");
}
@gerjantd
gerjantd / listjvmprops.jsp
Created April 9, 2013 12:43
Java/JSP: list JVM properties
<HTML>
<BODY>
<%
out.println("<DL>");
java.util.Properties props = System.getProperties();
java.util.Enumeration e = props.propertyNames();
while (e.hasMoreElements())
{
String key = (String) e.nextElement();
String value = props.getProperty (key);
@gerjantd
gerjantd / gist:4523597
Last active December 11, 2015 01:29
Git: Git for Eclipse users worked example

Git for Eclipse users worked example

In first shell

$ mkdir example
$ cd example
$ git init
Initialized empty Git repository in /home/gerjan/example/.git/
@gerjantd
gerjantd / gist:4259951
Created December 11, 2012 16:19
Cloud foundry Grails app from scratch
Cloud foundry Grails app from scratch
=====================================
* Pre: Ubuntu 12.10 desktop system
* Log in (guest account)
* Alt+F2 firefox
* http://www.springsource.org/downloads/sts-ggts
* http://download.springsource.com/release/STS/3.1.0/dist/e3.8/groovy-grails-tool-suite-3.1.0.RELEASE-e3.8-linux-gtk.tar.gz
* Alt+F2 gnome-terminal
* cd Downloads/
@gerjantd
gerjantd / gist:4114046
Created November 19, 2012 21:22
Misc security: nc (netcat), nikto, tcptrack
mkfifo foo
nc -lk 2600 0<foo | /bin/bash 1>foo 2>&1
(REMOTE: nc myip 2600)
mkdir -p foo/bar/baz/quux
cd foo/bar/baz/quux/
for i in `seq 1 1000`; do echo -n $i" " >> foobar.txt ; done
zip -f foo.zip foo/
hexedit foo.zip
@gerjantd
gerjantd / gist:3960871
Created October 26, 2012 19:21
Eclipse/regexp: replace property value by el variable with name identical to property
Find: (^\w*\.\w*)=.*$
Replace with: $1=\$\{$1\}
@gerjantd
gerjantd / gist:3960594
Created October 26, 2012 18:38
Eclipse/regexp: replace single nested properties by xml elements
Find: (^\w*\.\w*)=(.*)$
Replace with: <$1>$2</$1>
@gerjantd
gerjantd / gist:3898661
Created October 16, 2012 10:57
Shell/git: show most recent log entry for all repos in current dir
dorsthog@svl01-int-p:/data/git> for f in `find -mindepth 1 -maxdepth 1 -type d -name "*.git"`; do echo $f; pushd .; cd $f; git log|head -5; popd; done
@gerjantd
gerjantd / gist:3898311
Created October 16, 2012 09:32
Shell/git: show diff between local and remote master for all repos in current dir
gerjan@peertje:~/git/svl01-int-p.rivm.nl$ for f in `find . -mindepth 1 -maxdepth 1 -type d`; do echo $f; pushd .; cd $f; git diff --shortstat master origin/master; popd; echo; done
./ttapp
~/git/svl01-int-p.rivm.nl ~/git/svl01-int-p.rivm.nl
~/git/svl01-int-p.rivm.nl
./springpad-mvc-ro
~/git/svl01-int-p.rivm.nl ~/git/svl01-int-p.rivm.nl
~/git/svl01-int-p.rivm.nl
./divocos
@gerjantd
gerjantd / gist:3828023
Created October 3, 2012 16:23
Shell: create an ISO image from a folder's contents
mkisofs -o /tmp/foo.iso foo/