XML find and change node script
This is a script written in ruby designed to find a specified node in an XML file, and replace one value with another.
Usage example:
changenode /home/me/foo bar.xml name bob john will find all ‘name’ nodes in bar.xml and replace ‘bob’ with ‘john’
The code can be found on github here
JavaScript Map object implementation
The idea of this object is to mimic the API of the Map object in Java.
It can be used in the following way:
var myMap = new Map();
myMap.put('foo', 'bar');
var bar = myMap.get('foo');
I know this behaviour can also be attained by using an array in the following manner:
var myMap = []; myMap['foo'] = 'bar'; var bar = myMap['foo'];
But I thought it interesting to implement it as a map too.
The code can be found on github here
Replace webapp in deployed tomcat
This script will quickly replace the webapp dir of a deployed webapp in tomcat. It scans at your current directory tree for an appropriate artifact.
It will look for a target subdirectory, and will try to find a .war file in it (assumes you’ve build your app with maven).
The script takes two parameters, ‘webapp’ and ‘dir’:
- The first is the name of the webapp deployed in tomcat
- The second is the dir to move into the deployed webapp
Usage examples:
ctw myapp mydir will copy mydir into the myapp webapp sitting in tomcat
NB: all parameters are case insensitive
The script can be found on github here
Copy to apache script
This script is designed to work with OS X and will copy the specified dir into the users local sites dir.
It looks for the specified dir, and if it exists copies it into apache. If the dir already exists in apache, it first deletes it.
The script takes one parameter, ‘dir’ which is the dir name.
Usage examples:
ca mywebapp copies dir mywebapp into $HOME/sites/mywebapp
NB: all parameters are case insensitive
The script can be found on github here
Copy to tomcat script
This script will quickly copy an app into tomcat by scanning at your current directory tree for an appropriate artifact.
It will look for a target subdirectory, and will try to find a .war file in it (assumes you’ve build your app with maven).
The script takes two parameters, ‘tomcat’ and ‘app’:
- The first is asking whether to start/stop tomcat, it takes ‘Y’ or ‘N’ as options
- The second is asking what to copy to tomcat. It has the options of ‘W’ or ‘C’. ‘W’ means copy the whole war, ‘C’ means copy just the compiled classes
Usage examples:
ct y c will stop/start tomcat and copies just compiled classes
ct n w will not stop/start tomcat and copies the war
NB: all parameters are case insensitive
This script requires the Generic tomcat script found on github here
The script can be found on github here
Generic tomcat script
This script makes it easy to control your main tomcat installation.
All you need to do is set the $CATALINA_HOME environment variable to the location of your tomcat installation.
The available switches are:
startstarts tomcatstopstops tomcatrestartstops then starts tomcatkillkill -9′s tomcat processtailtails tomcat log
Usage examples:
tomcat start starts tomcat
tomcat restart restarts tomcat
NB: all parameters are case insensitive
The script can be found on github here.
Introducing unix scripts
I’ve got several scripts that I use for doing useful things on unix.
They can be found on github here.
I’ll add some details about them individually in separate posts.
Date Driven Development (DDD)
I tweeted this as a joke, but thought it deserved a brief post:
A senior manager in the company arbitrarily pulls a date out of the air (normally the Friday just before an important golfing holiday) for when he needs a report. This means that a load of developers need to jump though hoops to write a system to produce the report, whilst having to continually deal with requirement changes and middle management customers that can’t actually make a decision about anything. When the system is delivered a week late, the senior manager is already playing golf and doesn’t care anymore, so all the developers are sacked.
More on TiddlyBlogger
Just a quick note to point out some work that’s been done “White Hat Marketer”
Check out the details here:
http://whitehat-marketer.com/blog/tiddlyblogger-with-permalinks-and-updates/
It basically includes the capability to update posts (rather than just create new ones), and also create permalinks.
Leave a Comment