From ae83dbaf803a03cbe679d99763affbd47467c73e Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sat, 30 Jul 2022 17:16:35 +0200 Subject: [PATCH] make compliant with mistune update --- makesite.py | 22 ++++++------- poetry.lock | 32 ++++++------------- ...2009-12-02-sfr-3g-et-ubuntu-9-10-karmic.md | 4 +-- .../2010-12-12-video-pour-psp-avec-ffmpeg.md | 2 +- ...-12-25-probleme-de-resolution-avec-xorg.md | 4 +-- .../2012-01-08-installation-de-jenkins-ci.md | 6 ++-- ...-03-surveiller-sa-ligne-adsl-avec-munin.md | 4 +-- ...projet-de-developpement-avec-jenkins-ci.md | 2 +- ...25-compilation-de-tuxboot-sur-fedora-17.md | 2 +- ...-12-04-installer-sabnzbd-derriere-nginx.md | 8 ++--- ...0-haute-dispo-corosync-pacemaker-debian.md | 4 +-- posts/2013/2013-12-02-sysadmin-2.md | 2 +- posts/2014/2014-01-02-horde-debian.md | 6 ++-- posts/2014/2014-01-22-qmail.md | 2 +- posts/2014/2014-04-15-redis-ha.md | 2 +- posts/2014/2014-05-25-supervisor.md | 4 +-- posts/2014/2014-08-12-qemu-raspbian.md | 6 ++-- posts/2015/2015-04-30-back-to-roots-bash.md | 12 +++---- posts/2015/2015-06-09-srmail.md | 4 +-- .../2015-06-21-deploiement-et-sauvegarde.md | 4 +-- .../2015/2015-08-10-fail2ban-configuration.md | 2 +- posts/2015/2015-09-03-xfce-double-ecran.md | 4 +-- posts/2015/2015-09-14-owncloud-reminder.md | 4 +-- ...15-12-12-retour-experience-ubuntu-touch.md | 4 +-- posts/2015/2015-12-21-advanced-virtualbox.md | 2 +- .../2017/2017-07-24-golang-a-la-rescousse.md | 2 +- .../2017/2017-10-14-attrapons-les-vilains.md | 2 +- .../2017/2017-11-17-un-blog-plus-statique.md | 10 ++---- posts/2018/2018-01-27-notes-rabbitmq.md | 4 +-- posts/2018/2018-11-03-il-court-furet.md | 2 +- 30 files changed, 74 insertions(+), 94 deletions(-) diff --git a/makesite.py b/makesite.py index bd2ceaa..237654c 100755 --- a/makesite.py +++ b/makesite.py @@ -40,11 +40,11 @@ import unicodedata from email import utils from pathlib import Path -import mistune import requests +import mistune from pygments import highlight -from pygments.formatters import html from pygments.lexers import get_lexer_by_name +from pygments.formatters import html # set user locale locale.setlocale(locale.LC_ALL, "") @@ -52,19 +52,15 @@ locale.setlocale(locale.LC_ALL, "") # initialize markdown - -class HighlightRenderer(mistune.Renderer): - options = {"escape": False, "hard_wrap": True} - +class HighlightRenderer(mistune.HTMLRenderer): def block_code(self, code, lang=None): - if not lang: - return "\n
%s
\n" % mistune.escape(code) - lexer = get_lexer_by_name(lang, stripall=True) - formatter = html.HtmlFormatter() - return highlight(code, lexer, formatter) - + if lang: + lexer = get_lexer_by_name(lang, stripall=True) + formatter = html.HtmlFormatter() + return highlight(code, lexer, formatter) + return '
' + mistune.escape(code) + '
' -markdown = mistune.Markdown(renderer=HighlightRenderer()) +markdown = mistune.create_markdown(renderer=HighlightRenderer()) def fread(filename): diff --git a/poetry.lock b/poetry.lock index 6213965..c76cc92 100644 --- a/poetry.lock +++ b/poetry.lock @@ -27,7 +27,7 @@ python-versions = ">=3.5" [[package]] name = "mistune" -version = "2.0.3" +version = "2.0.4" description = "A sane Markdown parser with useful plugins and renderers" category = "main" optional = false @@ -61,7 +61,7 @@ use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "urllib3" -version = "1.26.10" +version = "1.26.11" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false @@ -78,31 +78,19 @@ python-versions = "^3.8" content-hash = "16357752f231675078b90f65812ed06814c93bbf28d5e2066a912c83e2566fb1" [metadata.files] -certifi = [ - {file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"}, - {file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"}, -] -charset-normalizer = [ - {file = "charset-normalizer-2.1.0.tar.gz", hash = "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"}, - {file = "charset_normalizer-2.1.0-py3-none-any.whl", hash = "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5"}, -] +certifi = [] +charset-normalizer = [] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] mistune = [ - {file = "mistune-2.0.3-py2.py3-none-any.whl", hash = "sha256:e3964140c0775535fba50bd616fe180920044a64bc21850253267b07bff89924"}, - {file = "mistune-2.0.3.tar.gz", hash = "sha256:d7605b46b6156b53b7d52a465202b29a6f00f4ea4130ad5d25e9d5547d6b7e50"}, -] -pygments = [ - {file = "Pygments-2.12.0-py3-none-any.whl", hash = "sha256:dc9c10fb40944260f6ed4c688ece0cd2048414940f1cea51b8b226318411c519"}, - {file = "Pygments-2.12.0.tar.gz", hash = "sha256:5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb"}, -] -requests = [ - {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, - {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, + {file = "mistune-2.0.4-py2.py3-none-any.whl", hash = "sha256:182cc5ee6f8ed1b807de6b7bb50155df7b66495412836b9a74c8fbdfc75fe36d"}, + {file = "mistune-2.0.4.tar.gz", hash = "sha256:9ee0a66053e2267aba772c71e06891fa8f1af6d4b01d5e84e267b4570d4d9808"}, ] +pygments = [] +requests = [] urllib3 = [ - {file = "urllib3-1.26.10-py2.py3-none-any.whl", hash = "sha256:8298d6d56d39be0e3bc13c1c97d133f9b45d797169a0e11cdd0e0489d786f7ec"}, - {file = "urllib3-1.26.10.tar.gz", hash = "sha256:879ba4d1e89654d9769ce13121e0f94310ea32e8d2f8cf587b77c08bbcdb30d6"}, + {file = "urllib3-1.26.11-py2.py3-none-any.whl", hash = "sha256:c33ccba33c819596124764c23a97d25f32b28433ba0dedeb77d873a38722c9bc"}, + {file = "urllib3-1.26.11.tar.gz", hash = "sha256:ea6e8fb210b19d950fab93b60c9009226c63a28808bc8386e05301e25883ac0a"}, ] diff --git a/posts/2009/2009-12-02-sfr-3g-et-ubuntu-9-10-karmic.md b/posts/2009/2009-12-02-sfr-3g-et-ubuntu-9-10-karmic.md index 094b5f5..10033d6 100755 --- a/posts/2009/2009-12-02-sfr-3g-et-ubuntu-9-10-karmic.md +++ b/posts/2009/2009-12-02-sfr-3g-et-ubuntu-9-10-karmic.md @@ -10,7 +10,7 @@ des versions précédentes ou d'autres distrib les bonnes étapes pour Karmic. D'abord il faut installer le paquet usb-modeswitch fourni dans les dépôts standards (version actuelle 1.0.2-1) : -``` shell +```shell sudo apt-get install usb-modeswitch ``` @@ -19,7 +19,7 @@ périphérique de stockage et non pas comme un périphérique de communication. C'est là  que la usb-modeswitch intervient... Cette commande doit être lancée à chaque branchement de la clef : -``` shell +```shell sudo usb_modeswitch --default-vendor 0x19d2 --default-product 0x2000 --target-vendor 0X19d2 --target-product 0x0052 -s 8 --message-endpoint 0x01 --message-content 55534243123456782000000080000c85010101180101010101000000000000 diff --git a/posts/2010/2010-12-12-video-pour-psp-avec-ffmpeg.md b/posts/2010/2010-12-12-video-pour-psp-avec-ffmpeg.md index 63ddd54..38d87da 100755 --- a/posts/2010/2010-12-12-video-pour-psp-avec-ffmpeg.md +++ b/posts/2010/2010-12-12-video-pour-psp-avec-ffmpeg.md @@ -20,7 +20,7 @@ fr.org/ffmpeg) pour ffmpeg apporte l'essentiel de la solution à part une coquille sur un paramètre et le nom des librairies h264 qu'il faut adapter. La commande ultime est donc : -``` shell +```shell ffmpeg -i [input_file] -r 29.97 -vcodec libx264 -s 640x480 -aspect 16:9 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 768k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 diff --git a/posts/2010/2010-12-25-probleme-de-resolution-avec-xorg.md b/posts/2010/2010-12-25-probleme-de-resolution-avec-xorg.md index 23b8cc3..78d4c51 100755 --- a/posts/2010/2010-12-25-probleme-de-resolution-avec-xorg.md +++ b/posts/2010/2010-12-25-probleme-de-resolution-avec-xorg.md @@ -8,7 +8,7 @@ rajouter le mode dynamiquement. J'ai privilégié la seconde option. La commande gtf permet de calculer les bons paramètres en fonction d'une résolution et d'un taux de rafraîchissement : -``` shell +```shell $ gtf 1280 800 60 # 1280x800 @ 60.00 Hz (GTF) hsync: 49.68 kHz; pclk: 83.46 MHz Modeline "1280x800_60.00"  83.46  1280 1344 1480 1680  800 801 804 828  -HSync +Vsync @@ -17,7 +17,7 @@ Modeline "1280x800_60.00"  83.46  1280 1344 1480 1680  800 801 804 828  -HSy Le résultat peut être passé à la commande xrandr pour ajouter le mode dynamiquement. Voici le script complet à exécuter au démarrage : -``` shell +```shell xrandr --newmode "1280x800_60.00"  83.46  1280 1344 1480 1680  800 801 804 828  -HSync +Vsync xrandr --addmode LVDS1 "1280x800_60.00" xrandr --output LVDS1 --mode "1280x800_60.00" diff --git a/posts/2012/2012-01-08-installation-de-jenkins-ci.md b/posts/2012/2012-01-08-installation-de-jenkins-ci.md index 7d3ffef..6ce9905 100755 --- a/posts/2012/2012-01-08-installation-de-jenkins-ci.md +++ b/posts/2012/2012-01-08-installation-de-jenkins-ci.md @@ -20,13 +20,13 @@ CI](http://jenkins-ci.org/) dans le conteneur de Servlet [Tomcat](http://tomcat.apache.org/) sous Ubuntu Server 10.4. D'abord on installe Tomcat 6 avec le système de paquets : -``` shell +```shell sudo apt-get install tomcat6 ``` Ensuite on installe manuellement le WAR de Jenkins CI : -``` shell +```shell # move to tomcat webapps dir cd /var/lib/tomcat6/webapps sudo wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war @@ -35,7 +35,7 @@ sudo wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war Si Tomcat était lancé, Jenkins va être déployé et disponible en quelques secondes. Sinon démarrez Tomcat : -``` shell +```shell sudo /etc/init.d/tomcat6 start ``` diff --git a/posts/2012/2012-03-03-surveiller-sa-ligne-adsl-avec-munin.md b/posts/2012/2012-03-03-surveiller-sa-ligne-adsl-avec-munin.md index 65a2ba6..3c96e4d 100755 --- a/posts/2012/2012-03-03-surveiller-sa-ligne-adsl-avec-munin.md +++ b/posts/2012/2012-03-03-surveiller-sa-ligne-adsl-avec-munin.md @@ -44,7 +44,7 @@ qui appelle le script PERL de teebeenator et qui sauve les donnée dans un fichier texte. Cette collecte est réalisée toutes les 5 minutes grâce à CRON. -``` shell +```shell perl livebox.pl --user=admin --pass= -page=infosys_main -v 2>/dev/null | html2text >/adsl_stats.txt ``` @@ -68,7 +68,7 @@ unités, le libellé de chaque variable graphée Voici shell script du plugin adsl_download qui collecte la valeur de la bande passante descendante : -``` shell +```shell if [ $# = 1 ]; then echo "graph_title Bandwidth - Download" echo "graph_category ADSL" diff --git a/posts/2012/2012-03-25-gerer-un-projet-de-developpement-avec-jenkins-ci.md b/posts/2012/2012-03-25-gerer-un-projet-de-developpement-avec-jenkins-ci.md index 57c72b6..5f21072 100755 --- a/posts/2012/2012-03-25-gerer-un-projet-de-developpement-avec-jenkins-ci.md +++ b/posts/2012/2012-03-25-gerer-un-projet-de-developpement-avec-jenkins-ci.md @@ -21,7 +21,7 @@ le développement d'un logiciel écrit en Java qui utilise le système de build [Apache Maven](http://fr.wikipedia.org/wiki/Apache_Maven) pour construire le projet. D'abord il faut installer Maven -``` shell +```shell $ apt-get install maven2 ``` diff --git a/posts/2012/2012-09-25-compilation-de-tuxboot-sur-fedora-17.md b/posts/2012/2012-09-25-compilation-de-tuxboot-sur-fedora-17.md index abae367..45608fa 100755 --- a/posts/2012/2012-09-25-compilation-de-tuxboot-sur-fedora-17.md +++ b/posts/2012/2012-09-25-compilation-de-tuxboot-sur-fedora-17.md @@ -21,7 +21,7 @@ exécutables pour Fedora Voici le source du fichier INSTALL -``` shell +```shell cp tuxboot.pro tuxboot-pro.bak sed -i '/^RESOURCES/d' tuxboot.pro lupdate-qt4 tuxboot.pro diff --git a/posts/2012/2012-12-04-installer-sabnzbd-derriere-nginx.md b/posts/2012/2012-12-04-installer-sabnzbd-derriere-nginx.md index e654f8b..2b8020a 100755 --- a/posts/2012/2012-12-04-installer-sabnzbd-derriere-nginx.md +++ b/posts/2012/2012-12-04-installer-sabnzbd-derriere-nginx.md @@ -16,7 +16,7 @@ télécharger les sources Python. Les manipulations suivantes sont réalisées sur une Debian 6 avec Python, Nginx et OpenSSH installés. -``` shell +```shell # on installe sous /srv cd /srv wget http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/0.7.6/ @@ -32,7 +32,7 @@ générale et **aussi restreindre l'adresse d'écoute** à l'interface localhost allons mettre en place par la suite. On peut automatiser le démarrage en rajoutant un script sabnzbd sous /etc/init.d tel que celui-ci : -``` shell +```shell ### BEGIN INIT INFO # Provides: sabnzd # Required-Start: $local_fs $remote_fs @@ -80,7 +80,7 @@ On active ce script sous Debian avec update-rc.d sabnzbd defaults. Finalement on configure Nginx comme proxy. Je me suis borné à un accès HTTP protégé par une authentification utilisateur / mot de passe mais HTTPS est recommandé. -``` nginx +```nginx server { listen 80; server_name www.yourserver.yourdomain; @@ -107,7 +107,7 @@ Nginx. A ce stade SABnzbd fonctionne à moitié :-) En effet SABnzbd ne va pas servir toutes les ressources (HTML / CSS) et il faut les lier statiquement à Nginx. -``` shell +```shell # on lie les ressources statiques du thème Plush mkdir -p /var/www/www/sabnzbd ln -s /srv/sabnzbd/interfaces/Plush/templates/static /var/www/www/sabnzbd/static diff --git a/posts/2013/2013-03-20-haute-dispo-corosync-pacemaker-debian.md b/posts/2013/2013-03-20-haute-dispo-corosync-pacemaker-debian.md index a7c824e..aa3bc3d 100755 --- a/posts/2013/2013-03-20-haute-dispo-corosync-pacemaker-debian.md +++ b/posts/2013/2013-03-20-haute-dispo-corosync-pacemaker-debian.md @@ -78,7 +78,7 @@ leur fonctionnement en groupe. Pour cela, on doit générer une clef d'authenfic les noeuds du cluster. L'utilitaire **corosync-keygen** permet de générer cette clef à partir d'entrées clavier pseudo-aléatoires qu'il faut ensuite sécuriser et copier sur les autres noeuds. -``` shell +```shell # génération de la clef depuis vm-node1 corosync-keygen mv authkey /etc/corosync/authkey @@ -217,7 +217,7 @@ Vous remarquerez qu'on va plus loin que la définition d'une ressource Apache. L Pacemaker d'utiliser la page de statut d'Apache pour décider d'une bascule. Il ne faut donc pas oublier de configurer cette URL dans Apache pour que cela fonctionne : -``` apache +```apache SetHandler server-status Order deny,allow diff --git a/posts/2013/2013-12-02-sysadmin-2.md b/posts/2013/2013-12-02-sysadmin-2.md index 4ad3fcb..fd3fc38 100755 --- a/posts/2013/2013-12-02-sysadmin-2.md +++ b/posts/2013/2013-12-02-sysadmin-2.md @@ -31,7 +31,7 @@ avoir une trace des fichiers synchronisés. J'ai dégoté le programme [blat](ht pour l'envoi d'email facile depuis un batch, il y en a sûrement plein d'autres. Voici un script batch assez proche de celui que j'utilise : -``` bat +```bat REM ================================================================ REM Synchroniser les changements REM ================================================================ diff --git a/posts/2014/2014-01-02-horde-debian.md b/posts/2014/2014-01-02-horde-debian.md index d41095b..a65ad21 100755 --- a/posts/2014/2014-01-02-horde-debian.md +++ b/posts/2014/2014-01-02-horde-debian.md @@ -54,7 +54,7 @@ L'installation de PEAR sur Debian est galette. Puis, on enregistre le canal Horde sur Pear et on installe les composants nécessaires : -``` shell +```shell mkdir -p /var/www/horde cd /var/www/horde pear channel-discover pear.horde.org @@ -74,7 +74,7 @@ Dans le cas de NginX sur Debian, il faut ajuster les permissions du répertoire. Et il faut créer les fichiers de configuration de chaque application à partir des modèles fournis : -``` shell +```shell cd /var/www/horde/config for f in *.dist; do cp $f `basename $f .dist`; done cd /var/www/horde/kronolith/config @@ -90,7 +90,7 @@ for f in *.dist; do cp $f `basename $f .dist`; done Il reste à configurer NginX. Je force l'utilisation de HTTPS en redirigeant les requêtes HTTP vers la version sécurisée du site. -``` nginx +```nginx server { listen 80; server_name groupware.exemple.fr; diff --git a/posts/2014/2014-01-22-qmail.md b/posts/2014/2014-01-22-qmail.md index 677f702..bd6ad6d 100755 --- a/posts/2014/2014-01-22-qmail.md +++ b/posts/2014/2014-01-22-qmail.md @@ -34,7 +34,7 @@ Il faut remplacer *0* par *127.0.0.1* dans le fichier Voici la version modifiée : -``` shell +```shell QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` MAXSMTPD=`cat /var/lib/qmail/control/concurrencyincoming` diff --git a/posts/2014/2014-04-15-redis-ha.md b/posts/2014/2014-04-15-redis-ha.md index aeb2a4f..c1b210b 100755 --- a/posts/2014/2014-04-15-redis-ha.md +++ b/posts/2014/2014-04-15-redis-ha.md @@ -152,7 +152,7 @@ nouveau s'adresser aux sentinelles pour récupérer l'adresse du Redis maître. Voici un exemple typique de code en Python : -``` python +```python from redis.sentinel import Sentinel sentinel = Sentinel( [('192.168.0.51', 26379), ('192.168.0.52', 6379)], socket_timeout=0.1) diff --git a/posts/2014/2014-05-25-supervisor.md b/posts/2014/2014-05-25-supervisor.md index a4cda66..d103870 100755 --- a/posts/2014/2014-05-25-supervisor.md +++ b/posts/2014/2014-05-25-supervisor.md @@ -28,7 +28,7 @@ l'arrêt fiable du processus en manipulant son PID. Voici un exemple de script d'init à la sauce Debian pour un programme JAVA : -``` shell +```shell ### BEGIN INIT INFO # Provides: monprog # Required-Start: $local_fs $remote_fs $network $syslog @@ -185,7 +185,7 @@ Dans cet exemple, on envoie un signal SIGINT à monprog pour lui demander un arr #### Interception d'un signal SIGINT en JAVA -``` java +```java // register a shutdown hook Runtime.getRuntime().addShutdownHook(new Thread() { @Override diff --git a/posts/2014/2014-08-12-qemu-raspbian.md b/posts/2014/2014-08-12-qemu-raspbian.md index ff49d64..a8af43f 100755 --- a/posts/2014/2014-08-12-qemu-raspbian.md +++ b/posts/2014/2014-08-12-qemu-raspbian.md @@ -17,7 +17,7 @@ En pré-requis, on suppose que Qemu est installé sur le système hôte. On vérifie que le processeur ARM du Raspberry est supporté par Qemu avec la commande suivante : -``` shell +```shell $ qemu-system-arm -cpu ? ``` @@ -34,7 +34,7 @@ La modification d'un fichier est nécessaire pour que la distribution fonctionne avec Qemu. On effectue donc un premier démarrage particulier avec BASH en processus INIT pour la réaliser. -``` shell +```shell $ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda 2014-06-20-wheezy-raspbian.img ``` @@ -66,7 +66,7 @@ D'abord on élargit le disque avec l'utilitaire qemu-resize. Ensuite on démarre la Raspbian avec Qemu -``` shell +```shell $ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda 2014-06-20-wheezy-raspbian.img ``` diff --git a/posts/2015/2015-04-30-back-to-roots-bash.md b/posts/2015/2015-04-30-back-to-roots-bash.md index bf1e6a4..a6292ad 100755 --- a/posts/2015/2015-04-30-back-to-roots-bash.md +++ b/posts/2015/2015-04-30-back-to-roots-bash.md @@ -37,7 +37,7 @@ codes](https://wiki.archlinux.org/index.php/Color_Bash_Prompt). Il ne faut pas oublier de réinitialiser la couleur en fin de prompt pour que ça ne coule pas sur le reste de la ligne avec un reset. je suis adepte des prompts concis : -``` shell +```shell White='\e[0;37m' # White Red='\e[0;31m' # Red Reset=$(tput sgr0) @@ -55,7 +55,7 @@ est un parfait exemple facile à configurer. les alias sont des substitutions de commandes. On peut les utiliser pour éviter de mémoriser des paramètres compliquées en définissant de nouvelles commandes : -``` shell +```shell alias la='ll -A' # 'la' : voir les fichiers cachés alias lk='ls -lSr' # 'lk' : trier par taille ``` @@ -63,7 +63,7 @@ alias lk='ls -lSr' # 'lk' : trier par taille Ou bien on peut redéfinir le comportement d'une commande en créant un alias du même nom forçant des paramètres : -``` shell +```shell # forcer une demande de confirmation pour éviter les boulettes alias rm='rm --interactive --verbose' alias mv='mv --interactive --verbose' @@ -77,7 +77,7 @@ exécutables accessibles dans le PATH (/usr/local/bin au hasard). Voici les deux fonctions que j'utilise assez régulièrement : -``` shell +```shell function bak() { cp "$1" "$1_`date +%Y-%m-%d_%H-%M-%S`" ; } function extract() # Handy Extract Program @@ -111,7 +111,7 @@ bashrc testent si dircolors est présent et l'utilise en rajoutant --color à ls par le biais d'un... alias (bravo à ceux qui n'ont pas lâché). Généralement, on a une section de ce genre dans notre .bashrc : -``` shell +```shell # enable color support of ls if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" @@ -204,7 +204,7 @@ pour l'affichage des répertoire mais en style non gras, je mets par contre en gras les répertoire ouverts à tous les vents (avec les droits d'écriture sur le groupe *other*), et en rouge non gras les fichiers exécutables. -``` shell +```shell export LS_COLORS="di=00;34:ow=01;34:ex=00;31" ``` diff --git a/posts/2015/2015-06-09-srmail.md b/posts/2015/2015-06-09-srmail.md index c6787af..bb20c1d 100755 --- a/posts/2015/2015-06-09-srmail.md +++ b/posts/2015/2015-06-09-srmail.md @@ -21,7 +21,7 @@ Python dans un *virtualenv* de préférence, avec le gestionnaire de paquets Voici un exemple d'envoi d'e-mail en Python : -``` python +```python import requests headers = {'Content-Type': 'application/json; charset=utf-8'} msg = { @@ -38,7 +38,7 @@ else: Et voici le même exemple en ligne de commande avec CURL : -``` shell +```shell curl -X POST -H "Content-Type: application/json; charset=utf-8" -d '{"to":"bill@phoenix.com", "subject":"Got it", "content":"See you soon!\n\n-- John"}' diff --git a/posts/2015/2015-06-21-deploiement-et-sauvegarde.md b/posts/2015/2015-06-21-deploiement-et-sauvegarde.md index aed3a2b..8f33d93 100755 --- a/posts/2015/2015-06-21-deploiement-et-sauvegarde.md +++ b/posts/2015/2015-06-21-deploiement-et-sauvegarde.md @@ -93,7 +93,7 @@ déroulée. Voici donc les grandes lignes de la partie **récupération des données** : -``` shell +```shell # Les fichiers de configuration de NginX cp -r /etc/nginx/* $TARGET_DIR/nginx/. @@ -119,7 +119,7 @@ synchronisée par Owncloud car on l'a copié en douce. Il faut forcer Owncloud rescanner son répertoire avec la commande suivante exécutée en tant qu'utilisateur *www-data*: -``` shell +```shell su -c "/usr/bin/php /var/www/owncloud/console.php files:scan all" \ -s /bin/sh www-data ``` diff --git a/posts/2015/2015-08-10-fail2ban-configuration.md b/posts/2015/2015-08-10-fail2ban-configuration.md index 35147a5..df1ab3f 100755 --- a/posts/2015/2015-08-10-fail2ban-configuration.md +++ b/posts/2015/2015-08-10-fail2ban-configuration.md @@ -157,7 +157,7 @@ le fichier */etc/fail2ban/action.d/sendmail-cron.conf* complet : Dans mon cas, la tâche CRON est journalière : -``` shell +```shell # fail2ban report @daily touch /var/run/fail2ban/mail.flag ``` diff --git a/posts/2015/2015-09-03-xfce-double-ecran.md b/posts/2015/2015-09-03-xfce-double-ecran.md index 9f96bb5..77916cd 100755 --- a/posts/2015/2015-09-03-xfce-double-ecran.md +++ b/posts/2015/2015-09-03-xfce-double-ecran.md @@ -40,7 +40,7 @@ ajoute la directive *display-setup-script* dans la section SeatDefaults : et voici le script **lightdm-monitor.sh** : -``` shell +```shell if (xrandr | grep "VGA1 disconnected"); then xrandr --output HDMI1 --off --output LVDS1 --mode 1366x768 --pos 0x0 \ --rotate normal --output DP1 --off --output VGA1 --off @@ -63,7 +63,7 @@ programme en ligne de commande de configurationde XFCE) adéquate. Finalement, cela donne le script **xfce-monitor.sh** au démarrage de la session: -``` shell +```shell sleep 3 if (xrandr | grep "VGA1 disconnected"); then xrandr --output HDMI1 --off --output LVDS1 --mode 1366x768 --pos 0x0 \ diff --git a/posts/2015/2015-09-14-owncloud-reminder.md b/posts/2015/2015-09-14-owncloud-reminder.md index f8f8f94..3455582 100755 --- a/posts/2015/2015-09-14-owncloud-reminder.md +++ b/posts/2015/2015-09-14-owncloud-reminder.md @@ -110,7 +110,7 @@ jour et envoie un e-mail par évènement avec le fichier ICS en pièce jointe. L'envoi est réalisé par l'utilitaire **mpack**. Le résultat final espéré pour notre exemple est ce script : -``` shell +```shell # STARTDATE="`date -d '2015-09-14 10:30:00-000' '+%a %e %b %R'`" SUMMARY="Déjeuner avec M." @@ -167,7 +167,7 @@ régulière. Voci le script awk complet : -``` awk +```awk BEGIN { FS="\n" OFS="" diff --git a/posts/2015/2015-12-12-retour-experience-ubuntu-touch.md b/posts/2015/2015-12-12-retour-experience-ubuntu-touch.md index 5511702..79039e1 100755 --- a/posts/2015/2015-12-12-retour-experience-ubuntu-touch.md +++ b/posts/2015/2015-12-12-retour-experience-ubuntu-touch.md @@ -131,7 +131,7 @@ s'inspirant de [cette discussion](http://askubuntu.com/questions/360466/ubuntu-touch-officially-launched-version-how-to-sync-contacts) sur AskUbuntu. D'abord on configure syncevolution : -``` shell +```shell # les valeurs username, password et syncurl doivent être adaptées syncevolution --keyring=no --configure --template webdav username=yax password=??? syncurl="mycloud.madyanne.fr" target-config@owncloud syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@owncloud username= password= peerIsClient=1 owncloud @@ -163,7 +163,7 @@ valeurs dans le shell script qu'on va lancer en CRON, merci [Alexandre](http://askubuntu.com/questions/611761/syncevolution-in-cronjob-to-sync-the-ubuntu-phone-via-caldav-arddav). Donc finalement c'est ce script qu'on va mettre sous CRON : -``` shell +```shell export DISPLAY=:0.0 export DBUS_SESSION_BUS_ADDRESS=$(ps -u phablet e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) syncevolution owncloud contacts diff --git a/posts/2015/2015-12-21-advanced-virtualbox.md b/posts/2015/2015-12-21-advanced-virtualbox.md index fc337f0..9675e38 100755 --- a/posts/2015/2015-12-21-advanced-virtualbox.md +++ b/posts/2015/2015-12-21-advanced-virtualbox.md @@ -64,7 +64,7 @@ port 80 alors qu'on l'attaque sur le port 8080. Un moyen de contourner ce problème si l'application n'est pas configurable, consiste à installer un NginX sur la machine hôte pour faire office de proxy. -``` nginx +```nginx # Proxy upstream vbox-vm { diff --git a/posts/2017/2017-07-24-golang-a-la-rescousse.md b/posts/2017/2017-07-24-golang-a-la-rescousse.md index af55ec0..4bf7620 100755 --- a/posts/2017/2017-07-24-golang-a-la-rescousse.md +++ b/posts/2017/2017-07-24-golang-a-la-rescousse.md @@ -71,7 +71,7 @@ Golang pour gérer la concurrence de traitement. Pour les fans de code, voici celui du serveur HTTP avec cache : -``` go +```go package main import ( diff --git a/posts/2017/2017-10-14-attrapons-les-vilains.md b/posts/2017/2017-10-14-attrapons-les-vilains.md index 322dc3c..1169962 100755 --- a/posts/2017/2017-10-14-attrapons-les-vilains.md +++ b/posts/2017/2017-10-14-attrapons-les-vilains.md @@ -73,7 +73,7 @@ jette dans le puits, où il resteront... jusqu'au prochain redémarrage du serve Voici le script en Korn Shell : -``` shell +```shell #!/bin/ksh if [ $# != 1 ]; then diff --git a/posts/2017/2017-11-17-un-blog-plus-statique.md b/posts/2017/2017-11-17-un-blog-plus-statique.md index 5edf912..a12cd39 100755 --- a/posts/2017/2017-11-17-un-blog-plus-statique.md +++ b/posts/2017/2017-11-17-un-blog-plus-statique.md @@ -57,8 +57,7 @@ page. Voici le *template* Hugo des commentaires qui utilise la fonction **getJSON** pour récupérer les commentaires de la page en cours : -``` html -{% raw %} +```html
{{ $restParam := (printf "/comments?token=%v&url=%v" .Site.Params.widgets.stacosys_token .URL) }} {{ $resp := getJSON .Site.Params.widgets.stacosys_url $restParam }} @@ -79,14 +78,12 @@ de la page en cours : {{ .content | markdownify }}

