conky : integrating rTorrent downloads monitoring

Conky is a lightweight system monitoring tool. It has many built-in probes (processor load, memory usage, temperature sensors, etc), but it is still pretty easy to extend it if you don’t find the feature you need.

In this post I’ll describe my Conky setup and explain how to extend it to monitor your rTorrent downloads.

rTorrent is a great BitTorrent client which offers an XML-RPC interface to its core functions, making it easy to get the downloads status through scripting. You can read more about that in this previous post.
Continue reading conky : integrating rTorrent downloads monitoring

rTorrent : Probing downloads status through XML-RPC

rTorrent is a very efficient BitTorrent client for linux. It has a very small memory footprint, a very customizable configuration file, and exposes it’s internals through XML-RPC. This is convenient to implement 3rd party GUI or web interfaces.
Let’s see how to setup and use XML-RPC to probe rTorrent downloads.
Continue reading rTorrent : Probing downloads status through XML-RPC

Linux + Amarok 1.4 : Setting up proxy configuration

If you access the internet through a proxy, you need to set up Amarok to use it to enjoy some of its amazing features such as automatic downloading of CD covers or fetching of the lyrics of the song you’re listenning to. Amarok is really a great media player. if you don’t know it you should definitely give it a try !

Setting up proxy parameters for Amarok 1.4 could be a little confusing if you don’t use the full KDE environment. In this post, I’ll explain how to manually edit KDE configuration files to fix proxy settings.
Continue reading Linux + Amarok 1.4 : Setting up proxy configuration

X10 Home automation : Heyu a tool for managing a CM11

X10 LM12I currently manage all my X10 home automation with MisterHouse which is a fantastic tool but is a bit on the heavyweight side. Plus you need to know a bit of Perl to take full advantage of it.

If you are looking for something simpler to use, you might want to consider HEYU. Continue reading X10 Home automation : Heyu a tool for managing a CM11

Unix : the “script” command

The script command is a must for any unix sysadmin.

Once invoked, it will faithfully write anything you typed as well as any output generated in your terminal into a file of your choice (defaults to “typescript”).

This is great when you want to document everything you did on a specific server, for example.
spaghetti:~$ script
Script started, file is typescript

When launched, you don’t see anything, but everything displayed goes to a file as well as the terminal.

As usual see the man page for details (like appending instead of creating a new file, launching another command instead of your default shell, and so on)

vi : replacing text globally (search and replace)

If you want to replace a text throughout a file in the vi text editor, you can use the following command :

Here is the breaking down of this command:

  • :” : places you in “ex mode”
  • 1,$ is a range specification, meaning from the first to the last line (this can be shortened as % in some versions of VI (vim does, for instance) — Thanks Brandon !
  • s means “substitute”
  • /text/replacement/ means to replace the “text” pattern by “replacement”
  • g : means globally, which will replace all the occurrences of the pattern instead of the first of each lines

If you want to see how to script a text replacement, check out my previous post about text replacement with sed.

Zsh is cool : stream redirections

Zsh extends the usual stream redirections with two nice features …

Process substitutions

How often have you done the following :

  1. Launch one or many commands and redirect their outputs into temporary files
  2. Launch a command which reads and processes those temporary files
  3. Delete the temporary files

If you occasionaly write shell scripts then it is likely that the answer is “many times”. If so, then you’ll be glad to know that Zsh can automate this for you.

Considere the following snippet :
spaghetti% cat <(date) <(uptime) Tue Aug 14 16:08:35 CEST 2007 16:08:35 up 79 days, 18:47, 3 users, load average: 0.16, 0.18, 0.16

What Zsh did here is

  1. Launch date and uptime as background processes
  2. Connect their outputs to a temporary named pipe
  3. Replace the process redirections in the command line by the named pipes
  4. Launch cat with the modified command line
  5. Dispose the named pipes

That is just what you wanted ... packed in a handy one-liner.

Multiple redirections

If you've already needed to redirect the output of a command to multiple files, thn you already know the "tee" command. But with Zsh you don't need tee anymore, because Zsh has it built-in.

See the following snippet :
spaghetti% uptime >test.txt >test.txt2
spaghetti% cat test.txt
16:54:47 up 79 days, 19:33, 3 users, load average: 0.22, 0.15, 0.15
spaghetti% cat test.txt2
16:54:47 up 79 days, 19:33, 3 users, load average: 0.22, 0.15, 0.15

As you can see, output was duplicated to both files.

If you liked this article about Zsh, then you might be interested in my previous article about brace expansion in zsh.

bc : 2 little tricks you’ve ever wanted to know

If you’re looking for a good calculator on Linux / Unix, you can use bc. bc is “an arbitrary precision calculator” supporting bignumbers and many operators … well it will mostly do whatever you want (check the fine documentation).

Anyway, about those 2 little tricks I promised :

  1. change the scale variable (eg : scale=10) to set “the total number of digits after the decimal point”. Defaults to 0 -> Not cool.
  2. use the last variable to recall the last value you computed -> Cool.

That was it ! This is what I always need and forget, so I decided to blog it once for all…

If you really don’t know bc yet, give it a try !

Update: you can start bc with a default scale of 20 by using the “-l” option on the command line … (Thanks to Luke).

Linux : Best picture viewer

I previously asked an open question : “which is you favorite Linux picture viewer ?” and got a few answers in the comments, but unfortunately none of them made me happy. I tried quite a few on my own but without much success, till today.

Doing some more googling, I found a great picture viewer : FEH. It’s mostly command line based, it is fast and easy to use.

If you want to have the slideshow of the pictures in a directory then “feh dirName” will do it (even recursively if you add the “-r” option). You can zoom in and out with a middle-click drag left/right, you can do basic editing and delete on the fly.

Check out the feature list of FEH for more…