Latest Publications

Automate SSH known_hosts cleanup

If you like me, you have to do a lot of installs[1] of the same test machine with the same IP and have to ssh it you will notice this annoying message :

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
54:9d:c0:37:3a:80:48:6c:82:ec:d1:84:93:61:24.
Please contact your system administrator.
Add correct host key in /home/cboudjnah/.ssh/known_hosts
to get rid of this message.
Offending key in /home/cboudjnah/.ssh/known_hosts:595
Password authentication is disabled to avoid
 man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid
man-in-the-middle attacks.
Agent forwarding is disabled to avoid man-in-the-middle attacks.

I have automated the cleanup by a script :
[code lang="bash"]
#!/bin/bash
H=$1

[[ -z ${H} ]] && { echo "Need a host as argument"; exit 1 ;}
LINE=$(ssh -o StrictHostKeyChecking=yes $1 'exit' 2>&1 | sed -n '/Offending key/ { s/.*://;s/r//;p }')
[[ -z ${LINE} ]] && { echo "Nothing to clean"; exit; }
sed -i -n "$LINE!p" ~/.ssh/known_hosts[/code]
[1] Like having to tests bunch of FAI.

Linus Torvalds on GIT

Pretty good video to look if you like to know more about git and its creation :

http://www.youtube.com/watch?v=4XpnKHJAok8

Mandriva Popular in Australia

I have conducting a lot of different interviews for a position available as Linux Sysadmin in my company. What surprised me is the number of people having Mandrake/Mandriva on there resume as there first and current Linux experience. Make me proud everytime to have worked in such company so well known everywhere i go.

Little one coming in July

Little one (Noah) and his mum are coming in July, this is pretty cool :)

Noah looking at us

Always search before coding

This is a annoying, even if it take 5mn to code thing like that :

(defun my-dired-rm-rf()
  "Rm -rf directories"
  (interactive)
  (let ((sel (selected-window)))
	(dolist (curFile (dired-get-marked-files))
	  (if (yes-or-no-p (concat "Do you want to remove \"" (file-name-nondirectory curFile) "\" ? "))
		  (progn
			(shell-command (concat "rm -rvf " curFile) 
"*Removing Directories*")
			(kill-buffer "*Removing Directories*")
			(select-window sel)
			(revert-buffer)
			)
		))
	))

you discover after a litlle while that if you have did a lilt bit of searching before, you will have discovered a variable call `dired-recursive-deletes` that would do the thing in a much better way.

Import Export to different tablespace names with Oracle 9i

Renaming Oracle Database is a pain, coming from OpenSource DB like
MySQL or PostGres where we do that all the time i did not think that
Oracle have to be such a pain.

My only way i can find.

- If i have the tablespace named tablesp1 and owned by the
user user1, and i want to import it to another tablespace
called tablesp2 in an another Oracle 9i tablespace with the user
name user2.

  • I import the tablesp1 in an Oracle 10 (if you are lucky to have
    one).
  • Make sure i create the user2 in the Oracle10 DB.
  • I connect as DBA access and i rename the tablespace with :
    [code lang="sql"]
    ALTER TABLESPACE tablesp1 RENAME TO tablesp2
    ALTER TABLESPACE tablesp2 OWNER TO user2
    [/code]

  • Export the Oracle10 tablespace with Oracle 9 exp.
    Sometime sometime you may encounter that famous error

    "EXP-00003 : no storage definition found for segment .....".
    

    So you have have to
    do this as well.

  • That’s it. The dump should be under tablespace name tablesp2 with
    owner user2.

SVN Diff against changes in the remote repository.

A useful svn wrapper scripts. Get a diff of your local repostitory against the upstream repository changes. I wonder why it is not builtins though like a svn status -u but for dif.

#!/bin/bash
 
IFS="
"
for line in `svn status -u`;do
    [[ $line != "   "* ]] && continue
    rev=`echo $line|awk '{print $2}'`
    ff=`echo $line|awk '{print $3}'`
    svn diff -r${rev}:HEAD $ff
done

Stopped smoking