{{ end }} -
-{% endraw %} + ``` et un exemple de données renvoyée par Stacosys : -``` json -{% raw %} +```json { "data": [ { @@ -103,7 +100,6 @@ et un exemple de données renvoyée par Stacosys : } ] } -{% endraw %} ``` Il reste une interaction entre le serveur HTTP et Stacosys pour poster des diff --git a/posts/2018/2018-01-27-notes-rabbitmq.md b/posts/2018/2018-01-27-notes-rabbitmq.md index a220cfc..8765f5f 100755 --- a/posts/2018/2018-01-27-notes-rabbitmq.md +++ b/posts/2018/2018-01-27-notes-rabbitmq.md @@ -99,7 +99,7 @@ A ce niveau, on peut essayer de faire communiquer deux applications à travers R Code du producteur : -``` python +```python #!/usr/bin/env python import pika import sys @@ -122,7 +122,7 @@ connection.close() Code du consommateur : -``` python +```python #!/usr/bin/env python import pika import sys diff --git a/posts/2018/2018-11-03-il-court-furet.md b/posts/2018/2018-11-03-il-court-furet.md index bb2d18c..33da146 100755 --- a/posts/2018/2018-11-03-il-court-furet.md +++ b/posts/2018/2018-11-03-il-court-furet.md @@ -20,7 +20,7 @@ A ce stade, vous pensez : *"c'est bizarre il ne nous a pas encore bassiné avec La mise en prod a pris 15 minutes chrono : écriture d'un docker-compose en utilisant [mon image pour les applications Python](https://hub.docker.com/r/kianby/pythonapp/) et déploiement sur le serveur de containers. -``` docker +```docker popforward: image: kianby/pythonapp:latest environment: