Author Archive for Daz

Page 2 of 17

My First Gem: Biomart

A lot of my work these days involves building and querying biomart datasets. Interacting with the webservices (for queries) is pretty simple, you just have to post a piece of xml at the right url, but I found myself reusing a lot of boilerplate code in each and every new script.

So, to make my life a little easier (and hopefully some others) I packaged all of the code up in a module with classes to handle all of the monkey work for me and decided to release it as a gem. :)

The source code is available from github, and the documentation is on rdoc.info.

For more details, check out the release anouncement.

It’s my first ruby module so any advice or pointers on how to make things better would be most appreciated. :)

This Week on Twitter (2009-08-30)

Links for 2009-08-25

This Week on Twitter (2009-08-09)

  • I love a server crash to deal with first thing on Monday morning… #ihatemondays #

This Week on Twitter (2009-08-02)

  • Bonus! Just been sent the first royalty cheque from my book! Good times. :) #
  • Heading over to @ABarkell's for his birthday. Let's hope the weather gets better… Bring on the hog roast! :) #

This Week on Twitter (2009-07-26)

This Week on Twitter (2009-07-19)

Links for 2009-07-13

Add Git and SVN Branch to Bash Prompt

I’ve seen things like this posted on the net before but never really had a chance to play with the idea. But as I’m now using git and svn a lot more these days (fingers crossed i’ll be totally free of cvs soon!) I thought it was about time I pulled my finger out.

So here’s the end goal, in a normal directory, we just get a normal bash promt, but in a directory controlled by git or svn, we also get an addition telling us the source control tool in use and the current branch:

git_svn_bash_terminal

So, fire up yer terminal and add the following to your .profile, .bash_profile or .bashrc (whichever one you use):

parse_git_branch () {
	git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
}
parse_svn_branch() {
	parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print " (svn::"$1 "/" $2 ")"}'
}
parse_svn_url() {
	svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
	svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
 
BLACK="\[\033[0;38m\]"
RED="\[\033[0;31m\]"
RED_BOLD="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
GREEN="\[\033[0;32m\]"
 
export PS1="$BLACK[ \u@$RED\h $GREEN\w$RED_BOLD\$(parse_git_branch)\$(parse_svn_branch)$BLACK ] "

Simples. Now just open up a new terminal and move into a project directory using svn or git. :)

Links for 2009-05-05