Archive for the ‘Development’ Category
Simple bash locking
I often need to create lock files in my scripts, so crontab doesn’t spawn more than one process. This is a simple bash lock file function I like to use:
function create_lock {
LOCK_NAME=$1
if [[ -e "$LOCK_NAME" ]]
then
OLDPID=`cat $LOCK_NAME`
if ps p $OLDPID > /dev/null
then
return 1
fi
rm $LOCK_NAME
fi
echo $$ > $LOCK_NAME
return 0
}
create_lock doesn’t handle race conditions, but it is typically good enough for me.
Mediawiki Google Search Appliance Integration
I was given the task of integrating our old Google Search Appliance with our internal wiki. It turns out MediaWiki offers a couple of different ways to alter search functionality: $wgSearchForwardUrl and $wgSearchType. The $wgSearchType variable accepts a SearchEngine class name and enables custom search back-ends. SimpleXML and the GSA XML API then allowed me to fetch and process the search results. After a few hours of tweaking I am pretty happy with the result, a tightly integrated full text search.
If you are interested in setting up your Google Search Appliance with a mediawiki instance, installation is simple, download or checkout the extension and follow the installation instructions.
My Life is a Little Bit Easier Now
Lately, I’ve found the process of assigning a bug to myself slightly cumbersome and wanted to speed up the process. I happen to be a fan of Ubiquity, so I decided to write a command.
The command assigntome, by default, changes the assigned to field to your user. The whole process can be automated by tacking on the submit noun, which will simulate clicking the “Commit” button.
To install assigntome subscribe to my Ubiquity feed.
MediaWiki: HttpAuth Plugin
All HttpAuth Plugin development has moved here from my work blog. Mozilla’s internal wikis have been using the extension without issue. Is anyone aware of issues that need fixing?
SimpleCaptcha Update
I’ve decided to move SimpleCaptcha development to my personal server.