About dtobi

I am a Ph.D student in the field of distributed systems and mobile communication at RWTH Aachen University in Germany.

A script that might improve your writing


Just like me, you may not be a native English speaker. However, publishing scientific documents often requires to write somewhat comprehensible English texts. Just like me, you might have some mistakes you make over and over again. When writiting my dissertation, I compiled a list of my “favourite” mistakes. Luckily most of them are so stupid that simple pattern matching suffices to find them. I wrote a small script and a “database” of my frequent errors to check my texts. Maybe this is useful for someone. I tried to include explanations and suggestions to make it easier to figure out why the script complains about something…

Continue reading

Advertisements

Notification when the job is done


Sometimes command line jobs run for quite a while. Examples are video conversion, builds, etc. If you are an impatioent person (like me) you may be tempted to check the progress of your long-running operation every couple of seconds. To get around that nuisance, I started to append notifier scripts to my long running progresses. For example:

$> make; say "Hooray, its done"

Will make your Mac say… well, you can read. It will use the speech synthesis and you will be thrilled to find out that your job is done.

On a remote machine, using say may be a bit useless. Maybe your collegue at work will be thrilled to learn that someone elses job but finished, maybe not. For this purpose you can use sendmail. Using a little script can make your life a bit easier here:

Continue reading

Convenient way of creating an acronym list for a LaTeX file


Writing a [bachelor/master/PhD] thesis can be a tedious and lengthy process. However, in the end you want it to be perfect. And, of course, this also means that your masterpiece should also feature a complete list of acronyms. Latex has a good way of creating such a list:

\usepackage{nomencl}
\begin{document}

...
\nomenclature{ABC}{Awesome Brilliant Concept}
Your glorious findings which used an Awesome Brilliant Concept (ABC).
...
\printnomenclature
\end{document}

However, when writing you have better things to do than thinking about keeping lists of acronyms or keeping track of that you don’t forget one of these \nomenclature commands. So in the heat of the action, these acronyms are easily forgotten and the list needs to be done later. Reading through the whole text just to find the few acronyms you forgot is a waste of time. I had the same problem and created a small bash script that searches through a *.tex file, identifies all acronyms, and prints \nomenclature commands for the missing ones. It will also check if you have a \nomeclature command without a matching acronym in the file.

Continue reading

A quickie: watching 3D movies on a Philips TV (7000 line)


Recently, I was struggling a bit with our new Philips TV. It can do 3D and it can play *.avi and *.mkv movies but it seemed not to be able to play these in 3D even though they had the 3D information encoded (side by side).

After some fiddling, I found out: it works perfectly. The only thing that’s blocking the 3D feature is that the samples I tried were not in HD. Apparently the TV requires the source file to have a 1920×1080 resolution. Once you got the file in the right format, it works like a charm and you can enable the 3D feature via the on-screen menu.

Here is a quick command to re-encode a clip in the right resolution and in a format that the TV can definitely read:

$> mencoder 3d-sample-in.avi -vf scale=1920:1080 -o 3d-sampe-out.avi \\
   -oac mp3lame -ovc lavc -lavcopts vbitrate=2200

Mencoder is part of the mplayer software package. I have not optimized the above line for performance or size… using different encoder options may result in a much better result.

Color your shell – 1: colorful ls


colors for lsPreface:

This is a series of posts that explain how to get to a nicely colored shell by tweaking your .bahsrc.

I am aware that each of these hints has been discussed on the Internet forever. However, it took me a little while to get all into my .bashrc, so I hope this will be useful for someone.

Colorful directory listings (ls)

Getting color to ls is fairly easy. You basically just turn it on. However, depending on your OS, you may have to push different buttons to get it working.

Continue reading

Some words on malloc and memset


Some people seem to have a particular strategy when it comes to using malloc and memset. The strategy is simple:

Use malloc often, then memset everything. [don’t do this at home]

The bad thing about that strategy is that it leads to complex code and non-obvious bugs. The following mini-tutorial is based on some slides I prepared for a small tutorial for our students at RWTH Aachen University.

Continue reading

pbcopy and pbpaste


pbcopy and pbpaste are two very simple shell commands that help you to streamline your copy & paste operations.

pbcopy copies stdin to the OSX clipboard. pbpaste copies the clipboard content to stdout. Combining both allows you to perform complex operations on your clipboard contents. Need an example:

pbpaste | fmt -s -w 80 | pbcopy

will format the text in your clipboard so that it breaks at a text width of 80 characters. very good if you need to write technical documents with fixed character width. I guess you can easily imagine any text-based workflow. Just think of what stream processing you can do with html tidy, aspell, etc.

Of course, putting your pbpaste/pbcopy chain to a script that you can conveniently run from any shell or binding it to a key combination will make the whole thing even more useful.

I found this works for OSX. Maybe there is an equivalent for Linux as well. Any hints?