Divers: Difference between revisions

From hugovil.com
Jump to navigationJump to search
No edit summary
No edit summary
Line 23: Line 23:
       Option          "XkbVariant"    "fr"
       Option          "XkbVariant"    "fr"


'''Démarrage Linux sans authentification'''
Dans le fichier /etc/inittab, remplacer cette ligne:
  1:12345:respawn:/sbin/agetty 38400 tty1
par celle-ci:
  1:12345:respawn:/sbin/agetty -n -l /bin/bootdisk-login 38400 tty1
et crééz le script /bin/bootdisk-login:
  #! /bin/sh
  export HOME=/root
  export PS1='\u:\w\$ '
  export PATH=/bin:/usr/bin:/sbin:/usr/sbin
  cd ${HOME}
  /bin/bash --login
  exit $?


'''How to do a search and replace over multiple files?'''
'''How to do a search and replace over multiple files?'''

Revision as of 18:31, 10 March 2008

Divers

Pour capturer les données sur le réseau:

 tcpdump -X -n -t -s 0 src 192.168.0.45

Pour afficher une image en arrière-plan (X-Windows):

 wmsetbg --center --workspace 0 image.jpeg

Configuration du naviguateur dans Sylpheed

 opera -newpage %s

Configuration du client Email dans Opera

  sylpheed --compose [mailto:%t][?subject=%s]

Setup French Canadian (old ca_enhanced) layout

With Xorg7, "ca_enhanced" is no more. You have to do a little trick to get the same layout that you are used to: Switch the old:

      Option          "XkbLayout"     "ca_enhanced"

To:

      Option          "XkbLayout"     "ca"
      Option          "XkbVariant"    "fr"

Démarrage Linux sans authentification

Dans le fichier /etc/inittab, remplacer cette ligne:

 1:12345:respawn:/sbin/agetty 38400 tty1

par celle-ci:

 1:12345:respawn:/sbin/agetty -n -l /bin/bootdisk-login 38400 tty1

et crééz le script /bin/bootdisk-login:

 #! /bin/sh
 export HOME=/root
 export PS1='\u:\w\$ '
 export PATH=/bin:/usr/bin:/sbin:/usr/sbin
 cd ${HOME}
 /bin/bash --login
 exit $?

How to do a search and replace over multiple files?

You could use find and sed, but I find that this little line of perl works nicely:

   perl -pi -w -e 's/search/replace/g;' *.php 
 -e means execute the following line of code.
 -i means edit in-place
 -w write warnings
 -p loop

Example I had the following style sheet in a section:

 <link rel="stylesheet" type="text/css" href="../includes/style.css">

and I wanted the following instead:

 <link rel="stylesheet" type="text/css" href="admin.css">

As each expression is a regular expression you've got to escape the special characters such as forward slash and .

 \.\.\/includes\/style\.css

So the final line of code ends up as

 perl -pi -w -e 's/\.\.\/includes\/style\.css/admin\.css/g;' *.php