Sagar Behere

I doubt, therefore I might be

Swapping workplaces with i3

i3 is a neat, tiling window manager. This post describes a trick when using dual monitor setups.

If you have workspace 1 on one monitor and workspace 2 on another monitor and want to quickly swap the workspaces among the monitors, you can use i3's IPC mechanisms to do it. Here's how:

i3 already includes a way to move an individual workspace from one monitor to another. But what we want to achieve is the simultaneous movement of workspaces between the monitors. To do this, we can write a script that detects the currently active workspace on each ...

Cross-compiling the orocos toolchain

This document describes how to cross compile the orocos toolchain and create, cross-compile and deploy new orocos packages to your target host.

This approach has been tested with on debian testing (wheezy) and the host is a gumstix (ARM) embedded platform. Debian tools/repositories are used extensively throughout the process.

As of now, you cannot use orogen (and probably typegen) with this approach, but this is probably due to some shortcoming in my (Sagar Behere) knowledge of how these tools work.


host is the computer that you will execute the your cross-compiled code on. This is usually your embedded ...

Moved to Octopress

This blog has moved to Octopress.

Octopress is a static website generator. This means that the entire site is static HTML and there is no need for a database and/or PHP on the server. Apart from increasing the speed and security of the site, the primary reason why Octopress is so appealing is its workflow philosophy.

Using Octopress is similar to writing a program in C/C++. You create your content (blog posts etc.) and then "compile" the site and "deploy" it. The deployed site is self-contained. As a programmer, this approach is very appealing to me. Also, the ...

ownCloud webdav zero filesize?

ownCloud is a handy little way to create your own cloud storage and/or Dropbox equivalent. When I implemented owncloud on my server and tried to upload files using webdav (by copying to a folder mounted using davfs2), the copied files ended up having a file size of 0kb. Even more disturbingly, the copied file sizes appeared fine immediately after copying, but were then displayed as zero a few moments later.

The fix for this, if you are using GNU/Linux (and why would you be using anythinge else?) is to put the following in /etc/davfs2/davfs2.conf

use_locks ...

Guide to installing Debian and Xenomai on gumstix Overo

I finally managed to get Debian squeeze working on the gumstix Overo COM, with a Xenomai patched realtime kernel. The main benefit with this setup is access to the vast debian repositories via apt-get and also that with an ARM chroot environment, it is not necessary to cross-compile packages anymore.

I've put the detailed procedure on the gumstix wiki. You can read it at

Backporting lyx-2.0.2 to debian squeeze

I used the debian-ized sources for lyx-2.0.2 from the testing repository. To do this,  make sure you have the following line in your apt sources

deb-src testing main contrib non-free

and do apt-get update, if you have just added it. Then use the following commands (and of course, replace /home/sagar/my_build with a path of your choice)

  • sudo apt-get build-dep lyx

  • sudo apt-get install libmythes-dev devscripts

  • mkdir /home/sagar/my_build; cd /home/sagar/my_build

  • apt-get -t testing source lyx

  • cd lyx-2.0.2

  • debchange -b -v 2.0.2-1~smb50+1 ...

Swapping Ctrl and CapsLock using the keyboard layout file

Here is one of the most hardcore ways to swap the Ctrl and Caps Lock keys on your keyboard, using linux.

I use a customized dvorak based keyboard layout, and prefer to have the Ctrl and CapsLock keys swapped. However, since "normal" people sometimes need to type on my keyboard, I need the ability to switch to a regular layout quickly. That is easily done with GNOME's keyboard layout panel applet. However, if you use any of the standard methods to swap the Ctrl and CapsLock keys, the keys are not 'un-swapped' when reverting to a normal layout. To ...

An absolutely minimal chroot

There are two common scenarios when you want to permit semi-trusted users access to your SSH server.

In the first case, you want to permit the user access to SFTP without allowing him/her to log in via SSH and execute commands. This can be achieved by by chroot'ing the user account in question. Just add a stanza similar to the following at the end of /etc/ssh/sshd_config

Match User username ChrootDirectory /empty/directory AllowTCPForwarding no X11Forwarding no ForceCommand /usr/lib/openssh/sftp-server

The trick is in the ForceCommand. Man sshd :)

In the second scenario, you want to ...

The Magic of SSH

SSH is freaking amazing! I just discovered yet another thing that can be done with SSH. A SOCKS5 proxy. If you have server running ssh, then on your local computer just execute the following command (you are running Linux, arn't you?)

ssh -N -D 5555

replacing 5555 with whatever port number you choose. With unprivileged ports, you can do this even a non-root user. The -N option makes sure ssh stays idle and doesn't execute any commands. -D starts up dynamic port forwarding on port 5555 and talks to the clients via SOCSK5 or SOCKS4 ...

Amazing ball

Here is a video of the Amazing Ball I worked on at the ARTIST summer school in Pisa. We modified the existing setup so that the setpoint in dynamically generated. This enabled moving the ball along a desired trajectory.

This one is dedicated to all those people who believe that I had nothing but fun in Pisa. You were right.