Cigarette Ashtray
While reading this entry. I just remembered that it has been a a litle bit more than a month that i stopped smoking. I was a real smoker, smoking a 25 red malboro every day. But one day i wake up (one of those
days you know) and like that i thought to maybe stop smoking. So far it has been good, the hardset part is the first days really, after it get OK. I hope it will last for me, i feel so much better i think since i stopped smoking.

OpenSource Jokes

Funny website that you should checkout :

http://opensourcejokes.com/

i wish theses guys were not putting some stupids google ads on the site. But well i know them it’s a day to day full time job to be the funny guys of the place ;)

Emacs nighly cvs snapshot with xft on Ubuntu Edgy

I wanted to try the latest cvs snapshot with XFT support, since i did not want to screw up more my workstation i have used packages instead of make install blindy.

Basically i have a script called ./build.sh

#!/bin/bash
set -e
 
d=$(date '+%Y%m%d')
debpatch=20061218-1
 
mkdir -p cvs
 
pushd cvs >/dev/null && {
cvs -Q -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs
} && popd >/dev/null
 
mkdir -p build
[[ -d build/emacs-${d} ]] && rm -rf build/emacs-${d}
cp -al cvs/emacs build/emacs-${d}
 
zcat patches/emacs-snapshot_${debpatch}.diff.gz|patch -p1 -d build/emacs-${d}
cat patches/with-font.patch|patch --silent -p1 -d build/emacs-${d}
 
pushd build/emacs-${d} >/dev/null && {
    chmod +x debian/rules
    dch -v "1:${d}-1" "New snapshot."
    dch "Build with xft."
    fakeroot dpkg-buildpackage -b
} && popd >/dev/null

in patches/with-font.patch i have :

--- c/debian/rules.chmou        2007-01-21 23:21:09.486353750 +1100
+++ c/debian/rules      2007-01-21 23:21:13.914630500 +1100
@@ -393,7 +393,7 @@
 # Emacs-gtk confflags
 emacs_gtk_confflags := ${confflags}
 emacs_gtk_confflags += --with-x=yes
-emacs_gtk_confflags += --with-x-toolkit=gtk
+emacs_gtk_confflags += --with-x-toolkit=gtk  --enable-font-backend --with-xft
 
 # Emacs-nox confflags
 emacs_nox_confflags := ${confflags}
--- c/src/emacs.c.chmou 2007-01-21 23:21:09.486353750 +1100
+++ c/src/emacs.c       2007-01-21 23:22:18.430662500 +1100
@@ -1408,10 +1408,10 @@
     = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
 
 #ifdef USE_FONT_BACKEND
-  enable_font_backend = 0;
-  if (argmatch (argv, argc, "-enable-font-backend", "--enable-font-backend",
-               4, NULL, &skip_args))
     enable_font_backend = 1;
+  if (argmatch (argv, argc, "-disable-font-backend", "--disable-font-backend",
+               4, NULL, &skip_args))
+    enable_font_backend = 0;
 #endif /* USE_FONT_BACKEND */
 
 #ifdef HAVE_X_WINDOWS
@@ -1816,7 +1816,7 @@
   { "-unibyte", "--unibyte", 81, 0 },
   { "-no-multibyte", "--no-multibyte", 80, 0 },
   { "-nl", "--no-loadup", 70, 0 },
-  { "-enable-font-backend", "--enable-font-backend", 65, 0 },
+  { "-disable-font-backend", "--disable-font-backend", 65, 0 },
   /* -d must come last before the options handled in startup.el.  */
   { "-d", "--display", 60, 1 },
   { "-display", 0, 60, 1 },

i have as well in patches/ the ubuntu (or could be debian) patch downloaded from the ubuntu (or debian archive) archive which is for ubuntu on

http://archive.ubuntu.com/ubuntu/pool/universe/e/emacs-wiki

If there is a new version you will need to increase the version in build.sh to match the patch downloaded.

When running build.sh it should produce binary in build/* with xft enabled by default. Make sure to have all the dependencies (dpkg-buildpackages should tell you if there is unresovled one).

One screenshot :

Screenshot of Emacs snapshot with XFT