svn remove –keep-local Comments Off

tout est dans le titre !
pour ne plus versionner des fichiers sur voter projets sans pour autant les supprimer du disque local utilisez la commande magique
svn remove --keep-local ./the/file/i/should/not/commit.ext

Tags: svn, sysadmin, tips

Disctinct IP details in apache access.log 1

awk 'NR<=10000{a[$1]++; }END{for (i in a) printf "%-6d  %s\n",a[i], i |"sort -n"}' access.log

Tags: script, sysadmin, tips

Réinstallation complète de macosx, comment bien configurer son environnement Comments Off

Suite à un crash de disque dur (paix à son âme) je profite de cette install tout fraîche de macosx 10.6 pour bien configurer mon environnement.

Pour mémo:

  • Autoriser l’accès SSH sur la machine (pref système > partage > session à distance)
  • créer un fichier /.profile
  • créer un dossier ~/bin
  • dans ~.profile, personnaliser le PATH comme suit :export PATH=~/bin:$PATH
  • mettre dans ~/bin les liens symbolique et script utiles
    1. contrôle d’itunes (http://gist.github.com/184838)
    2. contrôle du volume (http://gist.github.com/184840)
    3. cd ~/bin && ln -s /Applications/MAMP/bin/php5/php php
    4. ln -s /Applications/MAMP/Library/bin/mysqladmin mysqladmin
      ln -s /Applications/MAMP/Library/bin/mysql mysql
      ln -s /Applications/MAMP/Library/bin/mysqldump mysqldump
    5. etc …
  • virer les applications hadoc de /usr/bin (php au hasard)

Bon évidemment l’idéal aurait été de faire un Rsync du dernier backup sur la lunxbox mais bon c’ets moins marrant ;-)

Tags: Apple, bonne pratiques, gist, Macosx, MAMP, mysql, PHP, rsync, script, SSH, sysadmin, tips

listening music remotely with Banshee + ssh -X ! Comments Off

just a small post to explain how i save 100€ today !

instead of buying an airport express to listen my music through wifi, and because my backup server is 10cm far from my sound system, i just discover that ssh -X allow me to pilot Banshee (itunes-like software on linux) so i can listen to all music that is on my backup server through wifi

for those who want to do the same :
ssh -X user@server
sudo apt-get install banshee

and then just launch banshee :
banshee
and that’s all, you should have the banshee software running on your remote computer but displayed on your local one, just import your music from local directories (on the server) and start playing songs :) dont forget to plug a audio-wire from your server to your sound system.

Tags: music, SSH, sysadmin, tips

Grep + Awk Comments Off

another tips for unix file management :

how to use grep an awk combined ? here is a simple example : i want to delete those boring ._* files created by macosx that i scp to my server

make a test :
find myDirectory/ "\._*" | grep "\._" | awk '{print "rm "$1}' > tmp_file

if cat tmp_file looks good, then execute the code !
find myDirectory/ "\._*" | grep "\._" | awk '{print "rm "$1}' | sh

there is probably better but i just know this tips :)

Tags: sysadmin, tips, ubuntu

How to add a post-commit mailing on SVN Comments Off

Here is a short mémo on how setting up an automatic emailing when a user commits files on a svn repository
Assuming you use a Ubuntu/Debian-based OS.

  1. First step : make sure you have a functionnal SVN-repository on the machine
  2. 2nd step : we’ll need libsvn-notify-perl package :sudo apt-get install libsvn-notify-perl
  3. You may now have the svnnotify binary in /usr/bin/ or something like this. try whereis svnnotify if you don’t know where it is
  4. go to you repository’s directory:cd /home/myname/svn/project1/
  5. create a file named post-commit in ./hooks/ and make it executable by www-datatouch ./hooks/post-commit && chown www-data:www-data ./hooks/post-commit && sudo chmod u+x ./hooks/post-commit
  6. Now edit post-commit file and write the following :#!/bin/sh
    REPOS="$1"
    REV="$2"
    /usr/bin/svnnotify -r "$REV" -C -d -H Alternative \
    --alt HTML::ColorDiff -p "$REPOS" -t "to@domain.tld" \
    --from 'from @ domain.tld ' \

    just replace to@domain.tld and from@domain.tld by your correct email adresses (advising that to@domain.tld may be a mailing-list that mail all the people that work on the project)
  7. Additionnaly, you can add this : --reply-to `cat "/home/myname/etc/svn-authors/myproject/$AUTHOR"`\ assuming that you have files that contains the email of each svn-user in the /home/myname/etc/svn-authors/myproject/ directory
    E.G : in the etc/svn-authors/myproject/ directory you can
    echo -n 'firstName.lastName@domain.tld' > userPseudo foreach of yours svn-users

Good luck !

Tags: devloppement, svn, sysadmin, tips, tool, ubuntu

Rsync mémo Comments Off

A good way to Rsync files from ( excluding ‘._*’ files on my mac, you may need to exclude .svn files) :
rsync -avh --progress --exclude='._*' SRC_DIRECTORY DST_DIRECTORY

-v : verbose
-h : human readable
–progress : progress …
-a :

-a, –archive archive mode; same as -rlptgoD (no -H)

Moreover the -n option may be useful to preview the rsync results.
More options in the man-page ;-)

Tags: bonne pratiques, rsync, sysadmin, tips

Mysql mémo – marcarea.com Comments Off

Je relaye le post “mémo”, de Marc alias Kemar , sur Mysql et particulièrement la “bonne” configuration pour le support d’UTF-8.

À noter plus particulièrement :

[mysqld]
default-character-set = utf8
[mysql]
default-character-set = utf8
[mysqldump]
default-character-set = utf8

et si vous essayez de faire les chose bien avec de l’existant :

ALTER TABLE table_name CONVERT TO CHARACTER SET utf8;

Tags: mysql, sysadmin, utf-8