Automate SSH known_hosts cleanup

If you like me, you have to do a lot of installs1 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 ...

May 30, 2007

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

May 29, 2007

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.

February 11, 2007

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. ...

February 7, 2007

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

February 7, 2007

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:[email protected]:/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 : ...

January 21, 2007

History expansion and substitions in ZSH

I better to keep that somewhere since i always forget that thing, to do a search and replace from the command line in zsh. you just have to do the :s^FOO^BAR after your expansion For example you just have typed the long command line : blah bar FOO=1 FOO=3 FOO=6 cnt=1 you can just type : !blah:s^FOO^VALUE^:G and it will be expanded to : blah bar VALUE=1 VALUE=3 VALUE=6 cnt=1

January 11, 2007

Rename bunch of file via regexp

To rename bunch of files via regexp i was using before a homegrown python script call rename-regexp.py{#p38} to change bunch of files with a regexp. But since then i discovered wdired which is pretty fantastic to use that from emacs. With the extended ``query-replace-regexp`` from Emacs22 stuff are much easier to rename.

January 7, 2007

Benchmarking with PGBench: TPS results.

pgbench is not the best tools to benchmark postgres but it’s the one shipped by default with postgres. It does not do a good job for benchmarking your “web apps” SQL wise, it will give you some good indication about how fast is your server for postgres. Here are some results we have collected using theses options : pgbench -Uuser -s 10 -c 10 -t 3000 benchmark We configure servers with RAID 1+0 with write-cache and a battery backup, we have tested with postgres 8.1.5 and here are the best results for different type of servers : ...

January 6, 2007

Compile tora with oracle

After installing Oracle instant client, if you have them in /usr/local/lib/instantclient_10_2, this is the command line i use : ./configure –with-instant-client=/usr/local/lib/instantclient_10_2 –with-oracle-includes=/usr/local/lib/instantclient_10_2/sdk/include –with-oracle-libraries=/usr/local/lib/instantclient_10_2 –with-oci-version=10G Let me know ny email if you want the deb for ubuntu linux.

January 4, 2007