Divers: Difference between revisions

From hugovil.com
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
=Pour capturer les données sur le réseau=
  <nowiki>tcpdump -X -n -t -s 0 src 192.168.0.45</nowiki>
=Pour afficher une image en arrière-plan (X-Windows)=
=Pour afficher une image en arrière-plan (X-Windows)=
   <nowiki>wmsetbg --center --workspace 0 image.jpeg</nowiki>
   <nowiki>wmsetbg --center --workspace 0 image.jpeg</nowiki>
=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 $?
=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.


=Syntax highlighting MediaWiki=
=Syntax highlighting MediaWiki=

Revision as of 19:34, 2 April 2026

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

 wmsetbg --center --workspace 0 image.jpeg

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;


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/


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



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 &


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

XTerm

Pour sauvegarder le contenu du terminal dans un fichier faire:

 Ctrl-Clickleft et sélectionner
   "Print-All Immediately"

Cela va générer un fichier $HOME/XTermYYYY-MM-DD.hh.mm.ss