Table des matières
3 billet(s) pour janvier 2026
| Notes rsh rcp | 2026/01/21 18:08 | Jean-Baptiste |
| Git - Duplication d'un dépôt | 2026/01/19 10:22 | Jean-Baptiste |
| Exemple simple de conf Nagios | 2026/01/14 10:07 | Jean-Baptiste |
Vim hex
http://www.kevssite.com/2009/04/21/using-vi-as-a-hex-editor
Sometimes I find it useful to switch to hex mode when editing a file in vi. The command for switching is not very obvious so thought I’d share… So, open a file in vi as usual, hit escape and type:
:%!xxd
to switch into hex mode And when your done hit escape again and type:
:%!xxd -r
to exit from hex mode. Okay, so this isn’t actaully switching to vi’s ‘hex mode’; vi doesn’t have one. What the above actually does is to stream vi’s buffer through the external program xxd.
Verrouiller sa session sous GNU/Linux
Voir aussi :
loginctl lock-sessionxdg-screensaver lock
protector de pantalla (xlock) Un protector de pantalla mas ligero que el xscreensaver es xlock
Instalación $ apt-get install xlockmore xautolock $ apt-get install vlock away
xautolock es el protector. xautolock es un demonio para bloquear automáticamente la pantalla $ xautolock -time 5 & Levanta en background bloquear la pantalla si en cinco minutos no hay actividad.
Source : http://petrohs-log.blogspot.fr/2008_12_01_archive.html
vlock
Le nouveau paquet de Jessie (vlock_2.2.2-5) s'est vu retiré le fichier /usr/lib/vlock/modules/new.so suite à un bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702705
Pour ma part, je ne suis pas confronté à ce bug. Je récupère donc le fichier /usr/lib/vlock/modules/new.so du paquet vlock_2.2.2-3_amd64.deb (Debian Wheezy)
$ vlock -n vlock: loading plugin 'new' failed: No such file or directory
Voir :
http://bts.grml.org/grml/issue1342
http://comments.gmane.org/gmane.linux.distributions.grml.devel/154
vlock -san
wget http://ftp.fr.debian.org/debian/pool/main/v/vlock/vlock_2.2.2-3_amd64.deb ar x vlock_2.2.2-3_amd64.deb tar xf data.tar.gz cp ./usr/lib/vlock/modules/new.so /usr/lib/vlock/modules/ chown root:root /usr/lib/vlock/modules/new.so
Verrouillage transparent de l'écran
xlock -mode blank -geometry 1x1
Un remplacent pour vlock : physlock
Verrouillage graphique
Liste :
- xtrlock
- xlockmore
- slock (suckless-tools)
xscreensaver-command -lock
Remplacer uuencode/uudecode par openssl
Voir aussi :
- base58
Exemple
$ echo -n "Test" | openssl base64 VGVzdA==
$ echo "VGVzdA==" |openssl base64 -d Test
En encore
cat /usr/share/doc/systemd/LICENSE.LGPL2.1 |head -12 |gzip |openssl base64
H4sIAAsBF1cAA2VRwW7CMAy95yvecZO6ijLtwBFQQUgdQnTsMu2Qti6NVhKUuCD+ fg6MHTYrOdh+7/nJBv7Gcr1DkZdlvsUyX+fbaYHNblas5pCfr8tc/aPc4p18MM5i nGYJFlT5QfsLsslkohTm7njxZt8xHuaPsSiY2MLCE6F0LZ+1JyzcYBvNIpNgZetU 4SUTiLZfvbEoWcAs4qblDoveOZ9g5gJH+OsUGI2zbPSUPY8yYFdOFfIT+YuzBBNw JH8wzNSAHWrxA20bNCawN9XABMFWMvsQm4aCgmvBnTB7U5MNhMbVw4GsOBA86k7b vbF7GI7y1jF037szNalSH2+RKI87Qmt8YHjqSQcZf/pZ1FWeUFAI5LHcFCmwiiIh +hssiwV9UwhDXQvM+TvpeiVT+bjizVCJQ0mvLpNf/XGCjmxN6sq4V+1wqGScXCn9 VOob+cnrRwACAAA=
( cat <<EOF H4sIAAsBF1cAA2VRwW7CMAy95yvecZO6ijLtwBFQQUgdQnTsMu2Qti6NVhKUuCD+ fg6MHTYrOdh+7/nJBv7Gcr1DkZdlvsUyX+fbaYHNblas5pCfr8tc/aPc4p18MM5i nGYJFlT5QfsLsslkohTm7njxZt8xHuaPsSiY2MLCE6F0LZ+1JyzcYBvNIpNgZetU 4SUTiLZfvbEoWcAs4qblDoveOZ9g5gJH+OsUGI2zbPSUPY8yYFdOFfIT+YuzBBNw JH8wzNSAHWrxA20bNCawN9XABMFWMvsQm4aCgmvBnTB7U5MNhMbVw4GsOBA86k7b vbF7GI7y1jF037szNalSH2+RKI87Qmt8YHjqSQcZf/pZ1FWeUFAI5LHcFCmwiiIh +hssiwV9UwhDXQvM+TvpeiVT+bjizVCJQ0mvLpNf/XGCjmxN6sq4V+1wqGScXCn9 VOob+cnrRwACAAA= EOF ) | openssl base64 -d | gzip -d > plop.txt
Base64 sans line return : \ Utilisez '-A' Exemple
cat plop.sh |openssl base64 |tr -d '\n' |openssl base64 -A -d
Alternatives
Base45 :
Utiliser Git pour vos logos en SVG
Voir http://w.xuv.be/projects/design_with_git
Faire du diffing graphique (oui ! pas en texte) avec Git sur des images vectorielle en SVG
compare.py
#!/usr/bin/env python import sys, os inkscape = "inkscape" local = sys.argv[1] remote = sys.argv[2] tempdir = "/home/markv/gittemp/" localpng = tempdir+"local.png" remotepng = tempdir+"remote.png" if(not (remote.endswith(".svg") and (local != "/dev/null"))): os.system("xxdiff %s %s" % (local, remote)) else: os.system(inkscape+" "+local+" --export-png="+localpng+" -w600 -h900 -C -bffffff -y1.0") os.system(inkscape+" "+remote+" --export-png="+remotepng+" -w600 -h900 -C -bffffff -y1.0") os.system("compare "+localpng+" "+remotepng+" - | display") os.remove(localpng) os.remove(remotepng)
Ajoutez dans votre .gitconfig (adapter le chemin)
~/.gitconfig
[difftool "compare"] cmd = "/home/USER/bin/compare.py $LOCAL $REMOTE - | display"
Puis par exemple
git difftool -y -t compare
Note commande unzip zip
unzip
$ unzip -l plop.zip
Archive: plop.zip
Length Date Time Name
--------- ---------- ----- ----
39 2015-01-22 17:27 mimetype
273 2015-01-22 17:27 layout-cache
921513 2015-01-22 17:27 ObjectReplacements/Obj101
921513 2015-01-22 17:27 ObjectReplacements/Obj100
10265 2015-01-22 17:27 ObjectReplacements/Object 1
1655 2015-01-22 17:27 meta.xml
233249 2015-01-22 17:27 content.xml
931840 2015-01-22 17:27 Obj100
135587 2015-01-22 17:27 styles.xml
899 2015-01-22 17:27 manifest.rdf
10111 2015-01-22 17:27 settings.xml
0 2015-01-22 17:27 Configurations2/toolpanel/
0 2015-01-22 17:27 Configurations2/statusbar/
0 2015-01-22 17:27 Configurations2/popupmenu/
0 2015-01-22 17:27 Configurations2/images/Bitmaps/
0 2015-01-22 17:27 Configurations2/toolbar/
0 2015-01-22 17:27 Configurations2/progressbar/
0 2015-01-22 17:27 Configurations2/floater/
0 2015-01-22 17:27 Configurations2/accelerator/current.xml
0 2015-01-22 17:27 Configurations2/menubar/
931840 2015-01-22 17:27 Obj101
3765 2015-01-22 17:27 Thumbnails/thumbnail.png
0 2015-01-22 17:27 Object 1/Configurations2/menubar/
0 2015-01-22 17:27 Object 1/Configurations2/statusbar/
0 2015-01-22 17:27 Object 1/Configurations2/toolbar/
0 2015-01-22 17:27 Object 1/Configurations2/progressbar/
0 2015-01-22 17:27 Object 1/Configurations2/images/Bitmaps/
0 2015-01-22 17:27 Object 1/Configurations2/popupmenu/
0 2015-01-22 17:27 Object 1/Configurations2/accelerator/current.xml
0 2015-01-22 17:27 Object 1/Configurations2/floater/
0 2015-01-22 17:27 Object 1/Configurations2/toolpanel/
3711 2015-01-22 17:27 Object 1/settings.xml
10400 2015-01-22 17:27 Object 1/content.xml
7579 2015-01-22 17:27 Object 1/styles.xml
2455 2015-01-22 17:27 META-INF/manifest.xml
--------- -------
4126694 35 files
$ unzip -Z1 plop.zip mimetype layout-cache ObjectReplacements/Obj101 ObjectReplacements/Obj100 ObjectReplacements/Object 1 meta.xml content.xml Obj100 styles.xml manifest.rdf settings.xml Configurations2/toolpanel/ Configurations2/statusbar/ Configurations2/popupmenu/ Configurations2/images/Bitmaps/ Configurations2/toolbar/ Configurations2/progressbar/ Configurations2/floater/ Configurations2/accelerator/current.xml Configurations2/menubar/ Obj101 Thumbnails/thumbnail.png Object 1/Configurations2/menubar/ Object 1/Configurations2/statusbar/ Object 1/Configurations2/toolbar/ Object 1/Configurations2/progressbar/ Object 1/Configurations2/images/Bitmaps/ Object 1/Configurations2/popupmenu/ Object 1/Configurations2/accelerator/current.xml Object 1/Configurations2/floater/ Object 1/Configurations2/toolpanel/ Object 1/settings.xml Object 1/content.xml Object 1/styles.xml META-INF/manifest.xml
Vérifier l'intégrité
unzip -t plop.zip unzip -qt plop.zip
Décompression
unzip plop.zip
zip
Créer une archive / compresser un dossier
zip -r plop.zip dir1/ dir2/
Comparaison /diff
zipcmp file1.zip file2.zip
pkgdiff -hide-unchanged file1.zip file2.zip
