Divers: Difference between revisions

From hugovil.com
Jump to navigationJump to search
No edit summary
(46 intermediate revisions by the same user not shown)
Line 8: Line 8:


==Sylpheed==
==Sylpheed==
===Configuration du naviguateur===
  <nowiki>opera -newpage %s</nowiki>


===Configuration du serveur LDAP===
===Configuration du serveur LDAP===
Line 17: Line 14:
   (&(mail=*)(cn=*%s*))
   (&(mail=*)(cn=*%s*))


==Configuration du client Email dans Opera==
===Effacer le compte local MH===
  <nowiki> sylpheed --compose [mailto:%t][?subject=%s]</nowiki>


=Setup French Canadian (old ca_enhanced) layout=
  Sélectionner le compte local MH, et faire 'File - Mailbox - Remove mailbox'
 
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=
=Démarrage Linux sans authentification=
Line 109: Line 98:


=Installation CUPS-PDF=
=Installation CUPS-PDF=
   Sur le serveur (web admin interface, port 631), cliquer sur "Find New Printer"
   Sur le serveur (web admin interface, port 631, http://localhost:631/), cliquer sur "Find New Printer"


   Sélectionner "Generic Make"
   Sélectionner "Generic Make"
Line 118: Line 107:
   tar jcvf - directory | ssh user@host "cat > directory.tar.bz2"
   tar jcvf - directory | ssh user@host "cat > directory.tar.bz2"


=Navigateur par défaut pour les applications Gnome=
=Syntax highlighting MediaWiki=


Éxécuter:
Ajouter à la fin de /etc/mediawiki/LocalSettings.php:
  $> gnome-default-applications-properties


 
<source lang=ini>
=Syntax highlighting MediaWiki=
wfLoadExtension('SyntaxHighlight_GeSHi');
</source>


Replace in skins/monobook/main.css:
Replace in skins/monobook/main.css:
Line 169: Line 158:
=Combiner plusieurs documents PDF en un seul=
=Combiner plusieurs documents PDF en un seul=


   $> gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
   $> gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf


Si les sources sont des images, on peut utiliser ImageMagick:
Si les sources sont des images, on peut utiliser ImageMagick:
Line 176: Line 165:




=Désactiver mode large files=
=Changer l'orientation d'un document PDF=
 
  $> gs -sDEVICE=pdfwrite -sOutputFile=output.pdf -dNOPAUSE -dBATCH -dEPSCrop -c "<</Orientation 2>> setpagedevice" -f file1.pdf
 
  $> pdf90
 
=RTC=
 
Pour que Linux ajuste automatiquement son horloge selon le RTC au démarrage, il faut:
 
  Ne pas sélectionner "Enhanced Real-time clock Support" dans "Device Drivers  ---> Character devices  --->"
  Sélectionner (built-in ,pas modulaire) "Device Drivers  ---> Real Time Clock  ---> Set system time from RTC on startup and resume"
 
Avec ça, plus besoin du script /etc/rc.d/init.d/setclock
 
=Recherche dans un répertoire de Subversion=
 
==grep==
 
Utiliser cette commande pour avoir la colorisation avec les pipes, et pour ne pas afficher les résultats contenant le texte 'svn':
  grep -rn --color=always -e STRING * | grep -v svn | less -R
 
Cette version est plus efficace car elle élimine la recherche dans les répertoires '.svn':
  grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -R
 
Encore mieux: 'less' quitte si le texte peut être affiché entièrement à l'écran:
  grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -RF
 
Encore encore mieux: 'less' n'efface pas l'écran:
  grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -RFX
 
==ack==
 
Alternative à grep:
  http://betterthangrep.com/
 
Exemple:
  ack STRING --pager="less -RFX"
 
ack est intéressant car recherche les répertoires récursivement par défaut et ignore les répertoires '.svn', 'CVS' et autres similaires.
 
 
=Capture d'écran=
 
  import screenshot.png
 
=Permettre d'éteindre l'appareil sans être authentifié=
 
Enlever le '-a' de la ligne shutdown dans /etc/inittab
 
=Deleting files on mounted partitions in PcManFM gives error messge=


si vous avez ce message quand vous essayez de monter un disque:
Error message:
  Some files cannot be moved to trash can because the underlying file systems don't support this operation...


   EXT4-fs (sda1): Filesystem with huge files cannot be mounted read-write without CONFIG_LBDAF
Fix by creating a trash folder on the partition root:
  mkdir .Trash-1004
   chown -R 1004:1000 .Trash-1004/
  chmod 700 .Trash-1004/
 
=Encrypter un fichier=
  gpg -c filename
 
  cat file | gpg -c -o file.gpg
 
=Désactivation SSH strict checking=
 
Pratique quand on a le message d'erreur:


Selon la doc du kernel de Linux:


<source lang=text>
<source lang=text>
The ext4 filesystem requires that this feature be enabled in
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
order to support filesystems that have the huge_file feature
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!    @
enabled.  Otherwise, it will refuse to mount in the read-write
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
mode any filesystems that use the huge_file feature, which is
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
enabled by default by mke2fs.ext4.
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
</source >
</source >


The feature can be removed from an existing filesystem by running the following commands:
  $> ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@machine


  $> tune2fs -O ^huge_file /dev/whatever
  $> fsck /dev/whatever


This should allow you to mount the drive without CONFIG_LBDAF in the kernel.
=Monter une partition VFAT avec caractères accentués dans les noms de fichiers=


  $> mount -o codepage=850,iocharset=iso8859-1,utf8 /dev/sdx1 mount-point


=RTC=
=Vérifier si un disque est en mode actif ou pas=
 
  $> hdparm -C /dev/sdb
 
=2 moniteurs avec Debian =
 
Modifier:
 
  $>  /etc/gdm3/Init/Default
 
et ajouter la ligne:
 
<source lang=text>
  xrandr --output DVI-0 --auto --output VGA-0 --auto --left-of DVI-0
</source >
 
=Configurer Debian pour rouler les applications X remote=
 
Ajouter dans /etc/gdm3/daemon.conf:
 
<source lang=text>
  [security]
  DisallowTCP=false
</source >
 
Et faire:
 
  $> xhost +
 
=OpenWRT=
 
Luci install:
 
  $> opkg update
  $> opkg install luci
ou
  $> opkg install luci-ssl
 
Luci start:
 
  /etc/init/uhttpd start
 
Configure to start automatically:
 
  /etc/init.d/uhttpd enable


Pour que Linux ajuste automatiquement son horloge selon le RTC au démarrage, il faut:


  Ne pas sélectionner "Enhanced Real-time clock Support" dans "Device Drivers  ---> Character devices  --->"
=Effacer une ligne dans un fichier=
  Sélectionner (built-in ,pas modulaire) "Device Drivers  ---> Real Time Clock  ---> Set system time from RTC on startup and resume"


Avec ça, plus besoin du script /etc/rc.d/init.d/setclock
  sed -i -e '/#include "header.h"/d' main.c


=Scanner Epson Perfection V100 Photo=
  for f in *.{c,h}; do sed -i '/#include "header.h"/d' ${f} ;done


==Installation instructions for scanner EPSON Perfection V100 Photo==
=Comment se débarrasser du répertoire "Trash" dans INBOX sur serveur IMAP Dovecot=


The scanner can be controlled either by iscan or by xsane, but in both cases
Effacer les noms de répertoires indésirables dans le fichier ".subscriptions" sur le serveur.
the firmware files, the iscan plugin library, iscan-data, iscan and the
sane configuration files (dll.conf and epkowa.conf) must be installed.


Note 1: The usbfs (/proc/bus/usb) filesystem is not necessary even if using
= Xresources =
        libusb.


Note 2: It seems that the iscan-registry command must be executed even if
Pour voir la configuration actuelle:
        using sane.


Note 3: The epkowa back-end comes from iscan (not from sane).
  $> xrdb -query -all


1. Download:
  iscan-plugin-gt-s600-2.0.0-1.c2.i386.rpm
or
  iscan-plugin-gt-s600-2.1.2-1.x86_64.rpm


2. Extract content of RPM:
  rpm2cpio iscan-plugin-gt-s600-...rpm > iscan-plugin.cpio


3. Extract files from CPIO archive:
= .xsessionrc =
  mkdir iscan-plugin
  cd iscan-plugin
  cpio -ivd < ../iscan-plugin.cpio


4. Copy firmware files and plugin:
<source lang=bash>
  cp -a usr/share/iscan /usr/share
#!/bin/bash
  cp -a usr/lib/iscan  /usr/lib


5. Download and install " iscan-data_1.9.0-1.tar.gz"
# Nécessaire car lightdm ne lit pas /etc/profile (not a login shell):
  ./configure --prefix=/usr &&
if [ -f /etc/profile ]; then
  make &&
    . /etc/profile
  make install
fi


6. Download and install "iscan_2.26.4-2.tar.gz"
if [ -f ${HOME}/.profile ]; then
  ./configure --prefix=/usr --localstatedir=/var &&
    . ${HOME}/.profile
  make &&
fi
  make install


8. Create entry for scanner:
# Disable bell
  iscan-registry --add interpreter usb 0x04b8 0x012d \
xset -b
    /usr/lib/iscan/libesint66 \
    /usr/share/iscan/esfw66.bin


This will create the file /var/lib/iscan/interpreter.
xscreensaver -no-splash &


9. In "/etc/sane.d/dll.conf":
# Load resources
  epkowa
xrdb -merge .Xresources


10. Create file "/etc/sane.d/epkowa.conf":
DBUS_SESSION_BUS_ADDRESS="" dropbox start &
  usb
</source >


Note: when I put this line in epkowa.conf:
= Niveau de zoom dans Evince =
  usb 0x04b8 0x012d
it took 2 minutes for iscan to show the scan window!


11. Activate either xsane or iscan plugin (or both) for Gimp:
the maximal zoom is constrained by page cache size so by setting higher value you should be able to get higher zoom:
  ln -s /usr/bin/xsane /usr/lib/gimp/2.0/plug-ins
  ln -s /usr/bin/iscan /usr/lib/gimp/2.0/plug-ins


Example to launch xsane abd display some traces:
  gsettings set org.gnome.Evince page-cache-size 200
SANE_DEBUG_EPKOWA=CMD xsane


Example to specify the device directly:
= Bug NFS Debian =
SANE_DEBUG_EPKOWA=CMD xsane epkowa:interpreter


Message d'erreur:
    ...blkmapd[278]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory...


Avasys download URL:
Solution:
  http://www.avasys.jp/english/linux_e/dl_scan.html
    $> sudo systemctl disable nfs-blkmap

Revision as of 23:27, 11 April 2022

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

Email

Sylpheed

Configuration du serveur LDAP

LDAP search string:

 (&(mail=*)(cn=*%s*))

Effacer le compte local MH

 Sélectionner le compte local MH, et faire 'File - Mailbox - Remove mailbox'

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éez 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 $?

Si vous voulez démarrer X sans authentification pour un usager en particulier, voici le script à utiliser:

 #! /bin/sh
 su <usager> -c /usr/X11R6/bin/startx
 exit $?

Affichage des fichiers avec majuscule en premier

 set LC_COLLATE=C

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

Installation de style file latex

Éxécuter la commande:

 mktexlsr

après avoir installé le fichier .sty

Supprimer un "/" à la fin

DIR="/usr/local/bin/"
echo ${DIR%/}

Effacer plusieurs fichiers avec find

find . -name .svn -exec rm -rf {} \;

LFS: Comment sauver de l'espace disque

/usr/share/zoneinfo

If you copy your timezone to /etc/localtime instead of making the normal symbolic link, all of /usr/share/zoneinfo can be removed.

/usr/share/locale and /usr/lib/locale

If you don't use NLS, you can remove all the locale info in /usr/share/locale and /usr/lib/locale.

/usr/share/man

Les répertoires /usr/share/man{cs,de,es,fi,fr,sauver de l'espace disquehu,id,it,ja,ko} etc peuvent être enlevés.

Comment synchroniser deux répertoires

Le répertoire dest va devenir un miroir de src:

 $> rsync -av --delete src/* dest

Installation CUPS-PDF

 Sur le serveur (web admin interface, port 631, http://localhost:631/), cliquer sur "Find New Printer"
 Sélectionner "Generic Make"

 Model: Sélectionner "Generic CUPS-PDF Printer (en)"

tar avec SSH

 tar jcvf - directory | ssh user@host "cat > directory.tar.bz2"

Syntax highlighting MediaWiki

Ajouter à la fin de /etc/mediawiki/LocalSettings.php:

wfLoadExtension('SyntaxHighlight_GeSHi');

Replace in skins/monobook/main.css:

pre {
	padding: 1em;
	border: 1px dashed #2f6fab;
	color: black;
	background-color: #f9f9f9;
	line-height: 1.1em;

With:

pre {
	padding: 1em !important;
	border: 1px dashed #2f6fab !important;
	color: black;
	background-color: #f9f9f9 !important;
	line-height: 1.1em !important;

Lecture température disque dur

 $> hddtemp /dev/sda

SMART Disk Monitoring Daemon

 $> apt-get install smartmontools
 $> smartctl -t long /dev/sda [wait until test completes, then]
 $> smartctl -l selftest /dev/sda

Changement du mot de passe usager

Si vous avez ce message d'erreur:

 password for ' null ' gnome keyring

Il faut éxécuter:

 $> rm ~/.gnome2/keyrings/login.keyring

Combiner plusieurs documents PDF en un seul

 $> gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf

Si les sources sont des images, on peut utiliser ImageMagick:

 $> convert *.gif foo.pdf


Changer l'orientation d'un document PDF

 $> gs -sDEVICE=pdfwrite -sOutputFile=output.pdf -dNOPAUSE -dBATCH -dEPSCrop -c "<</Orientation 2>> setpagedevice" -f file1.pdf
 $> pdf90

RTC

Pour que Linux ajuste automatiquement son horloge selon le RTC au démarrage, il faut:

 Ne pas sélectionner "Enhanced Real-time clock Support" dans "Device Drivers  ---> Character devices  --->"
 Sélectionner (built-in ,pas modulaire) "Device Drivers  ---> Real Time Clock  ---> Set system time from RTC on startup and resume"

Avec ça, plus besoin du script /etc/rc.d/init.d/setclock

Recherche dans un répertoire de Subversion

grep

Utiliser cette commande pour avoir la colorisation avec les pipes, et pour ne pas afficher les résultats contenant le texte 'svn':

 grep -rn --color=always -e STRING * | grep -v svn | less -R

Cette version est plus efficace car elle élimine la recherche dans les répertoires '.svn':

 grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -R

Encore mieux: 'less' quitte si le texte peut être affiché entièrement à l'écran:

 grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -RF

Encore encore mieux: 'less' n'efface pas l'écran:

 grep --color=always -rn STRING $(find . -type f | grep -v '\.svn') | less -RFX

ack

Alternative à grep:

 http://betterthangrep.com/

Exemple:

 ack STRING --pager="less -RFX"

ack est intéressant car recherche les répertoires récursivement par défaut et ignore les répertoires '.svn', 'CVS' et autres similaires.


Capture d'écran

 import screenshot.png

Permettre d'éteindre l'appareil sans être authentifié

Enlever le '-a' de la ligne shutdown dans /etc/inittab

Deleting files on mounted partitions in PcManFM gives error messge

Error message:

 Some files cannot be moved to trash can because the underlying file systems don't support this operation...

Fix by creating a trash folder on the partition root:

 mkdir .Trash-1004
 chown -R 1004:1000 .Trash-1004/
 chmod 700 .Trash-1004/

Encrypter un fichier

 gpg -c filename
 cat file | gpg -c -o file.gpg

Désactivation SSH strict checking

Pratique quand on a le message d'erreur:


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
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 a host key has just been changed.
 $> ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@machine


Monter une partition VFAT avec caractères accentués dans les noms de fichiers

 $> mount -o codepage=850,iocharset=iso8859-1,utf8 /dev/sdx1 mount-point

Vérifier si un disque est en mode actif ou pas

 $> hdparm -C /dev/sdb

2 moniteurs avec Debian

Modifier:

 $>  /etc/gdm3/Init/Default

et ajouter la ligne:

  xrandr --output DVI-0 --auto --output VGA-0 --auto --left-of DVI-0

Configurer Debian pour rouler les applications X remote

Ajouter dans /etc/gdm3/daemon.conf:

  [security]
  DisallowTCP=false

Et faire:

 $> xhost +

OpenWRT

Luci install:

 $> opkg update
 $> opkg install luci

ou

 $> opkg install luci-ssl

Luci start:

 /etc/init/uhttpd start

Configure to start automatically:

 /etc/init.d/uhttpd enable


Effacer une ligne dans un fichier

 sed -i -e '/#include "header.h"/d' main.c
 for f in *.{c,h}; do sed -i '/#include "header.h"/d' ${f} ;done

Comment se débarrasser du répertoire "Trash" dans INBOX sur serveur IMAP Dovecot

Effacer les noms de répertoires indésirables dans le fichier ".subscriptions" sur le serveur.

Xresources

Pour voir la configuration actuelle:

 $> xrdb -query -all


.xsessionrc

#!/bin/bash

# Nécessaire car lightdm ne lit pas /etc/profile (not a login shell):
if [ -f /etc/profile ]; then
    . /etc/profile
fi

if [ -f ${HOME}/.profile ]; then
    . ${HOME}/.profile
fi

# Disable bell
xset -b

xscreensaver -no-splash &

# Load resources
xrdb -merge .Xresources

DBUS_SESSION_BUS_ADDRESS="" dropbox start &

Niveau de zoom dans Evince

the maximal zoom is constrained by page cache size so by setting higher value you should be able to get higher zoom:

 gsettings set org.gnome.Evince page-cache-size 200

Bug NFS Debian

Message d'erreur:

   ...blkmapd[278]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory...

Solution:

   $> sudo systemctl disable nfs-blkmap