Update Emacs/VIM tags with inotify

July 3rd, 2009

When you use the tags interface for Emacs or with VIM you have to generate your tag file everytime you have a new class or things get changed.  Would not be cool to have inotify monitoring your project directory and run the etags command to generate it.

With incron you have cron that can watch some portion of the filesystem and generate an action if certain event appears.  So after installed (aptitude/urpmi) it I have configured this incrontab entry :

/home/chmouel/git/myproject IN_CLOSE_WRITE /home/chmouel/update-ctags.sh py $@ $@/$#

The script update-ctags.sh takes 3 argument one is the type of file to update when it’s changed it accept multipe of them if you delimit with a pipe ie: py|inc|php|c and the two others are identifier from incron to give the base directory and the full path which is something you should not have to change.

The update-ctags is simple as follow which could be hacked for your convenience :

#!/bin/bash

ACCEPTED_EXTENSION="$(echo $1|sed 's/|/ /g')"
BASE_DIR=$2
FILE_EXT=${3##*.}

[[ -z ${FILE_EXT} ]] && exit

processing=
for extension in $ACCEPTED_EXTENSION;do
    [[ $extension == $FILE_EXT ]] && processing=true
done

find ${BASE_DIR} ! -wholename './.git/*'  -a ! -wholename './.svn/*' -a ! -name '*.pyc' -a ! -name '*~' -a ! -name '*#' -print0| xargs -0 etags -o ${BASE_DIR}/TAGS 2>/dev/null >/dev/null
/home/chmouel/git/swift-container IN_CLOSE_WRITE /home/chmouel/updatectags.sh py $@ $@/$#

Emacs

Debian Lenny on Dell Optiplex 760

June 16th, 2009

So if you get that shiny new Dell desktop and ACPI spit bunch of message at the install time and the network driver does not get detected you can follow these steps to have it working.

- Continue the install without the network until you reboot to grub.

- Add hpet=disable at the end of the boot kernel parameter and get into the system.

- Download the latest kernel for your architecture on :

http://kernel-archive.buildserver.net/debian-kernel/pool/main/l/linux-2.6/

- Transfer it on a USB key and dpkg -i it.

- Make sure you add the hpet=disable at the kopt option of /boot/grub/menu.lst and launch a update-grub.

- On reboot you should now have the network you can do the standard tasksel to install a Desktop etc….

Debian

What type of MySQL table schemas

May 11th, 2009

Since I always forget stuff like this. This is the SQL query to detect mysql table schemas type (thanks to Darren.B) :

SELECT table_name, table_schema, table_type, engine FROM information_schema.tables where table_schema not in (’information_schema’, ‘mysql’);

MySQL

Using ProxyCommand with OpenSSH and a Bastion server.

February 8th, 2009

So at work we have to use a bastion host for all our connections to servers to be able to get called PCI compliant. This kind of stuff could be a pain to use when you have to use another host to do RSYNC/SCP or other stuff that need direct transfer to workstation.

Thankfully OpenSSH is very flexible and have multiple options to easy the pain. If you add this to your ~/.ssh/config :

Host bastion
Hostname IP_ADDRESS_OF_BASTION_SERVER
User YOUR_USERNAME
ProxyCommand none
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

Host *
ProxyCommand ssh -qax bastion ‘nc -w 600 %h %p’

This will allow you to pass all SSH requests to the bastion server.

I have experimented with different options and this seems to be most efficient way. The ControlMaster ControlPath is to speed up the connections by not reopening a tcp socket all the time to the bastion server. This seems to cause problems with the OpenSSH version shipped with some distros (ie: Fedora) so you may want to remove it if you experience problems. For the ProxyCommand there is way to use cat like this :

ProxyCommand ssh bastion ‘exec 3<>/dev/tcp/%h/22;(cat <&3 & );cat >&3′

but the cat processes seems to hang in memory on the bastion server so netcat seems a better option.  I heard that tcpconnect from the tcputils package should make things smoother but I haven’t tried that.

I have other options in my SSH configuration to allow to be less verbose see ssh_config(5) manpage for detailed description of each of these options :

Host *
ForwardAgent yes
GSSAPIAuthentication no
VerifyHostKeyDNS no
StrictHostKeyChecking no
HashKnownHosts no
TCPKeepAlive yes
ServerAliveInterval 600

By the way forgot to mention you would need to have SSH key exchange configured with the bastion server with a SSH agent runing (these days all distros should do that by default) to don’t have to type the password of your username on bastion server.

I have heard there is way to do that on Windows with putty and plink but I haven’t tried that see this post here about it.

Scripts

Looking for a flat to rent in Paris?

February 8th, 2009
The Living Room

The Living Room

I have a Friend renting a nice flat  in the center of Paris for short and middle term since I have a lot of friends/colleagues asking me about the best and the cheapest place  to stay in Paris I thought to reference her ads here :

CHARMING APARTMENT TO RENT IN LE MARAIS – BEAUBOURG

Located in the Beaubourg – Le Marais area, this apartment is very well-situated in the historical heart of Paris: five minutes away from Pompidou Center and Châtelet-Les Halles underground station.

Into a 18th Century building, this bright and quiet apartment will let you enjoy the great life of Paris whilst providing you with an intimate and soft nest to relax in.

Discover this charming one bedroom apartment and feel at home

Check the website here for more information :

www.parisrentapart.fr

Misc

Noah in December

February 8th, 2009

London under the snow

February 2nd, 2009

This morning London have seen one of the worst snow storm since 10 years.

01022009230_0.jpg

Picture 1 of 3

Life

Kitesurfing in Fuerteventura

January 29th, 2009

Noah in London

December 5th, 2008

A month ago Noah came over here to spend some time in London.

Noah

Night in Paris

October 12th, 2008

Rabouin Francois et Denis


Life