Binary Codes

Tuesday, August 26, 2008

Often when you come across a desktop screenshot in the forums/websites a myriad of question flows through your mind. "What theme is that? Lovely icon, if only I knew its name. Wow, but is it openbox or fluxbox or something else?" Now while its possible to mention all the details while posting the picture, its a hassle everytime you post a screenie in the monthly screenshot thread.

Instead, wouldn't it be better if we could somehow automatically include all the details in the screenshot itself? Yes, it would be and its possible just by using these two small scripts.

Tuesday, August 19, 2008

The command line in a Linux system is one area that a new user despises and a long time pro seeks to master. While the shell is powerfull in itself, there are still some tasks that requires a separate program, for instance playing music, IMs, browsing the web, etc.

Lets take a look at some command line applications that does the job and does it well.

Simply put, screen is a window manager that allows you to run multiple terminals from a single terminal process. It allows session-sharing, persistence and multiple windows. One can simple detach a session and then later attach it to continue a previous work without starting all over again. Specially usefull without a Xession as it allows more than 6 terminals, by multiplexing.

Vim, though not the most intuitive of all, is a power packed text editor that is ideal for programming as well as for general text editing. Vim is modal in nature and includes no menus or mouse features. All the features are accessible via commands and keybindings. Vim also supports autocompletion for various programming languages via add-on scripts called omnifunc. A built in tutorial vimtutor is included, that helps in getting started. While the age old war between vim and emacs continues, both are well accepted in the Linux community.

Latex is a proffessional typesetting system designed for technical, scientific, mathematical documentaion. It is however a language that accesses the power of Tex, hence a suitable text editor is needed along with it. Latex, used mostly for desktop publishing and word processing, can also be used to create raster graphics.

Complete with table and frame rendering,tab support,color support,multiple items download in the background, elinks is a powerpacked web browser. The arrow keys can be used to browse through the links, and by using the "." key, one can also just type in the link number to open it. Great for browsing over ssh or just for a low bandwidth connection.See this list for other text based web-browsers

Alpine, based on the old pine mail client and licensed under the apache license, is a simple yet efficient text-based mail client. Unlike mutt, it doesn't need any external program to fetch mails and with its context-sensitive help, is very easy to use. Mutt is another viable alternative to alpine.According to an interview published in Lifehacker, Linus Torvalds himself uses alpine.

Supports add-on perl scripts, auto logging and can also be themed. It has highly configurable keybindgins that ensures maximum customizeability. Also while irssi is specifically targeted towards IRC, when combined with bitlbee, it adds IM functionality also. One point for bitlbee users though, its better not to use public servers for security reasons. WeeChat is a viable alternative to irssi, you may also want to have a look at it.

Music Player Daemon (MPD) is based on the client-server architecture. The daemon stays in background and actually plays the tracks while the client(ncmpc) is used to control the playlist, sounds etc. The real advantage of mpd over other console based players like cmus, moc, etc is that it allows remote access, that is, the daemon can run in one computer while the client connects to it from a remote computer to control it. Combined with icecast, mpd can be converted into a audio streaming server. These are the other clients supporting mpd.

MPlayer supports a wide range of supported output drivers, Xv,X11,DirectFB,etc. It plays most audio and video file types and can be used with or without a GUI frontend. Enabling framebuffer allows one to watch videos on mplayer without even starting a X session. Also included in the mencoder which is a video filtering, decoding, and encoding tool that works from the command line.

rTorrent, as is obvious from its name, is a bittorrent client with ncurses interface. It can watch a directory for torrent files and automatically download them, and if required move them to a separate directory. It supports session control,DHT along with other features and allows the user to select the files to download if the torrent consists of more than one file. rTorrent can be operated over ssh and thus can be used in a torrent slave. For instructions on setting up rTorrent follow K.Mandla’s article.

Midnight Commander is a two-panel file manager, that can open RPM or other archive packages without extracting, serve as a FTP or FISH client and rename multiple files. It has a ncurses based interfaces and is useful for file manegment in a console or via ssh.

Monday, August 18, 2008

Ok this might look pretty silly,but I feel compelled to delete every Thumbs.db file that I tend to recieve from my friends. The file is generated in windows systems when one views the contents of a directory in "Thumbnail" or "Filmstrip" mode. The idea is to store the settings with regard to thumbnail and filmstrip view, as well as to keep a cache of the thumbnail of image and video files.

Whenever I borrow some pics or movies from my friends' DVDs, etc, these tiny little files also gets copied over. Now these are completely harmless as far as I know, but since they are of no use in Linux, I dont want them in my system.

Now, deleting a particular file inside every directory is a pretty troublesome task. Hence, I wrote myself a neat little python program that searches directories, passed to it as the absolute path, for the file mentioned and prompts for its removal.

Usage is pretty simple, save the program in a file (say, delete) and make it executable by# chmod +x /path/to/delete

then run the program like this,

$ delete /absolute/path/to/directory/

The program starts searching for the file mentioned, from the directory passed as argument and goes on recursively to search in subdirectories.

Now a simple bash script like this one

rm `find /home/user/path -name 'pattern_to_search_for'`

would have been easier and better suitable for this task, however, that way I was never going to really get on with python. Hoping for some python expert to come along and provide some insight on this code.