Archive for the ‘Tech’ Category

Releasing ldaptool 0.1

Friday, December 19th, 2008

So I have finally released ldaptool as version 0.1!

ldaptool

ldaptool is a collection of utilities to ease the maintainance of an LDAP tree from the command line. It supports common unix operations such as useradd, passwd and the like. I wrote ldaptool as part of my job at the Linux Cluster of the University of Bern (UBELIX) and the Computer Services Deparment kindly gave me the permission to release ldaptool as an opensource project.

Ldaptool is invoked using a main command (ldaptool) and set of subcommands similar to the way you use subversion. For example, to add a new user jdoe you would enter the following:

ldaptool useradd jdoe

The commands take similar options as their linux/unix equivalents. For example, to specify groups for the aforementioned user we can type:

ldaptool useradd -g users -G admins,backup jdoe

Which will give jdoe the primary group users and the secondary groups admins and backup.

There is still a lot of work left with ldaptool. I have currently not yet created any usermod and groupmod commands. Also, ldaptool will support hooks to create directories and launch other actions when users are created or other commands are executed. I find the -m command of useradd a little limiting.

That’s all for now, I am a little tired from all the coding today and looking forward to sitting down with a beer, having a good dinner and to watch a movie. Please check out the ldaptool project page and the documentation. Feel free to drop me a comment if you have any.

Tango LaTeX Syntax Highlighting

Tuesday, December 9th, 2008

As I have previously mentioned, I am quite a fan of the Tango color palette. In this installment, I want to show how to highlight code listings in LaTeX using the Tango colors like in the following Smalltalk example:

Tango Syntax Highlighting

The screenshot above is actually from a full blown example which I have created for XeLaTeX. If you wish to typeset the example in pdfLaTeX or similar, you can just comment out the lines it complains about.

Let’s go through the source. First of all, you will need the xcolor package to define the custom colors:

\usepackage{xcolor}

Then we can define the colors. I have simply converted the hex color definitions into rgb values acceptable to xcolor. For more information, see the xcolor documentation.

\definecolor{Butter}{rgb}{0.93,0.86,0.25}
\definecolor{Orange}{rgb}{0.96,0.47,0.00}
\definecolor{Chocolate}{rgb}{0.75,0.49,0.07}
\definecolor{Chameleon}{rgb}{0.45,0.82,0.09}
\definecolor{SkyBlue}{rgb}{0.20,0.39,0.64}
\definecolor{Plum}{rgb}{0.46,0.31,0.48}
\definecolor{ScarletRed}{rgb}{0.80,0.00,0.00}

Note that this is just a part of the color definition. See the source for all available colors.

Now that we have defined the Tango colors, we can use them to highlight our source. Depending on the language that you are wishing to highlight, not all numbered keywords will be applicable. I use these different keywordstyles to highlight the above Smalltalk source.

\lstset{
	keywordstyle=[1]{\color{DarkSkyBlue}},
	keywordstyle=[2]{\color{DarkScarletRed}},
	keywordstyle=[3]{\bfseries},
	keywordstyle=[4]{\color{DarkPlum}},
	keywordstyle=[5]{\color{SkyBlue}},
	commentstyle={\color{Aluminium4}},
	stringstyle={\color{Chocolate}},
	basicstyle={\ttfamily},
}

And that’s all you need to use Tango colors for you syntax highlighting in LaTeX. Again, take a look at the source code to see the above code in full.

Tango Themed OS X Terminal

Monday, December 8th, 2008

I am not a fan of Gnome but ever since I installed an Ubuntu on my computer at work I have been a fan of using the Tango color theme for terminals. The colors feel smooth and work well in combination with semi-transparent terminal windows. I have applied the theme to other environments as well and when I recently started using Leopard on my new Macbook I realized I could not simply change the ANSI colors like I had previously on Tiger.

Turns out it is not so difficult on Leopard either, but you will need to install some additional software.

Tango Themed Terminal

So, to get Tango colors in your terminal, follow the following instructions:

  1. Download and install SIMBL which is a little hack to allow you to extend OS X applications.
  2. Unpack Ciarán Walsh’s SIMBL plugin that adds customizable ANSI colors to Terminal.
  3. Download and double click OS X Terminal Tango Theme.

Let me know if you have any comments.