Licence
Creative Commons License

This work by Stephane KATTOOR is licensed under a Creative Commons Attribution 3.0 Unported License.
Feeling like tipping ?
If you find this blog useful, you might consider sending a few bitcoins to support it : 1BTtsC3beGJ6ysd8DhrXjdo6jVw5WD9mvY
RSS
 
RSS Feed
Follow me !
Tech@Sakana on Facebook
Search this site

Newsletter

Get latest posts by email (No spam, only posts):

Enter your email address:

Delivered by FeedBurner

Categories
Monthly archives
February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Category: Software

rTorrent : Probing downloads status through XML-RPC - October 10, 2009 by Stephane Kattoor

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.
read this entry »

VIM: using the modeline for file based customized editing parameters - August 1, 2009 by Stephane Kattoor

The “modeline” is a common way to set (or override) VIM settings on a file by file basis. Let’s see a few of the key concepts of the VIM modeline.
read this entry »

Linux + Amarok 1.4 : Setting up proxy configuration - January 4, 2009 by Stephane Kattoor

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.
read this entry »

X10 Home automation : Heyu a tool for managing a CM11 - March 25, 2008 by Stephane Kattoor

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. read this entry »

Unix : the “script” command - November 29, 2007 by Stephane Kattoor

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
spaghetti:~$

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) - October 20, 2007 by Stephane Kattoor

If you want to replace a text throughout a file in the vi text editor, you can use the following command :
:1,$s/text/replacement/g

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 - August 14, 2007 by Stephane Kattoor

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
spaghetti%

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 - June 20, 2007 by Stephane Kattoor

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 - June 12, 2007 by Stephane Kattoor

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…

Building GNUCash on Debian - June 3, 2007 by Stephane Kattoor

I’ve just been through hell to get the HEAD revision of GNU Cash to build and run on GNU/Debian … The problem was that GNUCash depends, amongst many other dependencies, on Guile and on the SLIB library for Guile.

If you want to save you some hours, use the following Debian packages (and stick to those versions !)


guile-1.6;1.6.8-6;The GNU extension language and Scheme interpreter
guile-1.6-dev;1.6.8-6;Development files for Guile 1.6
guile-1.6-libs;1.6.8-6;Main Guile libraries
guile-1.6-slib;1.6.8-6;Guile SLIB support
libguile-ltdl-1;1.6.8-6;Guile's patched version of libtool's libltdl
libqthreads-12;1.6.8-6;QuickThreads library for Guile
slib;3a4-4;Portable Scheme library

Good luck !

« old entrysnew entrys »
Who am I ?
Ads