Category: Programming
A big part of my work has to do with code. I’ve worked as system administrator – installing, patching, and configuring someone else’s code. I’ve worked as independent programmer, writing code on my own. I also programmed as part of the team. And on top of that, I worked as Team Leader and Project Manager, where I had to interact a lot with programmers. Programming world on its own is as huge as the universe. There is always something to learn. When I find something worthy or something that I understand enough to write about, I share it in this category.
Revision Control Systems
Hazard sent me this link to a presentation about revision control systems. It reviews mainly CVS, Subversion, and Gnu Arch. It shows why Gnu Arch is a good choice for new projects as well as a sample real life scenario of project development done by several people.
rss2mail
Previously I have wrote lj2mail – a script which gets fresh posts from LiveJournal and emails them to the list of recepients. I have tried to avoid sending same items over and over again, but failed. The script was implemented with the help of LiveJournal API (LJ::Simple Perl module).
I got annoyed by that script repeating some items (mess with publishing date), so I wrote a different one. rss2mail simply gets the RSS feed, parses it and emails items as individual messages to the list of recepients. I guess that caching RSS item link is much better than LiveJournal’s publishing date. Also, rss2mail is much more flexible. It can be used with any RSS feed, not only LiveJournal’s. I have tried to make it as generic as possible. If it doesn’t work with other feeds, just check the fields of the RSS feed it uses.
webby_m3u
Today I have found a really nice way to listen to my home mp3s at work. All I needed to do is share my music directory via web and generate an m3u playlist with URLs to files. m3u playlist than could be downloaded and fed to XMMS, where I could select songs to play. It is also nice to use random playback until I find something I am in the mood for and than switch to sequential mode.
Anyway, I wrote a small Perl script to generate an m3u playlist. It dives into some directory recursively and correctly escapes all the URLs. Check the few configuration variables in the beginning of the file.
Bash prompts
Today I once again did something really stupid while being logged in as root. I already had my root and normal user bash prompts colored differently, but it turns out that the difference was not obvious enough. So, I decided to recolor the prompts a little bit more vividly.
It took me few minutes to refresh my memory with Bash Prompt HOWTO. After that I came up with this snippet in .bashrc
of the normal user (left screenshot):
# Cyan on blue time and Yellow on blue user@host dir export PS1="\n\[\033[44;1;36m\][\$(date +%H:%M)]\[\033[44;1;33m\][\u@\h \W]\[\033[0m\]$ " export PS2="\[\033[44;1;36m\][\$(date +%H:%M)]\[\033[44;1;33m\][\u@\h \W]\[\033[0m\]> "
Root’s prompt (right screenshot) was a bliss after that:
# Cyan on red time and yellow on red username@host dir export PS1="\n\[\033[41;1;36m\][\$(date +%H:%M)]\[\033[41;1;33m\][\u@\h \W]\[\033[0m\]# " export PS2="\[\033[41;1;36m\][\$(date +%H:%M)]\[\033[41;1;33m\][\u@\h \W]\[\033[0m\]> "