Skip to content

Instantly share code, notes, and snippets.

@gerjantd
gerjantd / gist:2627213
Created May 7, 2012 10:50
Maven: dynamically build classpath containing all maven dependencies
Download
--------
svn co https://src.springframework.org/svn/spring-samples/task-basic/trunk
(http://blog.springsource.org/2010/01/05/task-scheduling-simplifications-in-spring-3-0/)
Build
-----
mvn clean package
@gerjantd
gerjantd / gist:2984296
Created June 24, 2012 18:20
Linux system info summary and simple way to prevent remote from closing connection
watch -n 8 "cat /etc/issue | grep '[a-z]'; uname -a; top -b -n 1 | head -1; who"
@gerjantd
gerjantd / gist:3121258
Created July 16, 2012 07:03
Python: simple http server, localhost only
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
@gerjantd
gerjantd / list_manually_installed_packages.py
Created July 20, 2012 08:59
Python, Debian, Ubuntu: list manually installed packages
"""List manually installed debian packages
Use as root or with sudo:
python list_manually_installed_packages.py [date]
output results to /var/log/manually_installed_software_<hostname>.csv
Optional argument [date] will list only packages installed since that date.
The date format is YYYYMMDD and be used e.g. as
@gerjantd
gerjantd / get-mygists.sh
Created July 20, 2012 09:23
Github: API v3 call for retrieving my public gists
#!/bin/bash
mkdir mygists
cd mygists
curl -u "gerjantd" https://api.github.com/gists | json_xs > mygists.json
cat mygists.json | grep "\"id\"" | awk -F "\"" '{print $4}' > repos
for g in `cat repos`; do git clone [email protected]:$g.git gist-$g; done
@gerjantd
gerjantd / gist:3827264
Created October 3, 2012 14:39
Shell: replace 'foo' with 'bar' in every java and xml file in folder tree
for f in `find . -type f -regextype awk -regex ".*/*.(xml|java)"`; do sed -i -e "s/foo/bar/g" $f; done
@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/
@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: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:3960594
Created October 26, 2012 18:38
Eclipse/regexp: replace single nested properties by xml elements
Find: (^\w*\.\w*)=(.*)$
Replace with: <$1>$2</$1>