Esmska in the Czech Open Source 2010 Awards

Well this is a surprise. I was invited to the Internet and Technology 10 conference, that – as the name suggests – is mainly about present and future Internet technologies (DNSSEC, IPv6, etc). It’s happening in Prague this Monday and Tuesday, you can watch it live (Czech language only, sorry). One part of it was announcing the results of Czech Open Source 2010 Awards. It is a poll where jury and the public vote for the most favorite software, project, event, celebrity, blog and company (6 categories) that is related to open-source. I was invited in for my personal project Esmska, as for the Software category. There were also a few fellow RedHatters with me – Martin Sivák as the representative for the LinuxAlt event and Radek Vokál as the representative for the Red Hat company.

As you might expect, there’s a reason I wrote this blogpost. Yes, there is. Esmska won the third place in the public vote and the first place in the jury vote. Yay! (I still don’t understand why, though…) On the next photo you can see me receiving the award and a chocolate notebook as a prize 🙂

What is Esmska, anyway? It is a front-end to web SMS gateways. Believe it or not, in some countries it is very popular to send loads of SMS messages. Some mobile providers have even free SMS gateways available on the web. Therefore many users use them instead of typing the messages on the phone. This is particularly true for middle and eastern Europe countries like Czech Republic, Slovakia or Poland. Esmska may be very handy for them because it provides contact list, history or mass messaging features for them. If you think you could use it, check out its website. Free web gateways are suitable only for a few countries, but you can always use a paid international gateway sending anywhere to the world.

The chocolate notebook (well, the keyboard) was quite good for a piece of computer hardware 🙂

Not only I have been awarded. LinuxAlt was the first in the Event category in the jury vote, so Martin Sivák obtained the prize too. Photo below. Red Hat unfortunately didn’t win the Company category, so no chocolate for Radek Vokál.

The ultimate winner (regardless of category) was program FreeRapid Downloader. PiracyLegal content downloading rules the world 🙂

Overall it was a nice event, I enjoyed it.

Simple scripts for operating the system clipboard

Linux systems have three kinds of text selection – primary, secondary and clipboard. The clipboard is the most famous one, Ctrl+c, Ctrl+v, you know the stuff. At work I need to note down all the important stuff I worked on recently, to have some kind of work report. So I end up with document with many bullets containing project names, bugzilla ticket summaries and URLs, etc. What I really hate is transferring rich text properties in the clipboard together with the content. That means if I select a title of some bug, it is copied (into my web application I use for creating reports) as a big thick line with custom font. One has to reset all the formatting after every such insertion. Awful!

So let’s do something about it. Wouldn’t it be nice to convert the contents of the system clipboard to plaintext only? Fortunately a little of bash scripting can help:

#!/bin/bash

# print usage
if [ "$1" = '--help' -o "$1" = '-h' -o $# -ne 0 ]; then
 echo "Usage: $0"
 echo "Takes text in system clipboard and transforms it into plaintext."
fi

# get the plaintext
TEXT=`xsel -b`

# print the text, it may come handy sometimes
echo "$TEXT"

# replace the original rich-text with plaintext
echo -n "$TEXT" | xsel -b -i

Well, and now just store this script in your PATH and call it whenever needed. I used Gnome’s Keyboard shortcuts to define a shortcut to call this script anytime I need it. Works perfect 🙂

I also needed to print same basic information about a particular bug in a specific format, so I can easily put it into my report. Manually copying all the information is not fun. Let’s create another script (python-bugzilla must be installed):

#!/bin/bash

# print usage
if [ "$1" = '--help' -o "$1" = '-h' -o $# -ne 1 ]; then
 echo "Usage: $0 bug_id|bug_url"
fi

# parse bug id
ID="$1"
if [[ "$ID" == http* ]]; then
 ID=`echo $ID | sed -r 's/.*id=([0-9]+).*/\1/'`
fi

# query bugzilla
INFO=`bugzilla query --bug_id "$ID" --outputformat='%{url} %{component} %{summary}'`

# parse info into parts
URL=`cut -d ' ' -f 1 <<< "$INFO"`
COMPONENT=`cut -d ' ' -f 2 <<< "$INFO"`
SUMMARY=`cut -d ' ' -f 3- <<< "$INFO"`

# output text in a suitable format
OUTPUT="$URL
 \"${COMPONENT}: $SUMMARY\""

# print the output
echo "$OUTPUT"

# copy the output to X clipboard
echo "$OUTPUT" | xsel -b -i

# play a notification sound
paplay /usr/share/sounds/freedesktop/stereo/message.oga

So now I just run “bug 595448” command and it prints all the necessary information out for me and puts it also into the clipboard. Hail to the improved work efficiency! 🙂

I hope this helps somebody in these kinds of repetitive tasks – creating work reports. Improvements welcome.