Compare commits
13 Commits
e02b036875
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c8c413bd75 | |||
| 011cfcba40 | |||
| 259b9c6a24 | |||
| cd8cebe7cb | |||
| efb8d64ac7 | |||
| d78f93eed2 | |||
| 5b45dc0863 | |||
| e6fc2251ec | |||
| 6c514dbbef | |||
| bb890cba15 | |||
| 7d89fb0224 | |||
| 53aa196ac1 | |||
|
25789f522b
|
217
docs/Divers/1password-cli.md
Normal file
217
docs/Divers/1password-cli.md
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
# 1 Password-cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Login
|
||||||
|
eval $(op signin)
|
||||||
|
|
||||||
|
# Get favorites
|
||||||
|
op item list --vault "Private" --favorite
|
||||||
|
|
||||||
|
# Get a specific item
|
||||||
|
op item get <ID>
|
||||||
|
|
||||||
|
# !! Important: Sign out at the end
|
||||||
|
op signout
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
1login() {
|
||||||
|
eval $(op signin)
|
||||||
|
}
|
||||||
|
|
||||||
|
alias 1signout="op signout"
|
||||||
|
|
||||||
|
1search() {
|
||||||
|
term=$1
|
||||||
|
if [ -n "$2" ]
|
||||||
|
then
|
||||||
|
vault="$2"
|
||||||
|
else
|
||||||
|
vault="Private"
|
||||||
|
fi
|
||||||
|
echo "Searching for '$term' in vaut '$vault'"
|
||||||
|
op item list --vault "$vault" --long | grep "$term" --ignore-case
|
||||||
|
}
|
||||||
|
|
||||||
|
1get() {
|
||||||
|
op item get $*
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Se connecter à 1Password CLI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval $(op signin)
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des coffres:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op vault list
|
||||||
|
|
||||||
|
ID NAME
|
||||||
|
abcdefabcdefabcdefabcdefab Personal
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir tous les items d'un coffre:
|
||||||
|
|
||||||
|
```
|
||||||
|
op item list --vault "Personal"
|
||||||
|
|
||||||
|
ID TITLE VAULT EDITED
|
||||||
|
abcdefabcdefabcdefabcdefab Maxmind Geoip Personal 1 year ago
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Récupérer un mot-de-passe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item get "OVH - espace client" --fields label=password
|
||||||
|
[use 'op item get abcdefabcdefabcdefabcdefab --reveal' to reveal]
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item get "OVH - espace client" --fields label=password --format json | jq -r .value
|
||||||
|
|
||||||
|
PassW0rd
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir tous les champs d'un item:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item get "OVH - espace client"
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un nouvel item de connexion:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item create --category login \
|
||||||
|
--title "New Service" \
|
||||||
|
--vault "Personal" \
|
||||||
|
username="user@example.com" \
|
||||||
|
password="mysecret123" \
|
||||||
|
url="https://example.com"
|
||||||
|
```
|
||||||
|
|
||||||
|
Générer et stocker un nouveau mot-de-passe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item create --category password \
|
||||||
|
--title "Generated Password" \
|
||||||
|
--generate-password
|
||||||
|
|
||||||
|
ID: rwtorqqflnsrx6egzdgfmc3ssy
|
||||||
|
Title: Generated Password
|
||||||
|
Vault: Personal (abcdefabcdefabcdefabcdefab)
|
||||||
|
Created: now
|
||||||
|
Updated: now
|
||||||
|
Favorite: false
|
||||||
|
Version: 1
|
||||||
|
Category: PASSWORD
|
||||||
|
Fields:
|
||||||
|
password: [use 'op item get abcdefabcdefabcdefabcdefab --reveal' to reveal]
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer une note sécurisée:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item create --category "Secure Note" \
|
||||||
|
--title "Project Notes" \
|
||||||
|
--vault "Personal" \
|
||||||
|
'notesPlain[text]="Important project details..."'
|
||||||
|
|
||||||
|
ID: wy6lvv2pbs7v46x5pj5d7o2cnm
|
||||||
|
Title: Project Notes
|
||||||
|
Vault: Personal (abcdefabcdefabcdefabcdefab)
|
||||||
|
Created: now
|
||||||
|
Updated: now
|
||||||
|
Favorite: false
|
||||||
|
Version: 1
|
||||||
|
Category: SECURE_NOTE
|
||||||
|
Fields:
|
||||||
|
notesPlain: "Important project details..."
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Utilisation de secrets dans les variables environnement:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval $(op signin)
|
||||||
|
export DB_PASSWORD="$(op item get "Database" --fields label=password)"
|
||||||
|
export API_KEY="$(op item get "API Keys" --fields label=key)"
|
||||||
|
```
|
||||||
|
|
||||||
|
Lire une clé SSH:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
op item get "id_rsa" --fields label=private_key
|
||||||
|
[use 'op item get abcdefabcdefabcdefabcdefab --reveal' to reveal]
|
||||||
|
```
|
||||||
|
|
||||||
|
Utilisation avec une API:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get API token from 1Password and use in API call
|
||||||
|
export API_TOKEN="$(
|
||||||
|
op item get "Service API Key" --fields label=password \
|
||||||
|
--format json | jq -r .value)"
|
||||||
|
|
||||||
|
curl https://api.example.com/v1/endpoint \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"param1": "value1",
|
||||||
|
"param2": "value2"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Utiliser `op inject` pour les secrets:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# ~/.zshrc
|
||||||
|
op inject --in-file "${HOME}/.dotfiles/secrets.zsh" | while read -r line; do
|
||||||
|
eval "$line"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# ~/.dotfiles/secrets.zsh
|
||||||
|
export NOTION_API_KEY="op://private/notion.so/api-token"
|
||||||
|
export TEST_PYPI_TOKEN="op://private/test.pypi.org/token"
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir aussi https://samedwardes.com/blog/2023-11-28-1password-for-secret-dotfiles-update/
|
||||||
|
|
||||||
|
Autre méthode:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export NOTION_API_KEY=$(op read "op://private/notion.so/api-token)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://nandovieira.com/using-1password-cli-to-avoid-hardcoded-secrets-in-your-terminal-profile
|
||||||
|
|
||||||
|
https://blog.gruntwork.io/how-to-securely-store-secrets-in-1password-cli-and-load-them-into-your-zsh-shell-when-needed-dd7a716506c8
|
||||||
|
|
||||||
|
https://dev.to/hacksore/using-1password-cli-for-secrets-locally-326e
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login -u $(op read op://prod/docker/username) -p $(op read op://prod/docker/password)
|
||||||
|
```
|
||||||
|
|
||||||
51
docs/Divers/Adobe/Lightroom.md
Normal file
51
docs/Divers/Adobe/Lightroom.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Lightroom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Emplacements des fichiers dans macOS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Pictures/Lightroom/Airbook
|
||||||
|
drwxr-xr-x - bruno staff 25 déc 16:28 Backups/
|
||||||
|
.rw-r--r--@ 1,3Gi bruno staff 28 déc 09:03 'Lightroom Catalog-v13.lrcat'
|
||||||
|
drwx------@ - bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat-data'/
|
||||||
|
.rw-r--r-- 32Ki bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat-shm'
|
||||||
|
.rw-r--r-- 4,3Mi bruno staff 28 déc 09:03 'Lightroom Catalog-v13.lrcat-wal'
|
||||||
|
.rw-r--r-- 72 bruno staff 27 déc 20:13 'Lightroom Catalog-v13.lrcat.lock'
|
||||||
|
drwxr-xr-x - bruno staff 27 déc 20:13 'Lightroom Catalog-v13 Helper.lrdata'/
|
||||||
|
drwxr-xr-x - bruno staff 28 déc 09:03 'Lightroom Catalog-v13 Previews.lrdata'/
|
||||||
|
drwxr-xr-x - bruno staff 27 déc 20:13 'Lightroom Catalog-v13 Sync.lrdata'/
|
||||||
|
drwxr-xr-x - bruno staff 7 oct 2022 'Lightroom Settings'/
|
||||||
|
|
||||||
|
# du -ckh Lightroom\ Catalog-v13\ Helper.lrdata 71Mo
|
||||||
|
# du -ckh Lightroom\ Catalog-v13\ Sync.lrdata 5 Mo
|
||||||
|
# du -ckh Lightroom\ Catalog-v13\ Previews.lrdata 28 Go
|
||||||
|
# Lightroom Catalog-v13.lrcat-data 201 Mo
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| Fichiers | Emplacement |
|
||||||
|
| ---------------------------------------- | ------------------------------------------------------------ |
|
||||||
|
| **Application Lightroom Classic** | Applications/Adobe Lightroom Classic/Adobe Lightroom Classic.app |
|
||||||
|
| **Préférences Lightroom Classic** | Users/[nom d’utilisateur]/Library/Preferences/**com.adobe.LightroomClassicCC7.plist**<br />*Sous macOS, après avoir supprimé le fichier ci-dessus, redémarrez votre ordinateur, puis relancez Lightroom Classic tout en maintenant les touches **Maj** + **Option** enfoncées. Dans la boîte de dialogue, sélectionnez **Réinitialiser les préférences**.* |
|
||||||
|
| **Catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat** (2) |
|
||||||
|
| (dossier) | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-data/** (2)<br />*À partir de Lightroom Classic 11, Lightroom Classic stocke des informations supplémentaires dans un nouveau fichier portant l’extension **.lrcat-data,** avec le fichier de catalogue. Ce fichier se situe dans le même dossier que votre fichier de catalogue. Ce fichier contient des informations importantes sur vos photos et vos modifications et doit être inclus dans vos systèmes de sauvegarde éventuels.* |
|
||||||
|
| **Cache d’aperçu** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Previews.lrdata/**<br />*Quitter Lightroom avant d'effacer le dossier. Les aperçus seront recrées au besoin.* |
|
||||||
|
| **Cache des aperçus dynamiques** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Smart Previews.lrdata/** |
|
||||||
|
| **Cache des mots-clé, dossiers** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Helper.lrdata/**<br />*Accelère les performances de LR dans l'affichage des métadonnées.* |
|
||||||
|
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog Sync.lrdata/** |
|
||||||
|
| **Fichier de verrouillage de catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat.lock** (1)<br />*Remarque : Le fichier de verrouillage empêche le catalogue d’être remplacé en cours d’utilisation.* |
|
||||||
|
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-wal** (1) |
|
||||||
|
| | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-shm** (1) |
|
||||||
|
| **Fichier journal de catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Catalog.lrcat-journal**<br />*Les catalogues ouverts utilisent le fichier journal pour vérifier les enregistrements de base de données incomplets. Ne supprimez pas le fichier journal à moins que vous ne supprimiez également son catalogue associé.* |
|
||||||
|
| **Sauvegarde d’un catalogue** | /Users/[nom d’utilisateur]/Pictures/Lightroom/Backups/**[date et heure de sauvegarde]/Lightroom Catalog.lrcat** |
|
||||||
|
| **Lightroom Settings** | /Users/[nom d’utilisateur]/Pictures/Lightroom/**Lightroom Settings/**<br />Contient des plugins (**Topaz Photo AI.lrplugin**) et des presets d'éditeurs externes (**TopazPhotoAI.lrtemplate**) |
|
||||||
|
| **Paramètres prédéfinis et modèles** | **(.lrtemplate)** Les paramètres prédéfinis et modèles au format .lrtemplate sont enregistrés à l’emplacement suivant : */Users/[nom d’utilisateur]/Library/Application Support/Adobe/Lightroom/[dossier du paramètre prédéfini ou du modèle]/**[nom du fichier de paramètre prédéfini ou de modèle.lrtemplate]*** |
|
||||||
|
| | **(XMP)** À partir de Lightroom Classic, les paramètres prédéfinis existants au format .lrtemplate sont automatiquement convertis au nouveau format de paramètre prédéfini XMP. Après la conversion, les nouveaux paramètres prédéfinis au format XMP sont enregistrés à l’emplacement suivant : */Users/[user name]/Library/Application Support/Adobe/CameraRaw/Settings* |
|
||||||
|
| | **(Paramètres prédéfinis stockés avec le catalogue) :** si vous avez activé l’option [**Stocker les paramètres prédéfinis avec ce catalogue**](https://helpx.adobe.com/fr/lightroom-classic/help/setting-preferences-lightroom.html#Storepresetswithyourcatalog) dans les préférences de Lightroom Classic, les fichiers de paramètres prédéfinis et de modèle sont enregistrés à l’emplacement suivant : *MacHD/[emplacement du catalogue]/[nom du dossier du catalogue]/Lightroom Settings/Settings* |
|
||||||
|
| **Catalogue local de Lightroom (cloud)** | /Users/[nom d’utilisateur]/Pictures/**Lightroom Library.lrlibrary** |
|
||||||
|
| | (1) fichiers présents quand Lightroom Classic est ouvert.<br />(2) présents dans l'archive Backup/YYYY-MM-DD HHSS/Lightroom Catalog-v13.zip |
|
||||||
|
|
||||||
30
docs/Divers/Composer.md
Normal file
30
docs/Divers/Composer.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Composer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Installer bibliothèque:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer require lsolesen/pel --prefer-dist --classmap-authoritative
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```php
|
||||||
|
require __DIR__ . '/vendor/lsolesen/pel/autoload.php';
|
||||||
|
use lsolesen\pel\Pel;
|
||||||
|
use lsolesen\pel\PelDataWindow;
|
||||||
|
use lsolesen\pel\PelJpeg;
|
||||||
|
use lsolesen\pel\PelTag;
|
||||||
|
use lsolesen\pel\PelIfd;
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Supprimer bibliothèque:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer remove lsolesen/pel
|
||||||
|
```
|
||||||
|
|
||||||
27
docs/Divers/GPG.md
Normal file
27
docs/Divers/GPG.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# GPG Keys
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Lister les clés GPG publiques:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gpg --list-secret-keys --keyid-format LONG
|
||||||
|
|
||||||
|
/Users/yourusername/.gnupg/pubring.kbx
|
||||||
|
--------------------------------------
|
||||||
|
sec rsa4096/<key-id> 2021-01-01 [SC]
|
||||||
|
ABCD1234EFGH5678IJKL91011MNOP1213
|
||||||
|
uid [ultimate] Your Name <your.email@example.com>
|
||||||
|
ssb rsa4096/9876ZYXWVUTS5432 2021-01-01 [E]
|
||||||
|
```
|
||||||
|
|
||||||
|
Le Key ID est: ABCD1234EFGH5678IJKL91011MNOP1213
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Afficher la clé publique:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gpg --armor --export ABCD1234EFGH5678IJKL91011MNOP1213
|
||||||
|
```
|
||||||
|
|
||||||
19
docs/Divers/JDownloader.md
Normal file
19
docs/Divers/JDownloader.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# JDownloader
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[How to use another browser than your OS' default to solve browser captchas](https://support.jdownloader.org/Knowledgebase/Article/View/define-custom-browser-solver-captcha-browser)
|
||||||
|
|
||||||
|
Ouvrir **Preferences** -> **Paramètres avancés**.
|
||||||
|
|
||||||
|
Chercher *"browser captchasolver browser commandline"*
|
||||||
|
|
||||||
|
Ajouter `[ "open", "-n", "-a", "/Applications/Firefox.app", "--args", "-new-tab", "%s" ]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Coller un lien dans JDownloader.
|
||||||
|
|
||||||
|
Un onglet Firefox s'ouvre pour résoudre le captcha.
|
||||||
|
|
||||||
|
Cliquer sur **I am no robot**.
|
||||||
109
docs/Divers/Permajet/Art_lisse.md
Normal file
109
docs/Divers/Permajet/Art_lisse.md
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# Papiers d'art lisses (6)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Gamme primée de papiers d'art numériques avec des surfaces lisses et délicatement structurées finies avec un revêtement mat multicouche**.
|
||||||
|
|
||||||
|
Ces milieux sans acide de qualité musée sont fabriqués à partir d'Alpha Cellulose, de Cotton Rag ou d'un mélange des deux avec des poids de base de 200 à 310 g/m2. Tous les matériaux sont enduits pour donner à vos images une saturation des couleurs incroyable et des noirs exceptionnellement profonds. Les matériaux de base sont raffinés pour éliminer l'acide et la lignine afin d'assurer et de prolonger la stabilité archivistique.
|
||||||
|
|
||||||
|
Tous les papiers portent un certificat de stabilité archivistique délivré par des laboratoires agréés UKAS. PermaJet, un membre de premier plan et avant-gardiste de la Fine Art Trade Guild, a adopté les normes requises par le système Guilds ArtSureTM pour s'assurer que des normes élevées étaient maintenues dans toute la gamme.
|
||||||
|
|
||||||
|
*« Ces papiers sont merveilleux, très lourds et denses, posés à plat ou montés avec une surface lisse comme du velours. Il fait des impressions qui donnent l'impression qu'elles valent la peine d'être payées. » **David Kilpatrick, rédacteur en chef, Cameracraft Magazine**.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Alpha Natural Rag 310
|
||||||
|
|
||||||
|
Alpha Natural Rag 310 est un papier jet d'encre d'art avec une surface lisse et mate et une base blanche naturelle. Produisez facilement de beaux résultats Giclée avec ce papier gratuit OBA, le choix parfait pour les artistes et les photographes à la recherche d'un véritable matériau d'art d'archives. Il reproduit des couleurs époustouflantes et vibrantes et une grande profondeur et des détails d'image. La base chaude 100 % coton fournit une plate-forme stable pour les reproductions d'art sans changement de couleur ni amélioration.
|
||||||
|
|
||||||
|
Alpha Natural Rag est très adapté aux photographes de paysage, de portrait et d'art et aux artistes qui désirent une surface très lisse.
|
||||||
|
|
||||||
|
**Alpha Natural Rag 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Véritable archivistique, reproductions d'art sans OBA
|
||||||
|
- Couleurs et profondeur d'image exceptionnelles
|
||||||
|
- Impressions nécessitant une teinte de base naturelle sans changement de couleur
|
||||||
|
|
||||||
|
https://www.permajet.com/product/alpha-natural-rag-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Omega Rag 310
|
||||||
|
|
||||||
|
Omega Rag 310 est un papier jet d'encre d'art avec une surface lisse et mate et une base blanche neutre. Il imprime les couleurs à un niveau exceptionnel avec un faible métamérisme, tandis que ses détails d'ombre et sa gradation lisse des tons en font un partenaire idéal pour le travail monochrome. Très adapté aux photographes de paysages et de portraits, ce papier imprime des couleurs complexes, des noirs profonds et des niveaux élevés de détails sans compromis.
|
||||||
|
|
||||||
|
La surface d'Omega Rag a une délicieuse finition lisse qui donne de la profondeur aux images, et une base de chiffon 100 % coton pour une stabilité archivistique et une qualité exceptionnelle. La base lourde a une excellente sensation à portée de main et constituera un excellent choix pour les tirages d'art, les expositions et plus encore.
|
||||||
|
|
||||||
|
**Omega Rag 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Reproductions d'art
|
||||||
|
- Photographes à la recherche d'un papier mat plus lourd
|
||||||
|
- Couleurs complexes et haut niveau de détail
|
||||||
|
|
||||||
|
https://www.permajet.com/product/omega-rag-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Photo Art Silk 290
|
||||||
|
|
||||||
|
Photo Art Silk 290 est un papier jet d'encre d'art avec une surface mate en soie et une base blanc moyen. Ce papier mat a un revêtement unique qui prend un éclat de soie luxueux lorsqu'il est imprimé, pétillant dans la lumière et débordant de vitalité. Cela en fait le papier parfait pour les paysages marins et les photographies de paysages à longue exposition, améliorant les résultats et ajoutant une qualité magique.
|
||||||
|
|
||||||
|
Photo Art Silk est un papier d'art avec une différence et créera des tirages remarquables adaptés à tous les usages, de l'art mural aux participations au concours Camera Club. La surface a une texture ondulée subtile pour une vraie sensation d'art, tandis que la base blanche naturelle Alpha Cellulose offre d'excellents rendus de couleurs et des détails nets.
|
||||||
|
|
||||||
|
**Photo Art Silk 290 est parfait pour...**
|
||||||
|
|
||||||
|
- Matières contenant des surfaces réfléchissantes, telles que l'eau
|
||||||
|
- Tirages d'art nécessitant une finition spéciale supplémentaire
|
||||||
|
- Paysages marins à longue exposition
|
||||||
|
|
||||||
|
https://www.permajet.com/product/photo-art-silk-290/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Portfolio Rag 220
|
||||||
|
|
||||||
|
Portfolio Rag 220 est un papier jet d'encre d'art avec une surface lisse et mate et une base naturelle blanc cassé. Il reproduit les couleurs avec beaucoup de profondeur et de clarté, la teinte de base naturelle offrant une précision adaptée aux reproductions d'art. La délicieuse surface mate lisse est parfaite pour le portrait et la photographie de mariage, donnant un aspect de haute qualité sans éléments distrayants. Il a un chiffon 100 % coton, sans acide, qui offre une stabilité archivistique au travailleur sérieux des beaux-arts.
|
||||||
|
|
||||||
|
Portfolio Rag 220 est le papier le plus léger de la gamme des beaux-arts, adapté aux portfolios et aux albums, aux invitations et aux tirages encadrés.
|
||||||
|
|
||||||
|
**Portfolio Rag 220 est parfait pour...**
|
||||||
|
|
||||||
|
- Œuvres d'art adaptées à une surface lisse
|
||||||
|
- Livres photo, invitations, travail en studio
|
||||||
|
|
||||||
|
https://www.permajet.com/product/portfolio-rag-220/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Portrait Rag 285
|
||||||
|
|
||||||
|
Portrait Rag 285 est un papier jet d'encre d'art avec une surface mate classique et une base blanche moyenne. Il a un Dmax incroyable qui produit des noirs profonds et veloutés, et une large gamme de couleurs adaptée aux tons de peau et aux paysages. La surface a une texture subtile qui ajoute du caractère et de la définition aux œuvres d'art sans détourner l'attention du sujet.
|
||||||
|
|
||||||
|
La base de chiffon 100 % coton de Portrait Rag produit une excellente définition tonale et une large gamme de couleurs pour des impressions précises et de haute qualité. Les qualités archivistiques en font un excellent choix pour les photographes, les artistes et les galeries.
|
||||||
|
|
||||||
|
**Portrait Rag 285 est parfait pour...**
|
||||||
|
|
||||||
|
- Portraits et mariages haut de gamme
|
||||||
|
- Noirs profonds et veloutés et couleurs riches
|
||||||
|
- Œuvres d'art d'archives
|
||||||
|
|
||||||
|
https://www.permajet.com/product/portrait-rag-285/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Portrait White 285
|
||||||
|
|
||||||
|
Portrait White 285 est un papier jet d'encre fine art avec une surface mate texturée subtile et une base blanche brillante. Il reproduit magnifiquement les couleurs, rehaussées par le ton de base plus blanc, tandis que les noirs impriment profondément et riches. La surface mate subtile et alvéolée complète la photographie d'art et les œuvres d'art, ajoutant une délicieuse texture douce qui rehausse l'image. Les photographes et les artistes apprécieront d'imprimer leur travail sur Portrait White 285, en particulier ceux qui produisent des portraits, des œuvres clés et des illustrations.
|
||||||
|
|
||||||
|
Ce matériau 100% alpha cellulose est sans acide et idéal pour les impressions standard d'archives.
|
||||||
|
|
||||||
|
**Portrait White 285 est parfait pour...**
|
||||||
|
|
||||||
|
- Représenter la texture des tons de peau dans le portrait d'art
|
||||||
|
- Travail haut de gamme qui bénéficierait d'une base blanche brillante
|
||||||
|
- Œuvre d'art avec des noirs riches et des couleurs vives
|
||||||
|
|
||||||
|
https://www.permajet.com/product/portrait-white-285/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
65
docs/Divers/Permajet/Art_textures.md
Normal file
65
docs/Divers/Permajet/Art_textures.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# Papiers d'art texturés (3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Matériaux d'art texturés pour l'artiste auto-publiant, le photographe d'art et la maison de reproduction d'art.**
|
||||||
|
|
||||||
|
Des surfaces texturées qui donnent une sensation de profondeur et de subtilité à vos images tout en offrant une densité d'image et une définition des couleurs remarquables.
|
||||||
|
|
||||||
|
Les matériaux moulés sont vraiment emblématiques de la gamme PermaJet, en utilisant du coton raffiné et des fibres naturelles pour constituer la base avec des poids allant de 250 à 325 g/m2.
|
||||||
|
|
||||||
|
Des revêtements avancés sont appliqués à l'aide de la technologie multicouche pour assurer une cohérence uniforme même sur la texture la plus lourde. La reproduction des couleurs dépassera vos attentes dans tous les domaines en fournissant des images qui répondent aux normes les plus élevées de qualité du Musée et de reproduction des beaux-arts de Giclee.
|
||||||
|
|
||||||
|
Chaque papier est certifié pour sa qualité et sa longévité par des laboratoires indépendants qui travaillent à répondre aux normes attendues par le système ArtSureTM de la Fine Art Trade Guild de renommée internationale.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Artist Watercolour 250
|
||||||
|
|
||||||
|
Artist Watercolour 250 est un papier jet d'encre d'art avec une surface fortement texturée et une base blanche naturelle. Ce papier sans OBA rappelle les matériaux traditionnels pour l'aquarelle, avec une texture tissée proéminente qui donne un superbe effet réaliste lors de la reproduction de croquis et de peintures. Artist Watercolour est également fantastique pour imprimer des photographies d'art, la texture faisant ressortir des détails subtils et ajoutant une finition unique de haute qualité.
|
||||||
|
|
||||||
|
La base blanche naturelle de ce papier Alpha Cellulose a une gamme de couleurs et une netteté exceptionnelles, assurant que votre travail imprime à son meilleur. Convient pour une utilisation archivistique dans les galeries, les expositions et plus encore.
|
||||||
|
|
||||||
|
**Artist Watercolour 250 est parfait pour...**
|
||||||
|
|
||||||
|
- Œuvres d'art artistiques, en particulier de grandes envergure
|
||||||
|
- Croquis et peintures, pour une reproduction réaliste des textures
|
||||||
|
- Superbes couleurs et définition
|
||||||
|
|
||||||
|
https://www.permajet.com/product/artist-watercolour-250/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Gallery Etching 310
|
||||||
|
|
||||||
|
Gallery Etching 310 est un papier jet d'encre d'art avec une surface fortement texturée et une base blanche naturelle. Ce papier présente des détails d'image impressionnants et une vivacité des couleurs, un excellent choix pour les artistes et les photographies créatives. La texture de surface est constituée d'ondulations prononcées au hasard, qui ajoutent de la vie à une image lorsqu'elle est imprimée. Cette texture convient particulièrement aux reproductions d'artistes, imitant les qualités élevées de la peinture à l'huile pour un look presque 3D. Il offre également une qualité et une profondeur délicieuses aux photographies qui bénéficieraient d'une texture supplémentaire, telles que des natures mortes et des paysages d'art.
|
||||||
|
|
||||||
|
Gallery Etching 310 a une base Alpha Cellulose sans acide et un impressionnant revêtement résistant aux éraflures, avec des qualités d'archivage qui répondent aux normes de la galerie.
|
||||||
|
|
||||||
|
**Gallery Etching 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Reproductions d'art détaillées, en particulier des œuvres d'art
|
||||||
|
- Images nécessitant un aspect de texture supplémentaire
|
||||||
|
- Couleurs audacieuses et vibrantes et noirs profonds
|
||||||
|
|
||||||
|
https://www.permajet.com/product/gallery-etching-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Museum Heritage 310
|
||||||
|
|
||||||
|
Museum Heritage 310 est un papier jet d'encre d'art avec une surface texturée et une base blanc moyen. Il imprime avec des détails et une clarté exceptionnels, rehaussés par le tissage texturé rugueux qui est très adapté à la photographie d'art, aux scènes rustiques et aux portraits détaillés. Ce papier mélange coton et Alpha Cellulose est parfait pour les artistes qui souhaitent reproduire leur travail, la base blanc moyen offrant des rendus de couleurs et monochromes exceptionnels.
|
||||||
|
|
||||||
|
Museum Heritage a un revêtement supérieur qui imprime d'excellents détails de surbrillance et d'ombre avec un Dmax élevé. La surface texturée ajoute de la profondeur et de la qualité aux images pour un aspect et une sensation très spéciaux, adaptés aux expositions professionnelles, aux galeries, aux musées et aux artistes.
|
||||||
|
|
||||||
|
**Museum Heritage 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Œuvres d'art qui nécessitent plus de profondeur, avec des
|
||||||
|
détail de la surbrillance et de l'ombre
|
||||||
|
- Couleurs complexes et pièces très détaillées
|
||||||
|
- Scènes et paysages rustiques, portraits « météorologiques »
|
||||||
|
|
||||||
|
https://www.permajet.com/product/museum-heritage-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
101
docs/Divers/Permajet/Baryta.md
Normal file
101
docs/Divers/Permajet/Baryta.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# Papiers Baryta à base de fibres (5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Lancé en 2004, PermaJet a été le pionnier des médias numériques de Baryta.**
|
||||||
|
|
||||||
|
Papiers à base de fibres (Baryta) avec une structure traditionnelle de chambre noire, ce qui en fait l'alternative à jet d'encre numérique parfaite aux papiers à l'halogénure d'argent d'origine.
|
||||||
|
|
||||||
|
Les bases alpha-cellulose ont la sensation légèrement striée que vous attendez des papiers traditionnels pour chambre noire et sont disponibles avec des options de surface lisses et délicatement structurées. Avec des poids de base allant de 285 à 325 g/m2, PermaJet a créé une gamme de produits Baryta « à plat » qui alimentent facilement votre imprimante à jet d'encre.
|
||||||
|
|
||||||
|
Le revêtement multicouche amélioré, combiné à la technologie d'encre moderne, vous assure d'obtenir les cotes Dmax les plus élevées avant que possible. Ces caractéristiques fonctionnent ensemble pour offrir la gamme de tons la plus large afin d'améliorer les détails de la surbrillance et de l'ombre, offrant des images monochromes nettes et des couleurs percutantes.
|
||||||
|
|
||||||
|
Une véritable collection d'arrêt de spectacle maintenant disponible en Gloss (subtil brillant séché à l'air) Pearl, Silk et Matt. Les longueurs des rouleaux sont toutes de 15 mètres et disponibles jusqu'à 60'' de large à des fins de production et des supports en feuilles A4 - A2. Les surfaces sont toutes sèches instantanément et ont des finitions résistantes aux éraflures, ce qui les rend idéales pour une utilisation avec des encres à base de colorants et de pigments.
|
||||||
|
|
||||||
|
Développé avec la stabilité archivistique et les processus de test associés à la Fine Art Trade Guild de renommée internationale à l'esprit - une garantie que vos images dureront de nombreuses années à venir.
|
||||||
|
|
||||||
|
Lors de tests indépendants de plus de 200 papiers d'art et photo jet d'encre, ils ont donné la plus grande précision D-MAX, de gamme de couleurs et de tons de peau, créant à son tour d'excellentes niveaux de gris pour les images monochromes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FB Distinction 320
|
||||||
|
|
||||||
|
FB Distinction 320 est un papier jet d'encre à base de fibres avec une surface subtilement brillante et une teinte de base blanche brillante. Rappelant les matériaux traditionnels de la chambre noire, ce papier baryte imprime avec des détails exceptionnels, Dmax et une gamme de tons. La surface brillante a un éclat délicat qui élève les photographies et les œuvres d'art.
|
||||||
|
|
||||||
|
Créez des impressions audacieuses et percutantes qui se démarquent sur la base blanche brillante Alpha Cellulose, ajoutant de la vie aux couleurs et créant du contraste. Les noirs profonds et la large gamme de tons font de FB Distinction 320 un excellent choix pour les travaux monochromes à contraste élevé, ou les images en couleur qui bénéficieraient d'une teinte de base améliorée pour vraiment se démarquer et créer un impact.
|
||||||
|
|
||||||
|
**FB Distinction 320 est parfait pour...**
|
||||||
|
|
||||||
|
- Images avec beaucoup de détails et de profondeur d'ombre
|
||||||
|
- Images percutantes et à contraste élevé
|
||||||
|
- Monochromes qui bénéficieraient d'une base blanche brillante
|
||||||
|
|
||||||
|
https://www.permajet.com/product/fb-distinction-320/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FB Gold Silk 315
|
||||||
|
|
||||||
|
FB Gold Silk 315 est un papier jet d'encre à base de fibres avec une surface satinée et une teinte de base chaude naturelle. Ce papier primé a un Dmax record, ce qui vous permet d'imprimer les noirs les plus profonds et les plus veloutés qui créent du contraste et de la définition. Avec des détails nets et une belle couleur et une capacité monochrome, combinées à la somptueuse surface en soie, FB Gold Silk est la quintessence de la qualité. Il reproduit les matériaux traditionnels de la chambre noire baryte avec une finesse qui impressionnera tout spectateur.
|
||||||
|
|
||||||
|
Créez des impressions exceptionnelles à chaque fois grâce à l'adéquation de ce papier à un large éventail de sujets et de types d'images. FB Gold Silk 315 excelle avec les portraits et le travail monochrome, grâce à sa large gamme de tons et à sa teinte de base chaude. Ce papier Alpha Cellulose est idéal pour les concours photographiques, les expositions, les portfolios et plus encore.
|
||||||
|
|
||||||
|
**FB Gold Silk 315 est parfait pour...**
|
||||||
|
|
||||||
|
- Noirs et ombres profonds sans perte de détails
|
||||||
|
- Images du côté plus chaud, en particulier les tons de peau
|
||||||
|
- Chambre noire rappelant les imprimés, fans de la soie originale en fibre d'or Ilford Galerie
|
||||||
|
|
||||||
|
https://www.permajet.com/product/fb-gold-silk-315/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FB Matt 285
|
||||||
|
|
||||||
|
FB Matt 285 est un papier jet d'encre à base de fibres avec une surface mate lisse et une teinte de base blanche brillante. Rappelant le papier chambre noire traditionnel, et la seule variété mate de la gamme, c'est une alternative fantastique pour les photographes et les artistes qui préfèrent les finitions mates.
|
||||||
|
|
||||||
|
Ce papier Alpha Cellulose est hautement recherché pour sa surface mate lisse et veloutée, qui imprime avec des tons nuancés et des détails nets. C'est le choix parfait pour une variété d'images, des paysages doux à l'architecture saisissante, et il capturera chaque détail avec sa couche de base de baryte supérieure. Des images monochromes s'impriment avec une merveilleuse gamme de tons et des noirs nets, tandis que les couleurs sont délicates et sophistiquées. La surface mate et la technologie de pose à plat rendent ce papier très approprié pour l'encadrement, idéal pour les expositions photographiques, les galeries d'art et les œuvres d'art mural.
|
||||||
|
|
||||||
|
**FB Matt 285 est parfait pour...**
|
||||||
|
|
||||||
|
- Monochromes avec une large gamme de tons
|
||||||
|
- Paysage et art moderne avec des gradations lisses
|
||||||
|
- Impressions de haute qualité qui seront visualisées derrière le verre
|
||||||
|
|
||||||
|
https://www.permajet.com/product/fb-matt-285/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FB Pearl 300
|
||||||
|
|
||||||
|
FB Pearl 300 est un papier jet d'encre à base de fibres avec une superbe surface perlée et une teinte de base blanche naturelle. Créez de somptueux imprimés qui rappellent les matériaux traditionnels de chambre noire aux halogénures d'argent, avec une excellente gamme de tons, des détails et Dmax, le choix parfait pour les travailleurs monochromes. La photographie couleur et les illustrations imprimeront avec une vivacité et une profondeur qui attirent le spectateur.
|
||||||
|
|
||||||
|
La surface en perles a un aspect luxueux qui ajoute de la vie aux images et une sensation générale de qualité. FB Pearl 300 est un excellent choix pour la photographie de portrait et de paysage grâce à sa large gamme de tons et à sa base blanche naturelle. Fabriqué à partir d'Alpha Cellulose, il est sans acide et sans OBA, ce qui permet des impressions de qualité archivistique à 100 %. La finition de haute qualité et la longévité archivistique font de ce papier le choix idéal pour les tirages d'art et les expositions.
|
||||||
|
|
||||||
|
**FB Pearl 300 est parfait pour...**
|
||||||
|
|
||||||
|
- Portraits et paysages nécessitant une finition luxueuse et étincelante
|
||||||
|
- Imprimés de qualité chambre noire
|
||||||
|
- Prises de vue et images à longue exposition avec beaucoup de tons moyens
|
||||||
|
|
||||||
|
https://www.permajet.com/product/fb-pearl-300/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# FB Royal Gloss 310
|
||||||
|
|
||||||
|
*Veuillez noter que le stock actuel de FB Royal Gloss 310 a subi un changement de température et a maintenant une teinte de base plus blanche*
|
||||||
|
FB Royal Gloss 310 est un papier jet d'encre à base de fibres avec une surface brillante raffinée et une teinte de base blanche naturelle. Rappelant les matériaux traditionnels émaillés de la chambre noire, ce papier a un bel aspect et une belle sensation avec de subtiles ondulations à travers la surface. Il imprime avec des détails glorieux et des couleurs fidèles à la réalité grâce à la base blanche naturelle, l'option parfaite pour les photographes animaliers, portraits et paysages.
|
||||||
|
|
||||||
|
Ce papier Alpha Cellulose a une base de baryte sans acide et une sensation de poids lourd désirable, idéal pour les expositions d'art, les concours et plus encore. Sa qualité d'impression est exceptionnelle et ne manquera pas d'impressionner tous les amateurs traditionnels de chambre noire.
|
||||||
|
|
||||||
|
**FB Royal Gloss 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Couleurs fidèles à la vie et noirs profonds
|
||||||
|
- Expositions et œuvres d'art
|
||||||
|
- Répliques d'impressions traditionnelles à base de fibres émaillées
|
||||||
|
|
||||||
|
https://www.permajet.com/product/fb-royal-gloss-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
176
docs/Divers/Permajet/Photo_numerique.md
Normal file
176
docs/Divers/Permajet/Photo_numerique.md
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
# Papiers photo numérique (10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Une gamme créativement équilibrée de papiers photographiques, graphiques et d'impression d'affiches développée au cours des 25 dernières années pour donner à vos images et œuvres d'art un rendu parfait à un prix attractif.
|
||||||
|
|
||||||
|
Adaptés à une utilisation avec les encres colorantes et pigmentaires, ces papiers photo numériques peuvent être utilisés dans n'importe quelle imprimante à jet d'encre et sont tous dotés d'une technologie de séchage instantané. Les matériaux de base en papier « blanc brillant » sont enduits pour donner une large gamme de couleurs et un Dmax exceptionnellement élevé. La combinaison de nos avancées technologiques a été fournie pour vous donner des images nettes et nettes impressionnantes à la densité d'impression la plus élevée, donnant à votre image l'aspect et la sensation dynamiques que vous voulez créer.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Gloss 271
|
||||||
|
|
||||||
|
Gloss 271 est un papier jet d'encre instantané sec et brillant avec une base blanche brillante. Il imprime avec des couleurs vives et des détails nets, parfait pour les photos de famille de tous les jours jusqu'au travail en studio commercial. La surface reproduit une belle gamme de tons et un contraste profond, fini par un brillant lisse et étincelant qui ajoutera de la vie à n'importe quelle image. Gloss 271 est un excellent choix pour la photographie audacieuse et le travail graphique qui doit avoir l'air net et percutant.
|
||||||
|
|
||||||
|
Ce papier photo numérique enduit de résine a un poids de 271 g/m2 qui passera sans effort à travers votre imprimante tout en ayant une sensation de haute qualité à portée de main. Son superporeux et protecteur UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, assurant que vos photos ont l'air fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Gloss 271 est parfait pour...**
|
||||||
|
|
||||||
|
- Cas où une finition haute brillance est souhaitée
|
||||||
|
- Couleurs vibrantes et saturées
|
||||||
|
- Impressions quotidiennes, publicité et travail en studio
|
||||||
|
|
||||||
|
https://www.permajet.com/product/gloss-271/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# MattPlus 240
|
||||||
|
|
||||||
|
MattPlus 240 est un papier jet d'encre de poids moyen avec une surface mate lisse. Créez des impressions vibrantes et percutantes avec la somptueuse surface mate qui donne de la profondeur aux images sans éblouissement ni textures gênants. Les impressions sur ce papier ont des détails nets incroyables et des couleurs riches, tandis que l'impressionnante gamme de tons rend ce papier tout aussi désirable pour le travail monochrome.
|
||||||
|
|
||||||
|
MattPlus 240 a une teinte de base blanche propre qui fournit des impressions précises, ce qui en fait un choix fantastique pour les reproductions d'œuvres d'art numériques, les peintures murales photographiques et les documents marketing.
|
||||||
|
|
||||||
|
Ce papier photo numérique a une base Alpha Cellulose, offrant une grande qualité et des résultats qui auront l'air fantastiques pour les années à venir. Son poids de 240 g/m2 alimente sans effort n'importe quelle imprimante tout en ayant une sensation de qualité.
|
||||||
|
|
||||||
|
**Matt Plus 240 est parfait pour...**
|
||||||
|
|
||||||
|
- Couleurs profondes et nettes et détails nets
|
||||||
|
- Faune et portraits aux tons doux
|
||||||
|
- Impression quotidienne nécessitant une finition mate
|
||||||
|
|
||||||
|
https://www.permajet.com/product/matt-plus-240/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Matt Proofing 160
|
||||||
|
|
||||||
|
Matt Proofing 160 est le papier jet d'encre le plus léger de la gamme PermaJet et une option très économique. Il a une surface mate lisse et est conçu avec l'épreuvage d'image à l'esprit, idéal pour produire des impressions d'essai et des feuilles de contact sans gaspiller de matériaux à coût plus élevé.
|
||||||
|
|
||||||
|
Bien que conçu pour les exigences de fermentation, ce papier Alpha Cellulose atteint toujours une excellente qualité et une excellente saturation encre pour les tirages photographiques de tous les jours. Cela rend Matt Proofing 160 parfait pour les photographes et les artistes à la recherche d'un papier jet d'encre avec un poids de base très léger. Sa surface lisse est nette et brillante, produisant des couleurs et des noirs forts.
|
||||||
|
|
||||||
|
En raison de son poids léger, ce papier alimente sans effort à travers n'importe quelle imprimante à jet d'encre.
|
||||||
|
|
||||||
|
**Matt Proofing 160 est parfait pour...**
|
||||||
|
|
||||||
|
- Feuilles de contact et tirages de test
|
||||||
|
- Impression à usage général nécessitant un poids de base inférieur
|
||||||
|
|
||||||
|
https://www.permajet.com/product/matt-proofing-160/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Oyster 271
|
||||||
|
|
||||||
|
Le papier jet d'encre le plus populaire de PermaJet, Oyster 271, est instantanément sec avec une base blanche brillante et une subtile surface perlée. Son revêtement microporeux offre un Dmax incroyable assurant une large gamme de tons et des couleurs riches et saturées, garantissant que même les images complexes donnent le meilleur d'elles-mêmes. Il a une surface de lustre magnifiquement délicate qui améliore les impressions sans se distraire du sujet, ce qui en fait un favori des photographes et des artistes.
|
||||||
|
|
||||||
|
Oyster 271 est trois fois primé et est souvent décrit comme un excellent papier polyvalent, convenant à une grande variété d'images, ce qui en fait un must pour le stock de chaque imprimeur. Ce papier photo numérique enduit de résine a un poids de 271 g/m2 qui passera sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, ce qui garantit que vos photos sont fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Oyster 271 est parfait pour...**
|
||||||
|
|
||||||
|
- Exigences quotidiennes, du portrait à la faune
|
||||||
|
- Images couleur et monochromes
|
||||||
|
- Débutants cherchant à se familiariser avec l'impression
|
||||||
|
|
||||||
|
https://www.permajet.com/product/oyster-271/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Photo Lustre 310
|
||||||
|
|
||||||
|
Photo Lustre 310 est un papier jet d'encre blanc brillant avec une surface luxueuse et brillante. Les couleurs sont profondes et saturées, et les images monochromes s'impriment avec une gamme de tons et un contraste incroyables. Le Dmax élevé donne des noirs intenses et riches tout en atteignant la définition dans les zones d'ombre. Sa finition lustrée est subtile tout en ajoutant un niveau de définition supplémentaire.
|
||||||
|
|
||||||
|
Ce papier photo numérique primé a un poids de base lourd pour une sensation de qualité que l'on trouve rarement dans un papier aussi économique, et une surface résistante et résistante aux rayures. Cela rend Photo Lustre 310 idéal pour toutes sortes d'utilisation où des couleurs percutantes et un contraste audacieux sont une priorité, des portfolios photographiques aux affichages de conception graphique.
|
||||||
|
|
||||||
|
Photo Lustre 310 dispose d'une supercouche microporeuse de protection contre les UV qui ajoute un niveau élevé de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art ont l'air fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Photo Lustre 310 est parfait pour...**
|
||||||
|
|
||||||
|
- Des couleurs riches et des noirs profonds et frappants
|
||||||
|
- Impression quotidienne nécessitant une sensation de haute qualité
|
||||||
|
- Images monochromes détaillées avec un fort contraste
|
||||||
|
|
||||||
|
https://www.permajet.com/product/photo-lustre-310/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Smooth Gloss 280
|
||||||
|
|
||||||
|
Smooth Gloss 280 est un papier jet d'encre sec instantané avec une finition miroir et brillante et une teinte de base chaude. Les images s'impriment avec dynamisme et précision détaillée, ce qui en fait le papier parfait pour les photographes ayant une publicité à fort impact et un travail en studio. Le Dmax élevé est capable de noirs profonds et d'une bonne gamme de tons, garantissant que les impressions sur Smooth Gloss 280 sont percutantes et nettes, finies avec la surface brillante qui ajoute un niveau supplémentaire de profondeur et d'impact.
|
||||||
|
|
||||||
|
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui se nourrira sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Smooth Gloss 280 est parfait pour...**
|
||||||
|
|
||||||
|
- Images où une teinte de base plus chaude est préférée
|
||||||
|
- Images couleur et monochromes haute définition
|
||||||
|
- Publicité, travail en studio, impression quotidienne
|
||||||
|
|
||||||
|
https://www.permajet.com/product/smooth-gloss-280/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Smooth Pearl 280
|
||||||
|
|
||||||
|
Smooth Pearl 280 est un papier jet d'encre sec instantané au fini perlé subtil. Il a une teinte de base naturelle blanche/chaude qui le rend idéal pour les tons de peau, les studios de portrait, la photographie de paysage et les reproductions d'art. La superbe surface lisse avec sa finition perlée raffinée donne la sensation de luxe que l'on retrouve dans les papiers plus chers. Smooth Pearl 280 dispose d'un Dmax exceptionnel, capable de produire des noirs profonds et une large gamme de tons, adapté à la fois au travail monochrome et en couleur.
|
||||||
|
|
||||||
|
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui se nourrira sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Smooth Pearl 280 est parfait pour...**
|
||||||
|
|
||||||
|
- Impression quotidienne où une base plus chaude est préférée
|
||||||
|
- Portraits aux tons lisses
|
||||||
|
- Fans de l'original Ilford Smooth Pearl
|
||||||
|
|
||||||
|
https://www.permajet.com/product/smooth-pearl-280/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Titanium Gloss 300
|
||||||
|
|
||||||
|
Titanium Gloss 300 est un papier jet d'encre brillant avec une base métallique unique. Il a un sous-ton argenté qui donne vie à des images où les sujets contiennent du métal, de l'eau et des surfaces réfléchissantes, les faisant briller sous la lumière.Ce papier photo numérique primé est le choix créatif idéal pour que votre travail se démarque et ait un impact élevé. La surface brillante n'est pas écrasante, ajoutant plutôt une finition luxueuse, tandis que les couleurs brillent presque grâce à la base réfléchissante à la lumière. Titanium Gloss 300 imprime avec des détails et une clarté incroyables et fonctionne extrêmement bien avec des images qui ont des couleurs vives, des noirs profonds et des zones blanches/argent qui permettent à la base métallique de transparaisse.
|
||||||
|
|
||||||
|
Ce papier enduit de résine a un poids de 300 g/m2 qui se nourrit sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main.
|
||||||
|
|
||||||
|
**Titanium Gloss 300 est parfait pour...**
|
||||||
|
|
||||||
|
- Images avec de l'eau, du métal ou des sujets réfléchissants
|
||||||
|
- Couleurs vives et monochromes contrastés
|
||||||
|
- Images avec des zones blanches et des reflets pour permettre la base métallique pour briller
|
||||||
|
|
||||||
|
https://www.permajet.com/product/titanium-gloss-300/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Titanium Lustre 280
|
||||||
|
|
||||||
|
Titanium Lustre 280 est un papier jet d'encre primé avec une base métallique unique et une surface éclatée subtile. Les images sautent de la page avec une apparence dramatique et un haut niveau de détail.
|
||||||
|
|
||||||
|
Ce papier photo numérique fonctionne particulièrement bien avec les images monochromes et HDR, sa base métallique argentée se prêtant à de larges gammes de tons et à des images à contraste élevé. Les subtiles ondulations de la surface brillante captent magnifiquement la lumière, ajoutant un éclat aux sujets qui contiennent du métal ou une surface réfléchissante, tandis que la base en papier métallique ajoute une sensation fidèle à la vie. Cela fait de Titanium Lustre 280 un choix créatif et remarquable pour cette œuvre spéciale.
|
||||||
|
|
||||||
|
Ce papier photo numérique enduit de résine a un poids de 280 g/m2 qui alimente sans effort n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main.
|
||||||
|
|
||||||
|
**Titanium Lustre 280 est parfait pour...**
|
||||||
|
|
||||||
|
- Images avec de l'eau, du métal ou des sujets réfléchissants
|
||||||
|
- Couleurs vives et monochromes contrastés
|
||||||
|
- Images avec des zones blanches et des reflets pour permettre la base métallique pour briller
|
||||||
|
|
||||||
|
https://www.permajet.com/product/titanium-lustre-280/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ultra Pearl 295
|
||||||
|
|
||||||
|
Ultra Pearl 295 est un papier jet d'encre blanc brillant avec une surface traditionnelle en perles prononcée. La base blanche brillante soulève les images et ajoute un look net adapté à un travail audacieux et discret. Il a un Dmax élevé qui imprime des noirs profonds et riches qui contrastent magnifiquement avec la teinte de base.
|
||||||
|
|
||||||
|
Ce papier photo numérique est particulièrement adapté au travail commercial, de la photographie scolaire aux mariages, grâce à sa surface robuste résistante aux éraflures et à ses propriétés anti-scan uniques, qui dissuadent toute tentative de reproduire vos impressions.
|
||||||
|
|
||||||
|
Ultra Pearl a un poids de 295 g/m2 qui passera sans effort à travers n'importe quelle imprimante à jet d'encre tout en ayant une sensation de haute qualité à portée de main. Sa supercouche microporeuse de protection UV ajoute un haut niveau de résistance à l'humidité et à la décoloration, garantissant que vos photographies et vos œuvres d'art sont fantastiques pour les années à venir.
|
||||||
|
|
||||||
|
**Ultra Pearl 295 est parfait pour...**
|
||||||
|
|
||||||
|
- Impressions qui seront beaucoup manipulées, signalisation intérieure
|
||||||
|
- Photographie d'école et de studio - grâce à la couche anti-scan !
|
||||||
|
- Images avec des noirs profonds
|
||||||
|
|
||||||
|
https://www.permajet.com/product/ultra-pearl-295/
|
||||||
98
docs/Divers/Untitled.md
Normal file
98
docs/Divers/Untitled.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
|
||||||
|
### Pushover
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s \
|
||||||
|
--form-string "token=APP_TOKEN" \
|
||||||
|
--form-string "user=USER_KEY" \
|
||||||
|
--form-string "message=here is an image attachment" \
|
||||||
|
-F "attachment=@image.jpg" \
|
||||||
|
https://api.pushover.net/1/messages.json
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# A ajouter dans .zshrc
|
||||||
|
|
||||||
|
function push {
|
||||||
|
curl -s -F "token=YOUR_TOKEN_HERE" \
|
||||||
|
-F "user=YOUR_USER_KEY_HERE" \
|
||||||
|
-F "title=YOUR_TITLE_HERE" \
|
||||||
|
-F "message=$1" https://api.pushover.net/1/messages.json
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
send_pushover_notification() {
|
||||||
|
echo -e "Sending Pushover notification ..."
|
||||||
|
curl -s -F "token=$BASH_APP" \
|
||||||
|
-F "user=$USER_KEY" \
|
||||||
|
-F "title=$1" \
|
||||||
|
-F priority=2 \
|
||||||
|
-F html=1 \
|
||||||
|
-F retry=60 \
|
||||||
|
-F expire=86400 \
|
||||||
|
-F "message=$2" https://api.pushover.net/1/messages.json
|
||||||
|
|
||||||
|
[ $? -eq 0 ] && echo -e "${greenbold}Pushover notification sent successfully !${reset}" || echo -e "${redbold}error sending Pushover notification !${reset}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -F "token=$BASH_APP" -F "user=$USER_KEY" -F "title=Salut" -F "message=Bien" https://api.pushover.net/1/messages.json
|
||||||
|
|
||||||
|
# token: "API token" (Créer une application)
|
||||||
|
# user: "Your User Key"
|
||||||
|
|
||||||
|
# Message avec des tags HTML:
|
||||||
|
curl -s -F "user=$USER_KEY" -F "title=Great Title" -F "html=1" -F "token=$BASH_APP" -F "message='message<b> de</b> test'" https://api.pushover.net/1/messages.json
|
||||||
|
{"status":1,"request":"4b6b1655-1276-4c7d-932f-7baf0b93e5dc"}%
|
||||||
|
|
||||||
|
msg="'This is a <b>HTML</b> test'"
|
||||||
|
./pushover.sh -a "bash" -m "$msg" -f 1
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# push a notification to your phone. can be handy if you're running a
|
||||||
|
# build and you want to be notified when it's finished.
|
||||||
|
push() {
|
||||||
|
curl -s -F "token=PUSHOVER_TOKEN" \
|
||||||
|
-F "user=PUSHOVER_USER" \
|
||||||
|
-F "title=terminal" \
|
||||||
|
-F "message=$1" https://api.pushover.net/1/messages.json > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
command_to_run && push "yes! command finished successfully!" || push "awww man! something failed :-("
|
||||||
|
```
|
||||||
|
|
||||||
|
[send the IP of my Raspberry Pi via Pushover](https://gist.github.com/PJUllrich/e95baa0d718e55a6c67f85cd8e53dabe)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### nfty
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -H "X-Priority: 4" -d "yo" https://notif.maboiteverte.fr/pihole
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### gotify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
send_gotify_notification() {
|
||||||
|
now=$(date +"%d-%m-%Y %T")
|
||||||
|
gotify_server="https://gotify.maboiteverte.fr"
|
||||||
|
TITLE="Pi-hole on $host update"
|
||||||
|
MESSAGE="**A new version of Pi-hole is available:**\n\n $msg_md\n\n $infos\n\n Please run *pihole -up* on $host to update !"
|
||||||
|
PRIORITY=8
|
||||||
|
URL="$gotify_server/message?token=$token_gotify&?format=markdown"
|
||||||
|
|
||||||
|
echo -e "Sending notification to $gotify_server ..."
|
||||||
|
|
||||||
|
curl -s -S --output /dev/null --data '{"message": "'"${MESSAGE}"'", "title": "'"${TITLE}"'", "priority":'"${PRIORITY}"', "extras": {"client::display": {"contentType": "text/markdown"}}}' -H 'Content-Type: application/json' "$URL"
|
||||||
|
|
||||||
|
[ $? -eq 0 ] && echo -e "${greenbold}Gotify notification sent successfully !${reset}" || echo -e "${redbold}error sending Gotify notification !${reset}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
232
docs/Divers/alfred.md
Normal file
232
docs/Divers/alfred.md
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
# Alfred
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### StackExchange Search for Alfred
|
||||||
|
|
||||||
|
https://github.com/deanishe/alfred-stackexchange
|
||||||
|
|
||||||
|
- `stack [<query>]` — Choose a StackExchange site to search.
|
||||||
|
- `↩` — Select site
|
||||||
|
- `⌘↩` — Set as default site
|
||||||
|
- `⌥↩` — Reveal site icon in Finder
|
||||||
|
- `⌘C` — Copy site ID to clipboard (for adding Script Filters)
|
||||||
|
- `.so <query>` — Search StackOverflow.com for `<query>`. See below for syntax.
|
||||||
|
- `↩` or `⌘+NUM` — Open result in default browser
|
||||||
|
- `⌘L` — Show full question title in Alfred's Large Text window
|
||||||
|
|
||||||
|
Prefix a word in your `<query>` with `.` (full stop) to indicate that it's a tag, e.g `requests .python` will search for answers tagged `python` with the query `requests`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GitHub Repos workflow for Alfred
|
||||||
|
|
||||||
|
http://www.packal.org/workflow/github-repos
|
||||||
|
|
||||||
|
- `gh <query>` — Recherche globale
|
||||||
|
- `repo <query>` — Recherche dans repos perso
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Google Suggest
|
||||||
|
|
||||||
|
- `g <query>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Amazon Suggest
|
||||||
|
|
||||||
|
- `amazon <query>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Search Notes.app with Alfred
|
||||||
|
|
||||||
|
https://github.com/sballin/alfred-search-notes-app
|
||||||
|
|
||||||
|
- `n <query>` — Recherche un titre ou crée une nouvelle note si non trouvée
|
||||||
|
- `nb <query>` — Recherche dans les titres et les corps
|
||||||
|
- `nf <query>` — Recherche nom de dossier
|
||||||
|
|
||||||
|
#### Result actions
|
||||||
|
|
||||||
|
- **enter** to open the note/folder or create a new note if none was found
|
||||||
|
- **shift+enter** to search for your Alfred query using the Notes in-app search
|
||||||
|
- **cmd+enter** to copy the note body to the clipboard
|
||||||
|
- **alt+enter** to copy a link to the note to the clipboard
|
||||||
|
|
||||||
|
#### Note linking
|
||||||
|
|
||||||
|
You can generate links to any of your notes and use them on macOS or iOS. Copy the note URL by pressing alt+enter on an Alfred result or paste it using the snippet. This will generate two links. The first one works on macOS Big Sur (11) and newer, and the second one works on iOS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Font Awesome workflow for Alfred
|
||||||
|
|
||||||
|
https://github.com/ruedap/alfred-font-awesome-workflow
|
||||||
|
|
||||||
|
- `fa <query>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- `Enter`: Paste class name (**for coding HTML/CSS**. e.g. `fa-arrow-circle-o-right`)
|
||||||
|
- `Ctrl + Enter`: Paste character name and ligatures shoud convert the letter into the correct symbol. (**for designing in Photoshop, Illustrator, etc**)
|
||||||
|
- `Shift + Enter`: Paste character code (e.g. `f18e`)
|
||||||
|
- `Command + Enter`: Open in browser (e.g. http://fontawesome.io/icon/arrow-circle-o-right)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Alfred Keywords
|
||||||
|
|
||||||
|
https://github.com/pochemuto/alfred-help-workflow
|
||||||
|
|
||||||
|
- `?` — affiche tous les mots-clés de tous les workflows
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### alfred-show-network-info
|
||||||
|
|
||||||
|
https://github.com/jeppestaerk/alfred-show-network-info
|
||||||
|
|
||||||
|
- `ip4`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Alfred Password Generator
|
||||||
|
|
||||||
|
https://github.com/deanishe/alfred-pwgen
|
||||||
|
|
||||||
|
- `pwgen [<strength>]` —
|
||||||
|
- `pwlen [<length>]` —
|
||||||
|
- `pwconf [<query>]` —
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac App Store Search
|
||||||
|
|
||||||
|
http://www.packal.org/workflow/mac-app-store-search
|
||||||
|
|
||||||
|
- `mas <query>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Search Browser tabs
|
||||||
|
|
||||||
|
https://github.com/luceat-lux-vestra/search-browser-tabs-for-alfred
|
||||||
|
|
||||||
|
- `tabs <query>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Play Song
|
||||||
|
|
||||||
|
https://github.com/caleb531/play-song
|
||||||
|
|
||||||
|
- `playsong hey jude` — Playing a song
|
||||||
|
- `playsongin abbey road` — playsongin abbey road
|
||||||
|
- `playsongby beatles` — playsongby beatles
|
||||||
|
- `playalbum pet sounds` — Playing an album
|
||||||
|
- `playalbumby beach boys` — playalbumby beach boys
|
||||||
|
- `playartist killers` — Playing an artist
|
||||||
|
- `playgenre alternative` — Playing a genre
|
||||||
|
- `playplaylist favorites` — Playing a playlist
|
||||||
|
- `shuffleon` — Controlling the Music app's global shuffle setting
|
||||||
|
`shuffleoff` —
|
||||||
|
`shuffletoggle` —
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Search-Alfred-Workflows
|
||||||
|
|
||||||
|
https://github.com/Acidham/search-alfred-workflows
|
||||||
|
|
||||||
|
- alf <request>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- `ENTER` — Shows a list of keywords in the workflow and starts the workflow with a keyword
|
||||||
|
- `SHIFT` — Shows the workflow description , associated keywords and keyboard Shortcuts
|
||||||
|
- `CMD` — For addtional Actions:
|
||||||
|
- Copy path to Clipboard
|
||||||
|
- Open WF Folder in Terminal
|
||||||
|
- If you would like to use other terminal than macOS terminal.app change config in Alfred > Features > Terminal to custom
|
||||||
|
- Reveal in Finder
|
||||||
|
- Open in FileManager (if defined)
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
# alfred-markdown-search
|
||||||
|
|
||||||
|
https://github.com/leafney/alfred-markdown-search
|
||||||
|
|
||||||
|
- `mdd` — les 20 derniers fichiers
|
||||||
|
- `mdd -t php` — recherche par mot-clé dans le titre
|
||||||
|
- `mdd php` — recherche pleine par mot-clé
|
||||||
|
- `mdd -t golang python` — recherche 'golang' dans le titre et 'python' dans le contenu
|
||||||
|
- `mdd -t golang,python`— recherche 'golang' et 'python' dans le titre
|
||||||
|
- `mdd -t golang,python mysql` — recherche 'golang' et 'python' dans le titre , et 'mysql' dans le contenu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## alfred tldr
|
||||||
|
|
||||||
|
https://github.com/konoui/alfred-tldr
|
||||||
|
|
||||||
|
- `tldr` <query>
|
||||||
|
|
||||||
|
Options
|
||||||
|
`--version`/`-v` option shows the current version of the client.
|
||||||
|
`--update`/`-u` option updates local database (tldr repository).
|
||||||
|
`--platform`/`-p` option selects platform from `linux`,`osx`,`sunos`,`windows`.
|
||||||
|
`--language`/`-L` option selects preferred language for the page.
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
### Alfred Sonos Controller
|
||||||
|
|
||||||
|
https://github.com/karimkaylani/alfred-sonoscontroller
|
||||||
|
|
||||||
|
- `soco`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### alfred-wordpress-developer-workflow
|
||||||
|
|
||||||
|
https://github.com/keesiemeijer/alfred-wordpress-developer-workflow
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Sublime Text Projects Alfred Workflow
|
||||||
|
|
||||||
|
https://github.com/deanishe/alfred-sublime-text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### alfred_remote_IINA_Controller
|
||||||
|
|
||||||
|
https://github.com/qiujie8092916/alfred_remote_IINA_Controller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cheatsheet
|
||||||
|
|
||||||
|
https://github.com/mutdmour/alfred-workflow-cheatsheet
|
||||||
|
|
||||||
|
## alfred-amphetamine
|
||||||
|
|
||||||
|
https://github.com/demartini/alfred-amphetamine
|
||||||
|
|
||||||
|
### Alfred Browser Tabs
|
||||||
|
|
||||||
|
https://github.com/epilande/alfred-browser-tabs
|
||||||
|
|
||||||
|
### Joplin Noteplan Actions
|
||||||
|
|
||||||
|
https://github.com/beet/joplin_alfred_actions
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://pacmax.org
|
||||||
|
|
||||||
196
docs/Divers/bash/HereDoc.md
Normal file
196
docs/Divers/bash/HereDoc.md
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
# HereDoc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- **Commande** - Toute commande (chat, wc, courrier, etc.) qui accepte la redirection.
|
||||||
|
- **Opérateur de redirection (`<<`)** - L'opérateur par défaut pour HereDoc est `**<<**`. Il redirige le bloc de code vers la commande pour le traitement.
|
||||||
|
- **Delimiter Token** - The delimiter token denotes the start and end of the document (code block). The delimiter token can be anything but it should be identical. Typically you will see `EOF` is used as delimiter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher une chaîne multi-ligne avec HereDoc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat << EOF
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.EOF
|
||||||
|
heredoc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.EOF
|
||||||
|
heredoc
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Compter des lignes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wc -l << BLK
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.EOF
|
||||||
|
heredoc
|
||||||
|
BLK
|
||||||
|
|
||||||
|
5
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Redirection et pipe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat << EOF > /tmp/heredoc.txt
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
$ bat /tmp/heredoc.txt
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Suppression des Tab
|
||||||
|
|
||||||
|
Faire suivre l'opérateur de redirection par "-"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat <<- err_msg
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.
|
||||||
|
err_msg
|
||||||
|
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Expansion de variables et commandes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AUTHOR="OSTechNix"
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||||
|
Article: Bash Heredoc
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
Author: OSTechNix # USER DEFINED VARIABLE
|
||||||
|
Article: Bash Heredoc
|
||||||
|
I am using the /bin/zsh shell # ENV VARIABLE
|
||||||
|
bruno # EXTERNAL COMMAND
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer l'expansion (cat << 'EOF'):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AUTHOR="OSTechNix"
|
||||||
|
|
||||||
|
cat << 'EOF'
|
||||||
|
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||||
|
Article: Bash Heredoc
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
Author: ${AUTHOR} # USER DEFINED VARIABLE
|
||||||
|
Article: Bash Heredoc
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Commentaire multi-lignes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
: << 'COMMENTS'
|
||||||
|
Souvent, pour s’amuser, les hommes d’équipage
|
||||||
|
Prennent des albatros, vastes oiseaux des mers,
|
||||||
|
Qui suivent, indolents compagnons de voyage,
|
||||||
|
Le navire glissant sur les gouffres amers.
|
||||||
|
COMMENTS
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Echapper les caractères spéciaux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SINGLE QUOTES ESCAPE
|
||||||
|
cat << 'EOF'
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
|
||||||
|
# DOUBLE QUOTES ESCAPE
|
||||||
|
cat << "EOF"
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
|
||||||
|
# BACKSLASH ESCAPE
|
||||||
|
cat << \EOF
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
|
||||||
|
# BACKSLASH ESCAPE (one charactere)
|
||||||
|
cat << EOF
|
||||||
|
I am using the \${SHELL} shell # ENV VARIABLE
|
||||||
|
$(whoami) # EXTERNAL COMMAND
|
||||||
|
EOF
|
||||||
|
|
||||||
|
I am using the ${SHELL} shell # ENV VARIABLE
|
||||||
|
bruno # EXTERNAL COMMAND
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Exemples d'utilisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ssh -T user@host << EOF
|
||||||
|
Command 1...
|
||||||
|
Command 2..
|
||||||
|
.....
|
||||||
|
Command N..
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# add -T flag to ssh command which will disable pseudo-terminal allocation.
|
||||||
|
|
||||||
|
declare -a server=( host1 host2 host3 )
|
||||||
|
for host in ${server[@]}
|
||||||
|
do
|
||||||
|
ssh -T user@${host} << EOF
|
||||||
|
echo "Running at host - ${host}"
|
||||||
|
if [[ ! -f /home/ostechnix/test ]];then
|
||||||
|
touch /home/ostechnix/test
|
||||||
|
echo "File Created"
|
||||||
|
else
|
||||||
|
echo "File exists"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
106
docs/Divers/bash/basename.md
Normal file
106
docs/Divers/bash/basename.md
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# Basename
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### basename
|
||||||
|
|
||||||
|
Récupérer la dernière partie d'un chemin (nom du fichier):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
basename /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||||
|
|
||||||
|
ext-apcu.ini
|
||||||
|
```
|
||||||
|
Récupérer la dernière partie d'un chemin (dossier):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
basename /usr/local/etc/php/8.0/conf.d/
|
||||||
|
|
||||||
|
conf.d
|
||||||
|
```
|
||||||
|
|
||||||
|
Récupérer le nom de fichier sans l'extension
|
||||||
|
|
||||||
|
```bash
|
||||||
|
basename -s .ini /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||||
|
|
||||||
|
ext-apcu
|
||||||
|
```
|
||||||
|
|
||||||
|
Sur plusieurs chemins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
basename -a -s .ini /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||||
|
|
||||||
|
/usr/local/etc/php/7.3/conf.d/ext-ssh2.ini
|
||||||
|
ext-apcu
|
||||||
|
ext-ssh2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### dirname
|
||||||
|
|
||||||
|
Récupérer le chemin (sans le nom du fichier):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dirname /usr/local/etc/php/8.0/conf.d/ext-apcu.ini
|
||||||
|
|
||||||
|
/usr/local/etc/php/8.0/conf.d
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le chemin n'est pas indiqué:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/usr/local/etc/php/7.3/conf.d
|
||||||
|
dirname ext-apcu.ini
|
||||||
|
.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### $0
|
||||||
|
|
||||||
|
Récupérer le chemin du script courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano chemins.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash title="chemins.sh"
|
||||||
|
#!/usr/local/bin/bash
|
||||||
|
|
||||||
|
echo "Chemin du script: " $0
|
||||||
|
echo "Le script exécuté a comme basename `basename "$0"`, dirname `dirname "$0"`"
|
||||||
|
echo "Le répertoire courant est `pwd`"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash title="./chemins.sh"
|
||||||
|
Chemin du script: ./chemins.sh
|
||||||
|
Le script exécuté a comme basename chemins.sh, dirname .
|
||||||
|
Le répertoire courant est /Users/bruno/Documents/shell_scripts
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash title="/Users/bruno/Documents/shell_scripts/chemins.sh"
|
||||||
|
Chemin du script: /Users/bruno/Documents/shell_scripts/chemins.sh
|
||||||
|
Le script exécuté a comme basename chemins.sh, dirname /Users/bruno/Documents/shell_scripts
|
||||||
|
Le répertoire courant est /Users/bruno/Documents/shell_scripts
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### realpath
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fullPATH=$(realpath "$0")
|
||||||
|
|
||||||
|
echo "fullPATH: $fullPATH"
|
||||||
|
fullPATH: /Users/bruno/Documents/Scripts/bash/handbrake_for_plex.sh
|
||||||
|
```
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ajouter un préfixe à la ligne d'un fichier texte:
|
#### Ajouter un préfixe à la ligne d'un fichier texte:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew list | sed -e 's/^/brew install /' > brew-list.txt
|
brew list | sed -e 's/^/brew install /' > brew-list.txt
|
||||||
@@ -16,7 +16,7 @@ sed -e 's/$/suffix/'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Cherche tous les .jpg d'un répertoire et les effacer:
|
#### Cherche tous les .jpg d'un répertoire et les effacer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
find . -name '*jpg' -exec rm {} +
|
find . -name '*jpg' -exec rm {} +
|
||||||
@@ -24,14 +24,15 @@ find . -name '*jpg' -exec rm {} +
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Concaténer tous les .csv:
|
#### Concaténer tous les .csv:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
find . -type f -iname "*.csv" -exec cat {} \; > toutes.txt
|
find . -type f -iname "*.csv" -exec cat {} \; > toutes.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Couleurs dans le terminal:
|
|
||||||
|
#### Couleurs dans le terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export UNDERLINE=$(tput sgr 0 1)
|
export UNDERLINE=$(tput sgr 0 1)
|
||||||
@@ -61,7 +62,9 @@ for i in {0..255}; do echo "$(tput setaf $i)test"; done
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Supprimer récursivement tous les fichiers .DS_ST0RE:
|
|
||||||
|
|
||||||
|
#### Supprimer récursivement tous les fichiers .DS_ST0RE:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo find / -name ".DS_Store" -depth -exec rm {} \;
|
sudo find / -name ".DS_Store" -depth -exec rm {} \;
|
||||||
@@ -75,7 +78,9 @@ find . -name '*.DS_Store' -type f -delete
|
|||||||
find . -name '.DS_Store' -type f -print -exec rm -f {} +
|
find . -name '.DS_Store' -type f -print -exec rm -f {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
Commentaire multi-lignes:
|
|
||||||
|
|
||||||
|
#### Commentaire multi-lignes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
res1=$(gdate +%s.%N)
|
res1=$(gdate +%s.%N)
|
||||||
@@ -99,15 +104,23 @@ echo -e "\e[1;34m $dd $dh $dm $ds \e[0m"
|
|||||||
END_COMMENT
|
END_COMMENT
|
||||||
```
|
```
|
||||||
|
|
||||||
Créer une playlist .m3u:
|
```bash
|
||||||
|
: '
|
||||||
|
comment
|
||||||
|
'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Créer une playlist .m3u:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ~/Music/Shaka Ponk - Apelogies/CD1 master*
|
$ ~/Music/Shaka Ponk - Apelogies/CD1 master*
|
||||||
# Musepack(mpc) Monkey's Audio(ape) WavPack(wv) Apple alac(m4a)
|
# Musepack(mpc) Monkey's Audio(ape) WavPack(wv) Apple alac(m4a)
|
||||||
|
|
||||||
❯ printf "#EXTM3U\n" > playlist.m3u
|
printf "#EXTM3U\n" > playlist.m3u
|
||||||
|
|
||||||
❯ ls -1v | grep -E '.mp3|.mp4|.m4a|.aac|.alac|.flac|.ogg|.mpc|.ape|.wma|.wav' >> playlist.m3u
|
ls -1v | grep -E '.mp3|.mp4|.m4a|.aac|.alac|.flac|.ogg|.mpc|.ape|.wma|.wav' >> playlist.m3u
|
||||||
|
|
||||||
#EXTM3U
|
#EXTM3U
|
||||||
01. ————————THE GREATEST TITS.mp3
|
01. ————————THE GREATEST TITS.mp3
|
||||||
@@ -130,11 +143,35 @@ $ ~/Music/Shaka Ponk - Apelogies/CD1 master*
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ printf "#EXTM3U\n" > playlist.m3u
|
printf "#EXTM3U\n" > playlist.m3u
|
||||||
❯ find . -name '*.mp3' | sort >> playlist.m3u
|
find . -name '*.mp3' | sort >> playlist.m3u
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
for i in {1..5}; do printf "#EXTM3U\n" > ${i}star.m3u; find . -type f -exec grep -i -l --text "rating.$i" '{}' \; >> ${i}star.m3u; done
|
for i in {1..5}; do printf "#EXTM3U\n" > ${i}star.m3u; find . -type f -exec grep -i -l --text "rating.$i" '{}' \; >> ${i}star.m3u; done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Remplacer les espaces dans les noms de dossiers/fichiers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find ./thumsup -name "* *" -print0 | sort -rz | while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done
|
||||||
|
r
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Connaitre le nom du Terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ps -p $$ -o args,ppid
|
||||||
|
ARGS PPID
|
||||||
|
-zsh 705
|
||||||
|
|
||||||
|
$ ps -p 705 -o args # <- PPID
|
||||||
|
ARGS
|
||||||
|
/usr/bin/login -fqpl bruno /Applications/iTerm.app/Contents/MacO
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
96
docs/Divers/bash/certif.md
Normal file
96
docs/Divers/bash/certif.md
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -w %{certs} https://nextcloud.photos-nas.ovh/ --silent -o /dev/null | grep -Ei "^(start|expire) date:" | head -n 2
|
||||||
|
Start date:Jul 10 14:55:12 2024 GMT
|
||||||
|
Expire date:Oct 8 14:55:11 2024 GMT
|
||||||
|
|
||||||
|
# Issuer:C = US, O = Let's Encrypt, CN = R10
|
||||||
|
# X509v3 Subject Alternative Name:DNS:*.photos-nas.ovh, DNS:photos-nas.ovh
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl --insecure -vvI https://nextcloud.photos-nas.ovh 2>&1 | grep "expire date" | awk '{print $4,$5,$6,$7,$8,$9}'
|
||||||
|
Oct 8 14:55:11 2024 GMT
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ nmap -p 443 --script ssl-cert nextcloud.photos-nas.ovh
|
||||||
|
Starting Nmap 7.95 ( https://nmap.org ) at 2024-07-26 16:34 CEST
|
||||||
|
Nmap scan report for nextcloud.photos-nas.ovh (192.168.2.57)
|
||||||
|
Host is up (0.0030s latency).
|
||||||
|
rDNS record for 192.168.2.57: photos-nas.fr
|
||||||
|
|
||||||
|
PORT STATE SERVICE
|
||||||
|
443/tcp open https
|
||||||
|
| ssl-cert: Subject: commonName=photos-nas.ovh
|
||||||
|
| Subject Alternative Name: DNS:*.photos-nas.ovh, DNS:photos-nas.ovh
|
||||||
|
| Issuer: commonName=R10/organizationName=Let's Encrypt/countryName=US
|
||||||
|
| Public Key type: rsa
|
||||||
|
| Public Key bits: 4096
|
||||||
|
| Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
| Not valid before: 2024-07-10T14:55:12
|
||||||
|
| Not valid after: 2024-10-08T14:55:11
|
||||||
|
| MD5: 2051:3683:b6ef:060e:073b:58c9:ea6d:4c48
|
||||||
|
|_SHA-1: 4abc:421e:08eb:fd29:8c9e:5ed2:1510:422f:aea4:2100
|
||||||
|
|
||||||
|
Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ showcert nextcloud.photos-nas.ovh
|
||||||
|
IP: 192.168.2.57
|
||||||
|
Names: photos-nas.ovh *.photos-nas.ovh
|
||||||
|
notBefore: 2024-07-10 14:55:12 (16 days old)
|
||||||
|
notAfter: 2024-10-08 14:55:11 (73 days left)
|
||||||
|
Issuer: C=US O=Let's Encrypt CN=R10
|
||||||
|
Tags: [CHAIN-VERIFIED]
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo | openssl s_client -connect nextcloud.photos-nas.ovh:443 2>/dev/null | openssl x509 -noout -enddate
|
||||||
|
notAfter=Oct 8 14:55:11 2024 GMT
|
||||||
|
|
||||||
|
ssl_expiry () {
|
||||||
|
echo | openssl s_client -connect ${1}:443 2> /dev/null | openssl x509 -noout -enddate
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
❯ echo | openssl s_client -connect nextcloud.photos-nas.ovh:443 2>/dev/null | openssl x509 -noout -dates -issuer -subject
|
||||||
|
notBefore=Jul 10 14:55:12 2024 GMT
|
||||||
|
notAfter=Oct 8 14:55:11 2024 GMT
|
||||||
|
issuer=C=US, O=Let's Encrypt, CN=R10
|
||||||
|
subject=CN=photos-nas.ovh
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ keytool -printcert -sslserver nextcloud.photos-nas.ovh:443
|
||||||
|
The operation couldn’t be completed. Unable to locate a Java Runtime.
|
||||||
|
Please visit http://www.java.com for information on installing Java.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ openssl s_client -showcerts -connect nextcloud.photos-nas.ovh:443
|
||||||
|
Connecting to 192.168.2.57
|
||||||
|
CONNECTED(00000005)
|
||||||
|
depth=2 C=US, O=Internet Security Research Group, CN=ISRG Root X1
|
||||||
|
verify return:1
|
||||||
|
depth=1 C=US, O=Let's Encrypt, CN=R10
|
||||||
|
verify return:1
|
||||||
|
depth=0 CN=photos-nas.ovh
|
||||||
|
verify return:1
|
||||||
|
---
|
||||||
|
Certificate chain
|
||||||
|
0 s:CN=photos-nas.ovh
|
||||||
|
i:C=US, O=Let's Encrypt, CN=R10
|
||||||
|
a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
|
||||||
|
v:NotBefore: Jul 10 14:55:12 2024 GMT; NotAfter: Oct 8 14:55:11 2024 GMT
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
.../...
|
||||||
|
```
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ $ history
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Commandes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ history | grep 'chmod'
|
$ history | grep 'chmod'
|
||||||
250 sudo chmod -R 755 gallery/
|
250 sudo chmod -R 755 gallery/
|
||||||
@@ -49,6 +51,71 @@ $ history | grep 'chmod'
|
|||||||
526 history | grep 'chmod'
|
526 history | grep 'chmod'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Excécuter une commande de l'historique d'après son nombre (!#):
|
||||||
|
|
||||||
|
```bash title="!507"
|
||||||
|
$ !507
|
||||||
|
cd .ssh/
|
||||||
|
drwx------ 1 bruno users 124 Mar 15 19:23 .
|
||||||
|
drwxr-xr-x 1 bruno users 812 Mar 16 09:31 ..
|
||||||
|
-rw------- 1 bruno users 5325 Mar 31 2020 _authorized_keys.bak
|
||||||
|
-rw------- 1 bruno users 8200 Mar 11 14:30 authorized_keys
|
||||||
|
-rw------- 1 bruno users 3326 Nov 19 2019 id_rsa
|
||||||
|
-rw-r--r-- 1 bruno users 734 Nov 19 2019 id_rsa.pub
|
||||||
|
-rw-r--r-- 1 bruno users 550 Mar 15 11:00 known_hosts
|
||||||
|
bruno@DS916:~/.ssh $
|
||||||
|
```
|
||||||
|
|
||||||
|
Excécuter 2 commandes en arrière:
|
||||||
|
|
||||||
|
```bash title="!-2"
|
||||||
|
$ !-2
|
||||||
|
|
||||||
|
# 10 commandes en arrière
|
||||||
|
$ !-10
|
||||||
|
```
|
||||||
|
|
||||||
|
Ré-excécuter la dernière commande (!!):
|
||||||
|
|
||||||
|
```bash title="!!"
|
||||||
|
$ cat .npmrc
|
||||||
|
#prefix=/var/services/homes/bruno/.npm-packages
|
||||||
|
tmp=/tmp
|
||||||
|
|
||||||
|
$ !!
|
||||||
|
cat .npmrc
|
||||||
|
#prefix=/var/services/homes/bruno/.npm-packages
|
||||||
|
tmp=/tmp
|
||||||
|
|
||||||
|
# !! est équivalent à !-1
|
||||||
|
```
|
||||||
|
|
||||||
|
Relancer la dernière commande avec sudo comme préfixe:
|
||||||
|
|
||||||
|
```bash title="sudo !!"
|
||||||
|
$ nano /etc/fstab
|
||||||
|
|
||||||
|
$ sudo !!
|
||||||
|
sudo nano /etc/fstab
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Relancer la dernière commande avec 'keygen':
|
||||||
|
|
||||||
|
```bash title="!keygen"
|
||||||
|
$ !keygen
|
||||||
|
ssh-keygen -t rsa -b 1024
|
||||||
|
```
|
||||||
|
|
||||||
|
Rechercher la dernière commande avec 'keygen' sans l'exécuter:
|
||||||
|
|
||||||
|
```bash title="!keygen:p"
|
||||||
|
# on ajoute :p après
|
||||||
|
|
||||||
|
$ !keygen:p
|
||||||
|
ssh-keygen -t rsa -b 1024
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -73,7 +140,7 @@ $ history
|
|||||||
5039* 916e
|
5039* 916e
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Grep:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ history | grep mas
|
$ history | grep mas
|
||||||
@@ -86,3 +153,7 @@ $ history | grep mas
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Arguments:
|
||||||
|
|
||||||
|
|||||||
43
docs/Divers/bash/cryptage.md
Normal file
43
docs/Divers/bash/cryptage.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Cryptage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### openssl
|
||||||
|
|
||||||
|
#### Crypter un mot-de-passe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo 'rusty!herring.pitshaft' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:'sjkXF*4kX.@9mh-ut8y.'
|
||||||
|
|
||||||
|
U2FsdGVkX1/4rGXLZs9q1GJk7lQsE0gLNecO4BzPFmg9YfIyrn7QmdScn9Jb907G
|
||||||
|
|
||||||
|
echo 'rusty!herring.pitshaft' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:'sjkXF*4kX.@9mh-ut8y.' > .secret_vault.txt
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Décrypter un mot-de-passe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "U2FsdGVkX199dZHjA0wtjtt0OapR8EOpVwZ5mPqN3JJd40yhCS3fYYxEflQTXTwr" | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt -pass pass:'sjkXF*4kX.@9mh-ut8y.'
|
||||||
|
rusty!herring.pitshaft
|
||||||
|
|
||||||
|
cat .secret_vault.txt | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt -pass pass:'sjkXF*4kX.@9mh-ut8y.'
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "U2FsdGVkX199dZHjA0wtjtt0OapR8EOpVwZ5mPqN3JJd40yhCS3fYYxEflQTXTwr" | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt
|
||||||
|
enter AES-256-CBC decryption password:
|
||||||
|
rusty!herring.pitshaft
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Crypter un mot-de-passe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
39
docs/Divers/bash/getopts.md
Normal file
39
docs/Divers/bash/getopts.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# getopts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| getopts | getopt (BSD) | getopt (GNU) |
|
||||||
|
| ------------------ | -------------------------------- | ------------------------------------------------- |
|
||||||
|
| builtin Bash | bin: <br />/usr/bin/getopt<br /> | bin:<br />/opt/homebrew/opt/gnu-getopt/bin/getopt |
|
||||||
|
| option courte (-h) | | option longue (--help, -h) |
|
||||||
|
| - | | gère les flags vides |
|
||||||
|
| OPTIN et OPTARG | | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Syntaxe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
getopts optstring varname [arg ...]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### optstring:
|
||||||
|
|
||||||
|
- si une lettre est suivi par : , l'option attend un argument
|
||||||
|
- si optstring commence par : , la variable shell OPTARG est définie sur le caractère d'option trouvé, mais aucune sortie n'est écrite sur l'erreur standard ; sinon, la variable shell OPTARG n'est pas définie et un message de diagnostic est écrit sur l'erreur standart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# optstring "hf"
|
||||||
|
$ ./soco-cli-gui.sh -k
|
||||||
|
./soco-cli-gui.sh : option non permise -- k
|
||||||
|
Invalid option: -.
|
||||||
|
|
||||||
|
# optstring ":hf"
|
||||||
|
$ ./soco-cli-gui.sh -k
|
||||||
|
Invalid option: -k.
|
||||||
|
```
|
||||||
|
|
||||||
32
docs/Divers/bash/image.md
Normal file
32
docs/Divers/bash/image.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Afficher une image dans le terminal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### iTerm2
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\n\033]1337;File=;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||||
|
|
||||||
|
printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||||
|
```
|
||||||
|
|
||||||
|
https://iterm2.com/documentation-images.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### imgcat
|
||||||
|
|
||||||
|
https://github.com/olivere/iterm2-imagetools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
imgcat soco-cli-logo-01-large.png
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### jouer un son
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo -en "\007"
|
||||||
|
```
|
||||||
|
|
||||||
87
docs/Divers/bash/json.md
Normal file
87
docs/Divers/bash/json.md
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# json (jq)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"request_id": "9a081c0c-9401-7eca-f55d-50e3b7c0301c",
|
||||||
|
"lease_id": "",
|
||||||
|
"renewable": false,
|
||||||
|
"lease_duration": 2764800,
|
||||||
|
"data": {
|
||||||
|
"password": "test123",
|
||||||
|
"username": "testuser1"
|
||||||
|
},
|
||||||
|
"wrap_info": null,
|
||||||
|
"warnings": null,
|
||||||
|
"auth": null
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ jq '.data.password, .data.username' data.json
|
||||||
|
"test123"
|
||||||
|
"testuser1"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"langs": ["JavaScript", "Ruby"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ jq -r '.langs[]' languages.json
|
||||||
|
JavaScript
|
||||||
|
Ruby
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"italian" : {
|
||||||
|
"name" : [
|
||||||
|
"gatto",
|
||||||
|
"cane",
|
||||||
|
"pasta",
|
||||||
|
"telefono",
|
||||||
|
"libro"
|
||||||
|
],
|
||||||
|
"adjective" : [
|
||||||
|
"pesante",
|
||||||
|
"sottile",
|
||||||
|
"giallo",
|
||||||
|
"stretto"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"english" : {
|
||||||
|
"name" : [
|
||||||
|
"fish",
|
||||||
|
"book",
|
||||||
|
"guitar",
|
||||||
|
"piano"
|
||||||
|
],
|
||||||
|
"adjective" : [
|
||||||
|
"dirty",
|
||||||
|
"good",
|
||||||
|
"ugly",
|
||||||
|
"great"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ jq '.english.adjective[1]' file.js
|
||||||
|
good
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Loop
|
||||||
|
|
||||||
|
https://unix.stackexchange.com/questions/732602/create-a-json-using-bash-script
|
||||||
|
|
||||||
91
docs/Divers/bash/loop.md
Normal file
91
docs/Divers/bash/loop.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# Les boucles
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### For
|
||||||
|
|
||||||
|
```bash
|
||||||
|
array=('item1' 'item2' 'item3')
|
||||||
|
|
||||||
|
|
||||||
|
for i in "${array[@]}"
|
||||||
|
do
|
||||||
|
echo "$i"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fruits=('apple' 'banana' 'cherry')
|
||||||
|
colors=('red' 'yellow' 'red')
|
||||||
|
|
||||||
|
for i in "${!fruits[@]}"
|
||||||
|
do
|
||||||
|
echo "The ${fruits[$i]} is ${colors[$i]}"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
numbers=(1 2 3 4 5)
|
||||||
|
for num in "${numbers[@]}"
|
||||||
|
do
|
||||||
|
if ((num % 2 == 0))
|
||||||
|
then
|
||||||
|
echo "$num is even"
|
||||||
|
else
|
||||||
|
echo "$num is odd"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
declare -A fruits
|
||||||
|
fruits=( [apple]='red' [banana]='yellow' [cherry]='red' )
|
||||||
|
|
||||||
|
for fruit in "${!fruits[@]}"
|
||||||
|
do
|
||||||
|
echo "The $fruit is ${fruits[$fruit]}"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### While
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fruits=('apple' 'banana' 'cherry')
|
||||||
|
index=0
|
||||||
|
|
||||||
|
while [ $index -lt ${#fruits[@]} ]
|
||||||
|
do
|
||||||
|
echo "I like ${fruits[$index]}"
|
||||||
|
((index++))
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Until
|
||||||
|
|
||||||
|
```bash
|
||||||
|
numbers=(1 2 3 4 5)
|
||||||
|
index=0
|
||||||
|
|
||||||
|
until [ $index -eq ${#numbers[@]} ]
|
||||||
|
do
|
||||||
|
echo "Processing number: ${numbers[$index]}"
|
||||||
|
((index++))
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### mapfile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mapfile -t lines < file.txt
|
||||||
|
for line in "${lines[@]}"
|
||||||
|
do
|
||||||
|
echo "Processing line: $line"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
91
docs/Divers/bash/mail_from_commandline.md
Normal file
91
docs/Divers/bash/mail_from_commandline.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# Send mail from command line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### ssmtp
|
||||||
|
|
||||||
|
Fichier de configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano /etc/ssmtp/ssmtp.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
UseTTLS=YES
|
||||||
|
root=bruno@clicclac.info
|
||||||
|
mailhub=smtp.ovh.net:465
|
||||||
|
AuthUser=bruno@clicclac.info
|
||||||
|
AuthPass=xxxxxxxxxxxxxxx
|
||||||
|
FromLineOverride=YES
|
||||||
|
```
|
||||||
|
|
||||||
|
Email:
|
||||||
|
|
||||||
|
```
|
||||||
|
From: router@clicclac.info
|
||||||
|
To: bruno@clicclac.info
|
||||||
|
Subject: Sent from a terminal!
|
||||||
|
|
||||||
|
Your content goes here. Lorem ipsum dolor sit amet, consectetur adipisicing.
|
||||||
|
(Notice the blank space between the subject and the body.)
|
||||||
|
```
|
||||||
|
|
||||||
|
Envoyer l'email:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssmtp bruno@clicclac.info < email.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### msmtp
|
||||||
|
|
||||||
|
Fichier de configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano ~/.msmtprc
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
defaults
|
||||||
|
tls on
|
||||||
|
tls_starttls off
|
||||||
|
logfile ~/.msmtp.log
|
||||||
|
|
||||||
|
account router
|
||||||
|
host ssl0.ovh.net
|
||||||
|
port 465
|
||||||
|
protocol smtp
|
||||||
|
from router@clicclac.info
|
||||||
|
from_full_name DS923
|
||||||
|
auth on
|
||||||
|
user router@clicclac.info
|
||||||
|
#passwordeval gpg --no-tty -q -d ~/.msmtp-password.gpg
|
||||||
|
password xxxxxxxxxxxxxxxxxxx
|
||||||
|
|
||||||
|
account default : router
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod 600 ~/.msmtprc
|
||||||
|
```
|
||||||
|
|
||||||
|
Email:
|
||||||
|
|
||||||
|
```
|
||||||
|
From: router@clicclac.info
|
||||||
|
To: bruno@clicclac.info
|
||||||
|
Subject: Sent from a terminal!
|
||||||
|
|
||||||
|
Your content goes here. Lorem ipsum dolor sit amet, consectetur adipisicing.
|
||||||
|
(Notice the blank space between the subject and the body.)
|
||||||
|
```
|
||||||
|
|
||||||
|
Envoyer l'email:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
msmtp -d -t < email.txt
|
||||||
|
```
|
||||||
|
|
||||||
45
docs/Divers/bash/passwords.md
Normal file
45
docs/Divers/bash/passwords.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Passwords
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Stocker un mot-de-passe, un token dans la Keychain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ security add-generic-password -s gh_access_tokens -a bruno -w github_pat_xxyyzz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Récupérer le mot-de-pass depuius la keychain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ security find-generic-password -w -s gh_access_tokens
|
||||||
|
github_pat_xxyyzz
|
||||||
|
|
||||||
|
$ gh_access_tokens=$(security find-generic-password -w -s gh_access_tokens)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Supprimer un mot-de-passe, un token dans la Keychain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ security delete-generic-password -s gh_access_tokens -a bruno
|
||||||
|
keychain: "/Users/bruno/Library/Keychains/login.keychain-db"
|
||||||
|
.../...
|
||||||
|
password has been deleted.
|
||||||
|
```
|
||||||
|
|
||||||
|
https://scriptingosx.com/2021/04/get-password-from-keychain-in-shell-scripts/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ security unlock-keychain -p API_KEYCHAIN_PASS KEYCHAINPATH
|
||||||
|
|
||||||
|
# API_KEYCHAIN_PASS : mot de passe de session
|
||||||
|
# KEYCHAINPATH : login.keychain, /Library/Keychains/System.keychain, ~/Library/Keychains/login.keychain
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ security lock-keychain KEYCHAINPATH
|
||||||
|
```
|
||||||
|
|
||||||
113
docs/Divers/bash/printf.md
Normal file
113
docs/Divers/bash/printf.md
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# printf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| Character | Usage |
|
||||||
|
| --------- | -------------------------------------------------------- |
|
||||||
|
| %s | String |
|
||||||
|
| %c | Single character |
|
||||||
|
| %d | Integers |
|
||||||
|
| %o | Octal integers |
|
||||||
|
| %u | unsigned integer |
|
||||||
|
| %x | Hexadecimal integers (minuscule) |
|
||||||
|
| %X | Hexadecimal integers (majuscule) |
|
||||||
|
| %f | Floating point |
|
||||||
|
| %e | floating point number in scientific notation (minuscule) |
|
||||||
|
| %E | floating point number in scientific notation (majuscule) |
|
||||||
|
| %b | String with backslash escape character |
|
||||||
|
| %% | Percent sign |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\t %3s %-40s \n" "${index}." "${track}"
|
||||||
|
|
||||||
|
# tab
|
||||||
|
# chaine de 3 caractères alignés à droite
|
||||||
|
# chaine de 40 caractères alignés à gauche
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
9. Party!
|
||||||
|
10. Shooters
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Modificateur de précision:
|
||||||
|
|
||||||
|
. (point) suivi d'un nombre spécifie le nombre de chiffres à afficher.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ printf "Number: %.5d\n" 23
|
||||||
|
|
||||||
|
Number: 00023
|
||||||
|
```
|
||||||
|
|
||||||
|
avec une chaine:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "Nom: %.7s\n" Terminator
|
||||||
|
Nom: Termina
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher une ligne de tiret:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "%80s\n" " " | tr ' ' '-'
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher une chaine avec des accents:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
title="France Inter 95.9 (Émissions-débats France)"
|
||||||
|
|
||||||
|
# https://unix.stackexchange.com/questions/609125/padding-unicode-strings-with-bashs-printf
|
||||||
|
bytes=$(printf '%s' "$title" | wc -c)
|
||||||
|
chars=$(printf '%s' "$title" | wc -m)
|
||||||
|
n=$((50+bytes-chars))
|
||||||
|
|
||||||
|
printf '%-${n}s' "${title}"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher une chaine en couleur
|
||||||
|
|
||||||
|
```bash
|
||||||
|
red="\033[1;31m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
|
printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}"
|
||||||
|
|
||||||
|
# %b ARGUMENT as a string with '\' escapes interpreted, except that octal
|
||||||
|
# escapes are of the form \0 or \0NNN
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Séparateur de millier ( ' )
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LC_ALL=en_US.UTF-8 printf "| %-15s | %-4s | %'9.2f | %'9.2f | %'14d \n" "$name" "$symbol" "$price" "$price2" "$volume_24h"
|
||||||
|
|
||||||
|
| Bitcoin | BTC | 94,289.45 | 97,788.72 | 50,548,740,838 |
|
||||||
|
|
||||||
|
|
||||||
|
LC_ALL=fr_FR.UTF-8 printf "| %-15s | %-4s | %'9.2f | %'9.2f | %'14d \n" "$name" "$symbol" "$price" "$price2" "$volume_24h"
|
||||||
|
|
||||||
|
| Bitcoin | BTC | 94405,00 | 97909,00 | 50580369313 |
|
||||||
|
|
||||||
|
printf "| %-15s | %-4s | %'9.2f | %'9.2f | %'14d \n" "$name" "$symbol" "$price" "$price2" "$volume_24h"
|
||||||
|
|
||||||
|
| Bitcoin | BTC | 94348.51 | 97837.60 | 50613422301 |
|
||||||
|
```
|
||||||
|
|
||||||
|
https://stackoverflow.com/questions/9374868/number-formatting-in-bash-with-thousand-separator
|
||||||
@@ -2,28 +2,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Variables:
|
|
||||||
|
|
||||||
##### Incrémenter une variable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
i=$((i+1)) user 0m0.992s
|
|
||||||
i=$((i++)) user 0m0.964s
|
|
||||||
((i=i+1)) user 0m0.760s
|
|
||||||
((i+=1)) user 0m0.700s
|
|
||||||
((i++)) user 0m0.644s
|
|
||||||
((++i)) user 0m0.556s
|
|
||||||
let "i=i+1" user 0m1.116s
|
|
||||||
let "i+=1" user 0m1.100s
|
|
||||||
let "i++" user 0m1.008s
|
|
||||||
let i=i+1 user 0m0.952s
|
|
||||||
let i+=1 user 0m1.040s
|
|
||||||
let i++ user 0m0.820s
|
|
||||||
declare -i i; i=i+1 user 0m0.528s
|
|
||||||
declare -i i; i+=1 user 0m0.492s
|
|
||||||
i=0; i=$(expr $i + 1) user 0m5.464s
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Beep:
|
#### Beep:
|
||||||
@@ -135,3 +113,26 @@ status=$?
|
|||||||
if [ $status -ne 0 ]; then
|
if [ $status -ne 0 ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Nombres de lignes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# grep
|
||||||
|
nb=$(echo -n "$albums" | grep -c '^')
|
||||||
|
|
||||||
|
#awk
|
||||||
|
nb=$(awk 'END { print NR }' <<< "$albums")
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Convertir un script bash en application macOS:
|
||||||
|
|
||||||
|
[mac-appify](https://pypi.org/project/mac-appify/)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ appify script.sh name.app
|
||||||
|
$ appify script.sh name.app Icon.png
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
47
docs/Divers/bash/rematch.md
Normal file
47
docs/Divers/bash/rematch.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Regular Expression Matching (REMATCH)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
http://molk.ch/tips/gnu/bash/rematch.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
FILE="/Users/bruno/Downloads/Better.Call.Saul.S06E07.FRENCH.LD.AMZN.WEB-DL.x264-FRATERNiTY.mkv"
|
||||||
|
|
||||||
|
# Extension video file
|
||||||
|
DEST_EXT=mp4
|
||||||
|
|
||||||
|
filename=$(basename "$FILE")
|
||||||
|
filename=${filename%.*}
|
||||||
|
|
||||||
|
# Series: SxxEyy
|
||||||
|
REGEX="([sS]([0-9]{2,}|[X]{2,})[eE]([0-9]{2,}|[Y]{2,}))"
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $filename =~ $REGEX ]]; then
|
||||||
|
MATCH0="${BASH_REMATCH[0]}"
|
||||||
|
echo "$MATCH0" # S06E07
|
||||||
|
|
||||||
|
MATCH1="${BASH_REMATCH[1]}"
|
||||||
|
echo "$MATCH1" # S06E07
|
||||||
|
|
||||||
|
MATCH2="${BASH_REMATCH[2]}"
|
||||||
|
echo "$MATCH2" # 06
|
||||||
|
|
||||||
|
MATCH3="${BASH_REMATCH[3]}"
|
||||||
|
echo "$MATCH3" # 07
|
||||||
|
|
||||||
|
e=$(echo ${filename%$MATCH0*} | sed 's/\./\ /g' | xargs)
|
||||||
|
echo "$e" # Better Call Saul
|
||||||
|
|
||||||
|
new_name="$e - $MATCH0.$DEST_EXT"
|
||||||
|
echo "$new_name" # Better Call Saul - S06E07.
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "no match"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
@@ -2,15 +2,32 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Concaténer une chaine:
|
### Concaténer une chaine:
|
||||||
|
|
||||||
|
##### Opérateur +=
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
upd+="$name "
|
string="Hello, "
|
||||||
|
string+="World"
|
||||||
|
|
||||||
|
echo "$string"
|
||||||
|
Hello, World
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Les chaines côte à côte:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
string1="Hello, "
|
||||||
|
string2="World"
|
||||||
|
string3="$string1$string2"
|
||||||
|
|
||||||
|
echo "$string3"
|
||||||
|
Hello, World
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Trim une chaine:
|
### Trim une chaine:
|
||||||
|
|
||||||
1. sed
|
1. sed
|
||||||
|
|
||||||
@@ -75,9 +92,19 @@ $ echo " Une chaine entourée d'espaces " | xargs -0
|
|||||||
Une chaine entourée d'espaces
|
Une chaine entourée d'espaces
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trim () {
|
||||||
|
read -rd '' $1 <<<"${!1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
trim foo
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Longueur d'une chaine:
|
|
||||||
|
### Longueur d'une chaine:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ echo -n "Longueur de la chaine:" | wc -c
|
$ echo -n "Longueur de la chaine:" | wc -c
|
||||||
@@ -93,7 +120,9 @@ $ echo ${#var}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Sous-chaine:
|
### Sous-chaine:
|
||||||
|
|
||||||
|
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ string=abcABC123ABCabc
|
$ string=abcABC123ABCabc
|
||||||
@@ -113,12 +142,20 @@ $ echo ${string:7}
|
|||||||
$ echo ${string:7:3}
|
$ echo ${string:7:3}
|
||||||
23A
|
23A
|
||||||
|
|
||||||
# Obtenir les 2 premieres caractères:
|
# Obtenir les 2 premiers caractères:
|
||||||
$ echo ${string:0:2}
|
$ echo ${string:0:2}
|
||||||
ab
|
ab
|
||||||
echo "$string" | awk '{print substr($0,0,2)}'
|
echo "$string" | awk '{print substr($0,0,2)}'
|
||||||
ab
|
ab
|
||||||
|
|
||||||
|
# Supprimer le dernier caractère:
|
||||||
|
$ echo ${string:0:-1}
|
||||||
|
abcABC123ABCab
|
||||||
|
|
||||||
|
# Remplacer certains caractères par un autre:
|
||||||
|
$ echo ${string//[ABC]/:}
|
||||||
|
abc:::123:::abc
|
||||||
|
|
||||||
# Obtenir les 4 derniers caractères:
|
# Obtenir les 4 derniers caractères:
|
||||||
$ echo ${stringZ: -4} # Notez l'espace
|
$ echo ${stringZ: -4} # Notez l'espace
|
||||||
Cabc
|
Cabc
|
||||||
@@ -135,9 +172,45 @@ extension="${filename##*.}"
|
|||||||
filename="${filename%.*}"
|
filename="${filename%.*}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Sous-chaine entre 2 caractères ()
|
||||||
|
|
||||||
|
```bash
|
||||||
|
a="not_required=('drive' 'files' 'gitea' 'home-assistant' 'homebridge' 'portainer' 'tunes' 'wg' 'www')"
|
||||||
|
|
||||||
|
z=$(echo "$a" | awk -F"=" '{split($2, arr, "[()]"); print arr[2]}')
|
||||||
|
|
||||||
|
echo "$z"
|
||||||
|
'drive' 'files' 'gitea' 'home-assistant' 'homebridge' 'portainer' 'tunes' 'wg' 'www'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Entre 2 "" (quotes)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
z=$(echo "$a" | awk -F'"' '{print $2}')
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Extraire une sous-chaine par un délimiteur
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ string="Portez ce vieux whisky au juge blond qui fume"
|
||||||
|
|
||||||
|
|
||||||
#### Remplacement de sous-chaine:
|
# Supprime tout jusqu'à la 1ere occurence de ' '
|
||||||
|
$ echo "${string#* }"
|
||||||
|
ce vieux whisky au juge blond qui fume
|
||||||
|
|
||||||
|
# Supprime tout jusqu'à la dernière occurence de ' '
|
||||||
|
$ echo "${string##* }"
|
||||||
|
fume
|
||||||
|
|
||||||
|
# Supprime tout après la dernière occurence de ' '
|
||||||
|
echo ${string%' '*}
|
||||||
|
Portez ce vieux whisky au juge blond qui
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Remplacement de sous-chaine:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ string=abcABC123ABCabc
|
$ string=abcABC123ABCabc
|
||||||
@@ -166,7 +239,7 @@ ABC123ABC
|
|||||||
|
|
||||||
http://tldp.org/LDP/abs/html/string-manipulation.html
|
http://tldp.org/LDP/abs/html/string-manipulation.html
|
||||||
|
|
||||||
#### Majuscule / Capitalize:
|
### Majuscule / Capitalize:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
string=bonjour
|
string=bonjour
|
||||||
@@ -181,13 +254,51 @@ echo ${string^^}
|
|||||||
BONJOUR
|
BONJOUR
|
||||||
|
|
||||||
echo $string | tr '[:lower:]' '[:upper:]'
|
echo $string | tr '[:lower:]' '[:upper:]'
|
||||||
|
echo $string | awk '{print toupper($0)}'
|
||||||
echo $string | tr '[a-z]' '[A-Z]'
|
echo $string | tr '[a-z]' '[A-Z]'
|
||||||
BONJOUR
|
BONJOUR
|
||||||
|
|
||||||
|
|
||||||
|
string=HelLo
|
||||||
|
|
||||||
|
# 1ere lettre en minuscule (Bash 4)
|
||||||
|
echo ${string,}
|
||||||
|
helLo
|
||||||
|
|
||||||
|
# Met en minuscule toute la chaine
|
||||||
|
echo ${string,,}
|
||||||
|
hello
|
||||||
|
|
||||||
|
echo $string | awk '{print tolower($0)}'
|
||||||
|
echo $string | tr '[:upper:]' '[:lower:]'
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
phrase="bonjour tout le monde"
|
||||||
|
|
||||||
|
# Capitalise tous les mots (1)
|
||||||
|
B=( $phrase )
|
||||||
|
caps="${B[@]^}"
|
||||||
|
echo "$caps"
|
||||||
|
Bonjour Tout Le Monde
|
||||||
|
|
||||||
|
# Capitalise tous les mots (2)
|
||||||
|
for i in $phrase; do B=`echo "${i:0:1}" | tr a-z A-Z`${i:1}; caps+="$B "; done
|
||||||
|
echo "$caps"
|
||||||
|
Bonjour Tout Le Monde
|
||||||
|
|
||||||
|
# Capitalise tous les mots (3)
|
||||||
|
caps=$(echo "${phrase}" | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
|
||||||
|
echo "$caps"
|
||||||
|
Bonjour Tout Le Monde
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Parcourrir une variable multi-ligne:
|
### Parcourrir une variable multi-ligne:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dependencies=$(echo "CairoSVG,setuptools" | xargs pipdeptree -r -p )
|
dependencies=$(echo "CairoSVG,setuptools" | xargs pipdeptree -r -p )
|
||||||
@@ -204,18 +315,34 @@ done <<< "$dependencies"
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Variable multi-line -> une ligne avec espaces
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ c=$(cat ~/.cryptos.yaml | yq '.lots[] | select(.quantity != 0) | .symbol')
|
||||||
|
BTC
|
||||||
|
ETH
|
||||||
|
|
||||||
|
$ c=$(cat ~/.cryptos.yaml | yq '.lots[] | select(.quantity != 0) | .symbol' | tr '\n' ' ')
|
||||||
|
BTC ETH
|
||||||
|
|
||||||
|
$ c=$(cat ~/.cryptos.yaml | yq '.lots[] | select(.quantity != 0) | .symbol' | tr -d '\n')
|
||||||
|
BTCETH
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Regex:
|
#### Regex:
|
||||||
|
|
||||||
[[ STRING =~ REGEX ]]
|
[[ STRING =~ REGEX ]]
|
||||||
|
|
||||||
|
[Regular Expression Matching](rematch.md)
|
||||||
|
|
||||||
Chaine commençant par:
|
Chaine commençant par:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# String est une url ?
|
# String est une url ?
|
||||||
|
|
||||||
if [[ $string =~ ^http ]]
|
if [[ $string =~ ^http ]]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Chaine se terminant par:
|
Chaine se terminant par:
|
||||||
@@ -223,7 +350,7 @@ Chaine se terminant par:
|
|||||||
```bash
|
```bash
|
||||||
# String est un fichier .mp3 ?
|
# String est un fichier .mp3 ?
|
||||||
|
|
||||||
if [[ $string =~ .mp3$ ]]
|
if [[ $string =~ .mp3$ ]]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Adresse IP:
|
Adresse IP:
|
||||||
@@ -238,3 +365,431 @@ Email:
|
|||||||
if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
|
if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Rechercher une sous-chaine
|
||||||
|
|
||||||
|
```bash
|
||||||
|
name=testjohntext
|
||||||
|
|
||||||
|
if [[ "$name" == *john* ]]; then
|
||||||
|
echo "The string \"john\" was found in the variable \$name"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "$name" == *john* ]] && echo "The string \"john\" was found in the variable \$name"
|
||||||
|
The string "john" was found in the variable $name
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Regex
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mytest="The quick brown fox"
|
||||||
|
|
||||||
|
[[ "$mytest" =~ The..uick.b..w* ]] && echo "We found a match"
|
||||||
|
We found a match
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### IFS (internet field separator)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ old_IFS=$IFS
|
||||||
|
|
||||||
|
$ IFS=-
|
||||||
|
|
||||||
|
$ read day month year
|
||||||
|
25-12-2013
|
||||||
|
|
||||||
|
$ echo $day
|
||||||
|
25
|
||||||
|
|
||||||
|
$ echo $month
|
||||||
|
12
|
||||||
|
|
||||||
|
$ echo $year
|
||||||
|
2013
|
||||||
|
$ IFS=old_IFS
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ reg=("Bourgogne" "Burgundy" "Bourgogne Franche-Comté" "Côte d'or" "cotedor")
|
||||||
|
|
||||||
|
$ echo "$reg"
|
||||||
|
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||||
|
|
||||||
|
|
||||||
|
$ t=${reg[@]}
|
||||||
|
|
||||||
|
$ echo "$t"
|
||||||
|
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||||
|
|
||||||
|
|
||||||
|
# ${A[@]} is essentially the same as ${A[*]}, differing only when they are in double quotes. When double quoted, * uses the first character of IFS as the separator.
|
||||||
|
|
||||||
|
$ t=${reg[*]}
|
||||||
|
|
||||||
|
$ echo "$t"
|
||||||
|
Bourgogne Burgundy Bourgogne Franche-Comté Côte d'or cotedor
|
||||||
|
|
||||||
|
|
||||||
|
$ t=${reg[@]}
|
||||||
|
|
||||||
|
$ S=${t// /}
|
||||||
|
|
||||||
|
$ echo "$S"
|
||||||
|
BourgogneBurgundyBourgogneFranche-ComtéCôted'orcotedor
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### URL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ myurl='http://www.example.com/long/path/to/example/file.ext'
|
||||||
|
|
||||||
|
$ echo ${myurl##*/}
|
||||||
|
file.ext
|
||||||
|
|
||||||
|
awk -F / '{print $NF}'
|
||||||
|
|
||||||
|
$ echo ${myurl#*//}
|
||||||
|
www.example.com/long/path/to/example/file.ext
|
||||||
|
|
||||||
|
$ echo ${myurl%/*}
|
||||||
|
http://www.example.com/long/path/to/example
|
||||||
|
|
||||||
|
$ echo "$myurl" | grep -Eo '^http[s]?://[^/]+'
|
||||||
|
http://www.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| **Parameter Expansion** | **Description** |
|
||||||
|
| --------------------------- | ------------------------------------------------------------ |
|
||||||
|
| ${variable:-value} | Si la variable est <u>unset</u> ou <u>undefined</u>, développez la **valeur**. |
|
||||||
|
| ${variable:=value} | Si la variable est <u>unset</u> ou <u>undefined</u>, définissez la **valeur** sur la variable. |
|
||||||
|
| ${variable:+value} | Si la variable est <u>set</u> ou <u>defined</u>, développez la **valeur**. |
|
||||||
|
| ${variable:?value} | Si la variable est <u>unset</u> ou <u>undefined</u>, le développement de mot (ou un message à cet effet si mot n'est pas présent) est <u>écrit dans l'erreur standard</u> et le shell, s'il n'est pas interactif, se termine. Sinon, la valeur du paramètre est remplacée. |
|
||||||
|
| ${#variable} | <u>Longueur</u> de la variable.<br />Pour un tableau, le nombre d'éléments |
|
||||||
|
| ${variable/#pattern/string} | Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne. |
|
||||||
|
| ${variable/%pattern/string} | Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| | **Rechercher / remplacer** |
|
||||||
|
| --------------------------- | ------------------------------------------------------------ |
|
||||||
|
| ${variable/pattern/string} | Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois. |
|
||||||
|
| ${variable//pattern/string} | Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent. |
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| | **Sous-chaines** |
|
||||||
|
| --------------------------- | ------------------------------------------------------------ |
|
||||||
|
| ${variable:start:length} | La sous-chaîne récupérera de la position de <u>départ</u> à la position de <u>longueur</u> de la variable. |
|
||||||
|
| ${variable:(-start):length} | idem en partant de la fin |
|
||||||
|
| ${variable:start} | La sous-chaîne récupérera de la position de <u>départ</u> à la partie restante de la variable. |
|
||||||
|
| ${variable:(-start)} | idem en partant de la fin |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| | **Suppression de sous-chaines** |
|
||||||
|
| -------------------- | ------------------------------------------------------------ |
|
||||||
|
| ${variable#pattern} | Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond.<br /><br />Remove the shortest match from the beginning of the variable where the pattern matches. |
|
||||||
|
| ${variable##pattern} | Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond. |
|
||||||
|
| ${variable%pattern} | Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond. |
|
||||||
|
| ${variable%%pattern} | Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| | **Changement de case** |
|
||||||
|
| ------------- | ------------------------------- |
|
||||||
|
| ${variable^} | Met la 1ere lettre en majuscule |
|
||||||
|
| ${variable^^} | Met tout le mot en majuscule |
|
||||||
|
| ${variable,} | Met la 1ere lettre en minuscule |
|
||||||
|
| ${variable,,} | Met tout le mot en minuscule |
|
||||||
|
| ${variable~} | Inverse la 1ere lettre |
|
||||||
|
| ${variable~~} | Inverse tout le mot |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:-value}**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# si la variable est unset ou undefined, développez la valeur:
|
||||||
|
|
||||||
|
# 1. myvar n'est pas définie
|
||||||
|
$ echo "${myvar:-bash}"
|
||||||
|
bash
|
||||||
|
|
||||||
|
$ echo $myvar
|
||||||
|
|
||||||
|
|
||||||
|
# 2. myvar est définie
|
||||||
|
$ myvar=3
|
||||||
|
$ echo "${myvar:-bash}"
|
||||||
|
3
|
||||||
|
|
||||||
|
$ echo $myvar
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:=value}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Si la variable est unset ou undefined, définissez la valeur sur la variable:
|
||||||
|
|
||||||
|
# 1. myvar n'est pas définie
|
||||||
|
$ echo "${myvar:=bash}"
|
||||||
|
bash
|
||||||
|
|
||||||
|
$ echo $myvar
|
||||||
|
bash
|
||||||
|
|
||||||
|
# 2. myvar est définie
|
||||||
|
$ myvar=zsh
|
||||||
|
$ echo "${myvar:=bash}"
|
||||||
|
zsh
|
||||||
|
|
||||||
|
$ echo $myvar
|
||||||
|
zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:+value}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Si la variable est set ou defined, développez la valeur:
|
||||||
|
|
||||||
|
# 1. myvar n'est pas définie
|
||||||
|
$ echo "${myvar:+python}"
|
||||||
|
|
||||||
|
|
||||||
|
# 2. myvar est définie
|
||||||
|
$ myvar=zsh
|
||||||
|
$ echo "${myvar:+python}"
|
||||||
|
python
|
||||||
|
|
||||||
|
$ echo $myvar
|
||||||
|
zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:?value}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
# 1. myvar n'est pas définie
|
||||||
|
$ echo "${myvar:?bash}"
|
||||||
|
bash: myvar: bash
|
||||||
|
|
||||||
|
# 2. myvar est définie
|
||||||
|
$ myvar=zsh
|
||||||
|
$ echo "${myvar:?bash}"
|
||||||
|
zsh
|
||||||
|
|
||||||
|
$ echo $myvarzsh
|
||||||
|
zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:start:length}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# La sous-chaîne récupérera de la position de départ à la position de longueur de la variable.
|
||||||
|
|
||||||
|
$ myvar="La sous-chaîne récupérera de la position de départ à la position de longueur de la variable."
|
||||||
|
|
||||||
|
$ echo "${myvar:15:35}"
|
||||||
|
récupérera de la position de départ
|
||||||
|
|
||||||
|
$ echo "${myvar:(-15):35}" # Séparer l'offset des : avec les parenthèses ()
|
||||||
|
de la variable.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable:start}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# La sous-chaîne récupérera de la position de départ à la partie restante de la variable.
|
||||||
|
|
||||||
|
$ myvar="La sous-chaîne récupérera de la position de départ à la partie restante de la variable."
|
||||||
|
|
||||||
|
$ echo "${myvar:15}"
|
||||||
|
récupérera de la position de départ à la partie restante de la variable.
|
||||||
|
|
||||||
|
$ echo "${myvar:(-15)}" # Séparer l'offset des : avec les parenthèses ()
|
||||||
|
de la variable.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${\#variable}** **${\#array}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Longueur de la variable.
|
||||||
|
|
||||||
|
$ myvar="Longueur de la variable."
|
||||||
|
$ echo "${#myvar}"
|
||||||
|
24
|
||||||
|
|
||||||
|
$ array=("name" "word")
|
||||||
|
$ echo "${#array}"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable/pattern/string}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois.
|
||||||
|
|
||||||
|
$ myvar="Remplacez la partie de la variable par une chaîne où le modèle correspond pour la première fois."
|
||||||
|
$ echo "${myvar/la/the}"
|
||||||
|
Rempthecez la partie de la variable par une chaîne où le modèle correspond pour la première fois.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable//pattern/string}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent.
|
||||||
|
|
||||||
|
$ myvar="Remplacez toutes les occurrences de la variable par une chaîne où tous les modèles correspondent."
|
||||||
|
$ echo "${myvar//les/the}"
|
||||||
|
Remplacez toutes the occurrences de la variable par une chaîne où tous the modèthe correspondent.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable/#pattern/string}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne.
|
||||||
|
|
||||||
|
$ myvar="Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne"
|
||||||
|
$ echo "${myvar/#les/If}"
|
||||||
|
Si le modèle existe au début de la variable, remplacez l'occurrence par une chaîne
|
||||||
|
|
||||||
|
$ echo "${myvar/#Si/If}"
|
||||||
|
If le modèle existe au début de la variable, remplacez l'occurrence par une chaîne
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable/%pattern/string}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne.
|
||||||
|
|
||||||
|
$ myvar="Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne."
|
||||||
|
|
||||||
|
$ echo "${myvar/%chaine./laisse.}" # i
|
||||||
|
Si le modèle existe à la fin de la variable, remplacez l'occurrence par une chaîne.
|
||||||
|
|
||||||
|
$ echo "${myvar/%chaîne/laisse}" # î
|
||||||
|
Si le modèle existe à la fin de la variable, remplacez l'occurrence par une laisse
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable#pattern}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond.
|
||||||
|
# Remove the shortest match from the beginning of the variable where the pattern matches.
|
||||||
|
|
||||||
|
$ myvar="Supprimez la correspondance la plus courte depuis le début de la variable où le modèle correspond."
|
||||||
|
|
||||||
|
$ echo "${myvar#*la}" # du début au 1er la
|
||||||
|
correspondance la plus courte depuis le début de la variable où le modèle correspond.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable##pattern}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond.
|
||||||
|
|
||||||
|
$ myvar="Supprimez la correspondance la plus longue depuis le début de la variable où le modèle correspond."
|
||||||
|
|
||||||
|
$ echo "${myvar##*la}" # du début au dernier la
|
||||||
|
variable où le modèle correspond.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable%pattern}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond.
|
||||||
|
|
||||||
|
$ myvar="Supprimez la correspondance la plus courte à partir de la fin de la variable où le modèle correspond."
|
||||||
|
|
||||||
|
$ echo "${myvar%la*}"
|
||||||
|
Supprimez la correspondance la plus courte à partir de la fin de
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **${variable%%pattern}**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond.
|
||||||
|
|
||||||
|
$ myvar="Supprimez la correspondance la plus longue à partir de la fin de la variable où le modèle correspond."
|
||||||
|
|
||||||
|
$ echo "${myvar%%la*}"
|
||||||
|
Supprimez
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### **Exemples avec les chemins / fichiers:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ PATHNAME=/Users/bruno/Pictures/Export/2022/Juillet/2022-07-01_Chevrette_3462.jpg
|
||||||
|
|
||||||
|
# Obtenir le répertoire:
|
||||||
|
$ echo ${PATHNAME%/*}
|
||||||
|
/Users/bruno/Pictures/Export/2022/Juillet
|
||||||
|
|
||||||
|
# Obtenir le nom de fichier:
|
||||||
|
$ echo ${PATHNAME##*/}
|
||||||
|
2022-07-01_Chevrette_3462.jpg
|
||||||
|
|
||||||
|
|
||||||
|
$ FILENAME=2022-07-01_Chevrette_3462.jpg
|
||||||
|
|
||||||
|
# Obtenir le nom de fichier sans extension:
|
||||||
|
$ echo ${FILENAME%.*}
|
||||||
|
2022-07-01_Chevrette_3462
|
||||||
|
|
||||||
|
# Obtenir l'extension:
|
||||||
|
$ echo ${FILENAME##*.}
|
||||||
|
jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://wiki.bash-hackers.org/syntax/pe#substring_removal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,19 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Création d'un tableau (et initialisation):
|
### Création d'un tableau (et initialisation):
|
||||||
|
|
||||||
##### Tableau indicé:
|
#### Tableau indicé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Création:
|
||||||
|
$ tableau_indi=()
|
||||||
|
$ declare -a tableau_indi
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
```
|
```
|
||||||
|
|
||||||
Les indices sont assignés automatiquement, à partir de 0.
|
Les indices sont assignés automatiquement, à partir de 0.
|
||||||
@@ -20,88 +27,140 @@ chene à l'indice 0, érable le 2, saule le 5, hetre le 7. Les indices 3 et 4 so
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Tableau associatif:
|
#### Tableau associatif:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
# Création:
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Avec declare:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ declare -a tableau_indi
|
|
||||||
$ declare -A tableau_asso
|
$ declare -A tableau_asso
|
||||||
```
|
```
|
||||||
|
|
||||||
Initialisation:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
```
|
```
|
||||||
|
|
||||||
Tableau en lecture seule:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ readonly -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
# Returns all indizes and their items (doesn't work with associative arrays)
|
||||||
$ readonly -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ echo ${tableau_asso[@]}
|
||||||
|
gland faine sirop
|
||||||
|
|
||||||
|
# Returns all items
|
||||||
|
$ echo ${tableau_asso[*]}
|
||||||
|
gland faine sirop
|
||||||
|
|
||||||
|
# Returns all indizes
|
||||||
|
$ echo ${!tableau_asso[*]}
|
||||||
|
erable chene hetre
|
||||||
|
|
||||||
|
# Number elements
|
||||||
|
$ echo ${#tableau_asso[*]}
|
||||||
|
3
|
||||||
|
|
||||||
|
# Length of $nth item
|
||||||
|
${#tableau_asso[$n]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Affichage du tableau:
|
#### Tableau en lecture seule:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ readonly -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
||||||
|
$ declare -r -a tableau_indi_ro=( "un" "deux" "trois" "quatre" )
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ readonly -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
$ declare -r -A tableau_asso_ro=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Affichage du tableau:
|
||||||
|
|
||||||
L’affichage de l’ensemble d’un tableau se fait avec la syntaxe `${montableau[*]}` ou`${montableau[@]}`
|
L’affichage de l’ensemble d’un tableau se fait avec la syntaxe `${montableau[*]}` ou`${montableau[@]}`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${tableau_indi[@]}
|
$ echo ${tableau_indi[@]}
|
||||||
un deux trois quatre
|
un deux trois quatre
|
||||||
|
$ echo ${tableau_indi[*]}
|
||||||
|
un deux trois quatre
|
||||||
|
|
||||||
$ echo ${tableau_indi[2]}
|
$ echo ${tableau_indi[2]}
|
||||||
deux
|
deux
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
$ echo ${tableau_asso[@]}
|
$ echo ${tableau_asso[@]}
|
||||||
gland faine sirop
|
gland faine sirop
|
||||||
|
$ echo ${tableau_asso[*]}
|
||||||
|
gland faine sirop
|
||||||
|
|
||||||
$ echo ${tableau_asso[erable]}
|
$ echo ${tableau_asso[erable]}
|
||||||
sirop
|
sirop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
https://ostechnix.com/bash-for-loop-shell-scripting/#loop-over-array-elements
|
||||||
|
|
||||||
|
|
||||||
#### Lecture d'un élément:
|
|
||||||
|
### Lecture d'un élément:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${tableau_indi[2]}
|
$ echo ${tableau_indi[2]}
|
||||||
deux
|
deux
|
||||||
$ echo $tableau_indi
|
$ echo $tableau_indi
|
||||||
un deux trois quatre # !!! normalement 'un'
|
un # zsh: un deux trois quatre
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
$ echo ${tableau_asso["erable"]}
|
$ echo ${tableau_asso["erable"]}
|
||||||
# !!!! rien sur zsh !!!!
|
sirop # !!!! rien sur zsh !!!!
|
||||||
$ echo ${tableau_asso[erable]}
|
$ echo ${tableau_asso[erable]}
|
||||||
sirop
|
sirop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Ajouter un élément:
|
### Ajouter un élément:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ARRAY=()
|
$ tableau_indi=()
|
||||||
ARRAY+=('foo')
|
|
||||||
ARRAY+=('bar')
|
# Ajouter un élément à la fin du tableau
|
||||||
|
$ tableau_indi+=('cinq')
|
||||||
|
$ tableau_indi+=('six')
|
||||||
|
$ tableau_indi=("new_element" "${tableau_indi[@]}")
|
||||||
|
|
||||||
|
# Ajouter un élément au début du tableau
|
||||||
|
$ tableau_indi=("new_element" "${tableau_indi[@]}")
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tableau_asso+=([pommier]="pomme")
|
||||||
|
|
||||||
|
$ tableau_asso[pommier]="pomme"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Modification d'un élément:
|
### Modification d'un élément:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
|
$ tableau_indi[0]="zero"
|
||||||
|
$ echo ${tableau_indi[@]}
|
||||||
|
zero deux trois quatre
|
||||||
|
```
|
||||||
|
|
||||||
Si le tableau n’existe pas, il sera créé comme un tableau indicé :
|
Si le tableau n’existe pas, il sera créé comme un tableau indicé :
|
||||||
|
|
||||||
@@ -112,85 +171,297 @@ $ echo ${tableau_indi[1]}
|
|||||||
chene
|
chene
|
||||||
```
|
```
|
||||||
|
|
||||||
Il n’est pas possible de créer un tableau associatif en lui assignant un élément, il faut le déclarer explicitement avant l’assignation
|
Il n’est pas possible de créer un tableau associatif en lui assignant un élément, il faut le déclarer explicitement (declare -A tableau_asso) avant l’assignation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Afficher la liste des clés:
|
### Afficher la liste des clés:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${!tableau_indi[@]}
|
$ echo ${!tableau_indi[@]}
|
||||||
zsh: event not found: tableau_indi[@] # !!!
|
0 1 2 3 #zsh: event not found: tableau_indi[@] # !!!
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
$ echo ${!tableau_asso[@]}
|
$ echo ${!tableau_asso[@]}
|
||||||
zsh: event not found: tableau_asso[@] # !!!
|
erable chene hetre # zsh: event not found: tableau_asso[@] # !!!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Obtenir la taille d'un tableau:
|
### Afficher la liste des clés/valeurs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ for val in ${!tableau_indi[@]}
|
||||||
|
do
|
||||||
|
echo "index = ${val} , value = ${tableau_indi[$val]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
index = 0 , value = un
|
||||||
|
index = 1 , value = deux
|
||||||
|
index = 2 , value = trois
|
||||||
|
index = 3 , value = quatre
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ for elem in "${!tableau_asso[@]}";
|
||||||
|
do
|
||||||
|
echo "key : ${elem}" - - "value: ${tableau_asso[${elem}]}";
|
||||||
|
done
|
||||||
|
|
||||||
|
key : erable - - value: sirop
|
||||||
|
key : chene - - value: gland
|
||||||
|
key : hetre - - value: faine
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Obtenir la taille d'un tableau:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${#tableau_indi[@]}
|
$ echo ${#tableau_indi[@]}
|
||||||
4
|
4
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
$ echo ${#tableau_asso[@]}
|
$ echo ${#tableau_asso[@]}
|
||||||
3
|
3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Supprimer un élément:
|
### Supprimer un élément:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${tableau_indi[@]}
|
$ echo ${tableau_indi[@]}
|
||||||
un deux trois quatre
|
un deux trois quatre
|
||||||
|
|
||||||
|
$ echo ${#tableau_indi[@]}
|
||||||
|
4 # 4 éléments
|
||||||
|
|
||||||
$ unset tableau_indi[1]
|
$ unset tableau_indi[1]
|
||||||
zsh: no matches found: tableau_indi[1]
|
# zsh: no matches found: tableau_indi[1]
|
||||||
|
|
||||||
$ echo ${!tableau_indi[@]}
|
$ echo ${!tableau_indi[@]}
|
||||||
zsh: event not found: tableau_indi[@]
|
0 2 3 # zsh: event not found: tableau_indi[@]
|
||||||
|
|
||||||
|
$ echo ${tableau_indi[@]}
|
||||||
|
un trois quatre
|
||||||
|
|
||||||
|
$ echo ${#tableau_indi[@]}
|
||||||
|
3 # 3 éléments
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
echo ${cryptos[@]}
|
||||||
|
echo ${#cryptos[@]}
|
||||||
|
|
||||||
|
for val in ${!cryptos[@]}
|
||||||
|
do
|
||||||
|
echo "index = ${val} , value = ${cryptos[$val]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
|
$ echo ${tableau_asso[@]}
|
||||||
|
gland faine sirop
|
||||||
|
|
||||||
|
$ echo ${#tableau_asso[@]}
|
||||||
|
3 # 3 éléments
|
||||||
|
|
||||||
|
$ unset tableau_asso['erable']
|
||||||
|
# zsh: no matches found: tableau_asso[erable]
|
||||||
|
|
||||||
|
$ echo ${!tableau_asso[@]}
|
||||||
|
chene hetre # zsh: event not found: tableau_asso[@]
|
||||||
|
|
||||||
|
$ echo ${tableau_asso[@]}
|
||||||
|
gland faine
|
||||||
|
|
||||||
|
$ echo ${#tableau_asso[@]}
|
||||||
|
2 # 2 éléments
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Vider un tableau:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ echo ${tableau_indi[@]}
|
$ echo ${tableau_indi[@]}
|
||||||
un deux trois quatre
|
un deux trois quatre
|
||||||
|
|
||||||
|
$ declare -a tableau_indi=()
|
||||||
|
|
||||||
|
$ echo ${tableau_indi[@]}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
$ echo ${tableau_asso[@]}
|
|
||||||
gland faine sirop
|
|
||||||
|
|
||||||
$ unset tableau_asso['erable']
|
|
||||||
zsh: no matches found: tableau_asso[erable]
|
|
||||||
|
|
||||||
$ echo ${!tableau_asso[@]}
|
|
||||||
zsh: event not found: tableau_asso[@]
|
|
||||||
|
|
||||||
$ echo ${tableau_asso[@]}
|
$ echo ${tableau_asso[@]}
|
||||||
gland faine sirop
|
gland faine sirop
|
||||||
|
|
||||||
|
$ declare -A tableau_asso=()
|
||||||
|
|
||||||
|
$ echo ${tableau_asso[@]}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Supprimer un tableau entier:
|
### Supprimer un tableau entier:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
$ unset tableau_indi
|
$ echo ${tableau_indi[@]}
|
||||||
# unset tableau_indi[@]
|
un deux trois quatre
|
||||||
# unset tableau_indi[*]
|
|
||||||
|
$ unset tableau_indi
|
||||||
|
|
||||||
|
$ echo ${tableau_indi[@]}
|
||||||
|
|
||||||
$ echo ${!tableau_indi[@]}
|
```
|
||||||
zsh: event not found: tableau_indi[@]
|
|
||||||
|
```bash
|
||||||
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
|
$ echo ${tableau_asso[@]}
|
||||||
|
gland faine sirop
|
||||||
|
|
||||||
|
$ unset tableau_asso
|
||||||
|
|
||||||
|
$ echo ${tableau_asso[@]}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Vérifier si un élément est présent dans le tableau:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ declare -A tableau_asso=( ['chene']="gland" ['erable']="sirop" ['hetre']="faine" )
|
||||||
|
|
||||||
|
$ if [[ -n "${tableau_asso[erable]}" ]]; then echo "Element is present"; else echo "Element not present"; fi
|
||||||
|
Element is present
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ not_required=("drive" "files" "gitea" "home-assistant" "homebridge" "portainer" "wg" "yatch")
|
||||||
|
$ dynhost="pihole"
|
||||||
|
|
||||||
|
$ if [[ " ${not_required[*]} " != *"$dynhost"* ]]; then echo "$dynhost est absent"; else echo "$dynhost est present"; fi
|
||||||
|
pihole est absent
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mettre la sortie d'une commande dans un tableau:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ path_list=( $(echo $PATH | tr ":" "\n") )
|
||||||
|
|
||||||
|
$ echo ${path_list[@]}
|
||||||
|
/Users/bruno/.zinit/plugins/sei40kr---fast-alias-tips-bin /Users/bruno/.zinit/polaris/bin /Users/bruno/perl5/bin /Users/bruno/.nvm/versions/node/v18.13.0/bin /Users/bruno/Library/Python/3.9/bin /opt/homebrew/opt/grep/libexec/gnubin /opt/homebrew/opt/coreutils/libexec/gnubin /opt/homebrew/opt/ruby/bin /opt/homebrew/opt/unzip/bin /opt/homebrew/opt/ssh-copy-id/bin /opt/homebrew/opt/python/libexec/bin /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /usr/local/MacGPG2/bin /Library/Apple/usr/bin /Users/bruno/.cargo/bin /Users/bruno/.local/bin /opt/homebrew/opt/fzf/bin /Users/bruno/.yarn/bin /Users/bruno/.local/bin /Users/bruno/go/bin /Users/bruno/.zinit/plugins/kazhala---dotbare
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Slicing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
${array[@]:index:length}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ declare -a tableau_indi=( "un" "deux" "trois" "quatre" )
|
||||||
|
|
||||||
|
$ echo ${tableau_indi[@]}
|
||||||
|
un deux trois quatre
|
||||||
|
|
||||||
|
# Affiche de la position 2 à la fin
|
||||||
|
$ echo ${tableau_indi[@]:2}
|
||||||
|
trois quatre
|
||||||
|
|
||||||
|
# Affiche 2 éléments à partir de la position 1
|
||||||
|
$ echo ${tableau_indi[@]:1:2}
|
||||||
|
deux trois
|
||||||
|
|
||||||
|
# Affiche 2 éléments à partir du début
|
||||||
|
$ echo ${tableau_indi[@]::2}
|
||||||
|
un deux # zsh: closing brace expected
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Ajouter le contenu d'un tableau à un autre tableau
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ array1+=(${array2[@]})
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Convertir une chaine en tableau
|
||||||
|
|
||||||
|
```bash
|
||||||
|
string="drive files gitea home-assistant homebridge portainer tunes wg www"
|
||||||
|
|
||||||
|
array=(${string})
|
||||||
|
|
||||||
|
echo "${array[@]}"
|
||||||
|
drive files gitea home-assistant homebridge portainer tunes wg www
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Trier un tableau
|
||||||
|
|
||||||
|
```bash
|
||||||
|
IFS=$'\n' sorted=($(sort <<<"${array[*]}"))
|
||||||
|
unset IFS
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
### Sort arrays alphabetically
|
||||||
|
IFS=$'\n'
|
||||||
|
NoUpdates=($(sort <<<"${NoUpdates[*]}"))
|
||||||
|
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
||||||
|
unset IFS
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Copier un tableau
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ files=("a.txt" "b.txt")
|
||||||
|
|
||||||
|
$ filenames=("${files[@]}")
|
||||||
|
|
||||||
|
$ echo ${filenames[@]}
|
||||||
|
a.txt b.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
155
docs/Divers/bash/translate.md
Normal file
155
docs/Divers/bash/translate.md
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
# Translate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### deep-cli
|
||||||
|
|
||||||
|
https://github.com/eggplants/deepl-cli
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pas besoin d'API Key
|
||||||
|
|
||||||
|
$ deepl --fr fr --to en -s <<'A'
|
||||||
|
bonjour
|
||||||
|
A
|
||||||
|
Hello
|
||||||
|
```
|
||||||
|
|
||||||
|
#### deep-cli
|
||||||
|
|
||||||
|
https://github.com/kojix2/deepl-cli
|
||||||
|
|
||||||
|
##### Translate text
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export DEEPL_AUTH_KEY=your_api_key_here
|
||||||
|
|
||||||
|
❯ deepl -i "bonjour" -t EN
|
||||||
|
Hello
|
||||||
|
|
||||||
|
❯ deepl -i "bonjour" -f FR -t EN
|
||||||
|
Hello
|
||||||
|
|
||||||
|
❯ echo "Hello" | deepl -t FR
|
||||||
|
Bonjour
|
||||||
|
|
||||||
|
❯ wp --help | deepl -t FR | less
|
||||||
|
|
||||||
|
❯ man git | deepl -t FR | less
|
||||||
|
|
||||||
|
❯ deepl --paste -t DE
|
||||||
|
|
||||||
|
❯ deepl -t FR foo.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Translate documents
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ deepl doc your.pdf -t pt
|
||||||
|
# The translated document will be saved as your_PT.pdf
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Liste les languages disponibles
|
||||||
|
|
||||||
|
```
|
||||||
|
# Source
|
||||||
|
❯ deepl -f
|
||||||
|
|
||||||
|
# Target
|
||||||
|
❯ deepl -t
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Environment Variables
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ----------------- | -------------------------------- |
|
||||||
|
| DEEPL_AUTH_KEY | DeepL API authentication key |
|
||||||
|
| DEEPL_TARGET_LANG | Default target language |
|
||||||
|
| DEEPL_USER_AGENT | User-Agent |
|
||||||
|
| EDITOR | Text editor for editing glossary |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### translate shell
|
||||||
|
|
||||||
|
https://github.com/soimort/translate-shell
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# transfert to locale
|
||||||
|
$ trans -b dog
|
||||||
|
chien
|
||||||
|
|
||||||
|
$ trans dog
|
||||||
|
dog
|
||||||
|
/dôɡ/
|
||||||
|
|
||||||
|
(♂) chien
|
||||||
|
(♀) chienne
|
||||||
|
|
||||||
|
Définitions de dog
|
||||||
|
[ English -> Français ]
|
||||||
|
|
||||||
|
nom
|
||||||
|
(le) chien
|
||||||
|
dog, hound, cock, hanger
|
||||||
|
(le) mâle
|
||||||
|
male, buck, bull, cock, stag, dog
|
||||||
|
(la) fille moche
|
||||||
|
dog
|
||||||
|
|
||||||
|
verbe
|
||||||
|
suivre de près
|
||||||
|
monitor, dog
|
||||||
|
suivre comme un chien
|
||||||
|
dog
|
||||||
|
|
||||||
|
dog
|
||||||
|
chien
|
||||||
|
|
||||||
|
# translate to target
|
||||||
|
$ trans -b :de dog
|
||||||
|
Hund
|
||||||
|
|
||||||
|
$ trans -b -t de dog
|
||||||
|
Hund
|
||||||
|
|
||||||
|
# translate from source
|
||||||
|
$ trans -b en: dog
|
||||||
|
chien
|
||||||
|
|
||||||
|
$ trans -b -s en dog
|
||||||
|
chien
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
API DeepL
|
||||||
|
|
||||||
|
https://www.deepl.com/docs-api/introduction/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -X POST 'https://api-free.deepl.com/v2/translate' \
|
||||||
|
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
|
||||||
|
--data-urlencode 'text=Hello, world!' \
|
||||||
|
--data-urlencode 'target_lang=DE'
|
||||||
|
|
||||||
|
{"translations":[{"detected_source_language":"EN","text":"Hallo, Welt!"}]}%
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
translate() {
|
||||||
|
|
||||||
|
deepl=$(curl -s -X POST 'https://api-free.deepl.com/v2/translate' \
|
||||||
|
--header "Authorization: DeepL-Auth-Key $DEEPL_KEY" \
|
||||||
|
--data-urlencode "text=$2" \
|
||||||
|
--data-urlencode "target_lang=$1"
|
||||||
|
)
|
||||||
|
echo "$deepl" | jq -r .'translations[].text'
|
||||||
|
}
|
||||||
|
|
||||||
|
translate "DE" "il fait beau !"
|
||||||
|
```
|
||||||
|
|
||||||
187
docs/Divers/bash/variables.md
Normal file
187
docs/Divers/bash/variables.md
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
# Variables
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Assignation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
varname=value
|
||||||
|
|
||||||
|
echo $varname
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Si une variable n'a pas été affectée avant, elle sera vide (pas d'erreur).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo $varname
|
||||||
|
varname=value
|
||||||
|
echo $varname
|
||||||
|
|
||||||
|
<vide>
|
||||||
|
value
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Declarer
|
||||||
|
|
||||||
|
restreint la valeur de la variable à l'option
|
||||||
|
|
||||||
|
```bash
|
||||||
|
declare option variablename
|
||||||
|
```
|
||||||
|
|
||||||
|
option peut être:
|
||||||
|
|
||||||
|
- -r read only variable
|
||||||
|
- -i integer variable
|
||||||
|
- -a array variable
|
||||||
|
- -f for funtions
|
||||||
|
- -x declares and export to subsequent commands via the environment.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
declare -a z
|
||||||
|
|
||||||
|
# z sera un tableau
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Variable locale
|
||||||
|
|
||||||
|
la portée de la variable reste à l'instérieur de la finction
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ma_fonction() {
|
||||||
|
local lvar="Local content"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Variable globale (environment variables)
|
||||||
|
|
||||||
|
la variable est disponible à tous les scripts
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ printenv
|
||||||
|
LC_TERMINAL_VERSION=3.4.19
|
||||||
|
COLORFGBG=15;0
|
||||||
|
ITERM_PROFILE=access_log
|
||||||
|
XPC_FLAGS=0x0
|
||||||
|
SHELL=/bin/zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Test si la variable est un entier
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[[ $1 == ?(-)+([[:digit:]]) ]] && echo "$1 is an integer"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Incrémenter une variable:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
i=$((i+1)) user 0m0.992s
|
||||||
|
i=$((i++)) user 0m0.964s
|
||||||
|
((i=i+1)) user 0m0.760s
|
||||||
|
((i+=1)) user 0m0.700s
|
||||||
|
((i++)) user 0m0.644s
|
||||||
|
((++i)) user 0m0.556s
|
||||||
|
let "i=i+1" user 0m1.116s
|
||||||
|
let "i+=1" user 0m1.100s
|
||||||
|
let "i++" user 0m1.008s
|
||||||
|
let i=i+1 user 0m0.952s
|
||||||
|
let i+=1 user 0m1.040s
|
||||||
|
let i++ user 0m0.820s
|
||||||
|
declare -i i; i=i+1 user 0m0.528s
|
||||||
|
declare -i i; i+=1 user 0m0.492s
|
||||||
|
i=0; i=$(expr $i + 1) user 0m5.464s
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Opération mathématiques:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://www.gnu.org/software/bash/manual/html_node/Arithmetic-Expansion.html
|
||||||
|
|
||||||
|
https://www.gnu.org/software/bash/manual/html_node/Shell-Arithmetic.html
|
||||||
|
|
||||||
|
##### Multiplication:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo "$((5 * 3.15))"
|
||||||
|
15.75
|
||||||
|
|
||||||
|
$ echo "5 * 3.15" | bc -l
|
||||||
|
15.75
|
||||||
|
|
||||||
|
$ echo 5 3.15\*p | dc
|
||||||
|
15.75
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Soustraction:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo "5 - 3.15" | bc -l
|
||||||
|
1.85
|
||||||
|
|
||||||
|
$ echo "5 3.15 - p" | dc
|
||||||
|
1.85schell
|
||||||
|
|
||||||
|
$ echo "$((5 - 3.15))"
|
||||||
|
1.8500000000000001
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Addition:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo "5 + 3.15" | bc -l
|
||||||
|
8.15
|
||||||
|
|
||||||
|
$ echo "$((5 + 3.15))"
|
||||||
|
8.1500000000000004
|
||||||
|
|
||||||
|
$ ((add=5 + 3))
|
||||||
|
$ echo $add
|
||||||
|
8
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Division:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo "5 / 3.15" | bc -l
|
||||||
|
1.58730158730158730158
|
||||||
|
|
||||||
|
$ echo "$((20 / 4))"
|
||||||
|
5
|
||||||
|
|
||||||
|
$ echo "$((5 / 2))"
|
||||||
|
2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Variables prédéfinies spéciales:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$# : nombre de paramètres de ligne de commande transmis au script.
|
||||||
|
$@ : tous les paramètres de ligne de commande transmis au script.
|
||||||
|
$ ? : le statut de sortie du dernier processus à exécuter.
|
||||||
|
$$ : ID de processus (PID) du script actuel.
|
||||||
|
$USER : le nom d'utilisateur de l'utilisateur exécutant le script.
|
||||||
|
$HOSTNAME : nom d'hôte de l'ordinateur exécutant le script.
|
||||||
|
$SECONDS : nombre de secondes pendant lesquelles le script a été exécuté.
|
||||||
|
$RANDOM : renvoie un nombre aléatoire.
|
||||||
|
$LINENO : renvoie le numéro de ligne actuel du script.
|
||||||
|
```
|
||||||
|
|
||||||
34
docs/Divers/certificat.md
Normal file
34
docs/Divers/certificat.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Certificats
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo | openssl s_client -servername maboiteverte.fr -connect maboiteverte.fr:443 2>/dev/null | openssl x509 -noout -issuer -subject -dates
|
||||||
|
|
||||||
|
issuer=C = US, O = DigiCert Inc, OU = www.digicert.com, CN = Encryption Everywhere DV TLS CA - G2
|
||||||
|
subject=CN = *.maboiteverte.fr
|
||||||
|
notBefore=Jan 8 00:00:00 2024 GMT
|
||||||
|
notAfter=Jan 27 23:59:59 2025 GMT
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ echo | openssl s_client -servername maboiteverte.fr -connect maboiteverte.fr:443 2>/dev/null | openssl x509 -in /dev/stdin -noout -text
|
||||||
|
Certificate:
|
||||||
|
Data:
|
||||||
|
Version: 3 (0x2)
|
||||||
|
Serial Number:
|
||||||
|
06:68:76:d3:54:78:cf:e2:f8:d8:e0:16:89:c1:22:f7
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Issuer: C = US, O = DigiCert Inc, OU = www.digicert.com, CN = Encryption Everywhere DV TLS CA - G2
|
||||||
|
Validity
|
||||||
|
Not Before: Jan 8 00:00:00 2024 GMT
|
||||||
|
Not After : Jan 27 23:59:59 2025 GMT
|
||||||
|
Subject: CN = *.maboiteverte.fr
|
||||||
|
Subject Public Key Info:
|
||||||
|
Public Key Algorithm: rsaEncryption
|
||||||
|
Public-Key: (2048 bit)
|
||||||
|
Modulus:
|
||||||
|
```
|
||||||
213
docs/Divers/chezmoi.md
Normal file
213
docs/Divers/chezmoi.md
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
# chezmoi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://www.chezmoi.io/reference/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Répertoire *destination*: `~ ($HOME)`
|
||||||
|
|
||||||
|
#### Répertoire source: `~/.local/share/chezmoi`
|
||||||
|
|
||||||
|
#### Fichier config: `~/.config/chezmoi/chezmoi.toml`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Choisir l'éditeur par défaut:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export EDITOR="bbedit --wait"
|
||||||
|
```
|
||||||
|
|
||||||
|
ou par le fichier de config de chezmoi `~/.config/chezmoi/chezmoi.toml`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[edit]
|
||||||
|
command = "bbedit"
|
||||||
|
args = ["--wait"]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Editer un fichier:
|
||||||
|
|
||||||
|
1. **chez-moi edit**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi edit $FILE
|
||||||
|
|
||||||
|
# Appliquer les changements à la fermeture de l'éditeur
|
||||||
|
chezmoi edit --apply $FILE
|
||||||
|
|
||||||
|
# Appliquer les changements quand on sauve le fichier
|
||||||
|
chezmoi edit --watch $FILE
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **chezmoi cd et éditer dans le répertoire source directement:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi cd
|
||||||
|
|
||||||
|
bbedit ~/.zhrcc
|
||||||
|
code ~/.zshrc
|
||||||
|
|
||||||
|
# Voir les différences
|
||||||
|
chezmoi diff
|
||||||
|
|
||||||
|
# Appliquer les changements
|
||||||
|
chezmoi apply
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **chezmoi edit (sans argument):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# ouvre le répertoire dans l'éditeur
|
||||||
|
|
||||||
|
chezmoi edit
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **éditer le fichier dans le répertoire $HOME et le rajouter:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bbedit ~/.zhrcc
|
||||||
|
code ~/.zshrc
|
||||||
|
|
||||||
|
chezmoi add $FILE
|
||||||
|
|
||||||
|
#ou
|
||||||
|
|
||||||
|
chezmoi re-add
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **éditer le fichier dans le répertoire $HOME et puis fusionnez vos modifications avec l'état des sources en exécutant la commande chezmoi merge:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bbedit ~/.zhrcc
|
||||||
|
code ~/.zshrc
|
||||||
|
|
||||||
|
chezmoi merge $FILE
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Encrypter un fichier:
|
||||||
|
|
||||||
|
Ajouter au début du fichier de config:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
encryption = "gpg"
|
||||||
|
[gpg]
|
||||||
|
recipient = "bruno@clicclac.info"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi add --encrypt .env
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Commit et push automatique vers le dépôt:
|
||||||
|
|
||||||
|
Fichier de config:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[git]
|
||||||
|
autoCommit = true
|
||||||
|
commitMessageTemplate = "{{ promptString \"Commit message\" }}"
|
||||||
|
autoPush = true
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Archiver tous les fichiers dots:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi archive
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Tirer les derniers changements de votre repo et les appliquer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi update
|
||||||
|
```
|
||||||
|
|
||||||
|
équivalent à `git pull --autostash --rebase && chezmoi apply`
|
||||||
|
|
||||||
|
##### Tirer les derniers changements de votre repo, voir les changements sans les appliquer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi git pull -- --autostash --rebase && chezmoi diff
|
||||||
|
|
||||||
|
# si ok
|
||||||
|
|
||||||
|
chezmoi apply
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Commandes:
|
||||||
|
|
||||||
|
##### cat-config: afficher le fichier de config
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi cat-config
|
||||||
|
encryption = "gpg"
|
||||||
|
[gpg]
|
||||||
|
recipient = "bruno@clicclac.info"
|
||||||
|
|
||||||
|
[edit]
|
||||||
|
command = "codium"
|
||||||
|
args = ["--wait"]
|
||||||
|
|
||||||
|
[git]
|
||||||
|
autoCommit = true
|
||||||
|
commitMessageTemplate = "{{ promptString \"Commit message\" }}"
|
||||||
|
#commitMessageTemplateFile = ".commit_message.tmpl"
|
||||||
|
autoPush = true
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
pager = "delta"%
|
||||||
|
```
|
||||||
|
|
||||||
|
##### edit-config: éditer le fichier de config
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi edit-config
|
||||||
|
```
|
||||||
|
|
||||||
|
##### status: afficher l'état des fichiers et scripts gérés par chezmoi (cf. git status)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi status
|
||||||
|
|
||||||
|
M .zsh/.zshrc
|
||||||
|
MM Library/Preferences
|
||||||
|
M rsync-list.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
##### verify: vérifie que toutes les cibles correspondent à leur état.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi verify
|
||||||
|
```
|
||||||
|
|
||||||
|
##### update: récupère les modifications depuis le dépôt source et les applique.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi update
|
||||||
|
```
|
||||||
|
|
||||||
|
##### forget: supprimer les cibles de l'état source, autrement dit, cesser de les gérer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chezmoi forget ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
##### destroy: supprimer la cible de l'état source, du répertoire de destination et de l'état.
|
||||||
|
|
||||||
|
```
|
||||||
|
!!! chezmoi destroy ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
184
docs/Divers/diraction.md
Normal file
184
docs/Divers/diraction.md
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
# diractions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/AdrieanKhisbe/diractions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Configuration:
|
||||||
|
|
||||||
|
Fichier de configuration Diraction:
|
||||||
|
|
||||||
|
`DIRACTION_DEF_FILE = "~/.diractions"`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On peut l'éditer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ nano ~/.diractions
|
||||||
|
```
|
||||||
|
|
||||||
|
```ini
|
||||||
|
canon "$HOME/Pictures/Raw"
|
||||||
|
docs "$HOME/Documents/docs"
|
||||||
|
74ini /opt/homebrew/etc/php/7.4
|
||||||
|
80ini /opt/homebrew/etc/php/8.0
|
||||||
|
apache /opt/homebrew/etc/httpd
|
||||||
|
```
|
||||||
|
|
||||||
|
ou créer ses directions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ diraction create <nom> <repertoire>
|
||||||
|
```
|
||||||
|
|
||||||
|
ou sauver le répertoire courant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ diraction save <nom>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Utilisation:
|
||||||
|
|
||||||
|
Il suffit de taper le nom de la direction:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~
|
||||||
|
❯ canon
|
||||||
|
|
||||||
|
~/Pictures/Raw
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Sous-commandes:
|
||||||
|
|
||||||
|
`l | ls`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini ls
|
||||||
|
total 84
|
||||||
|
drwxr-xr-x 12 bruno admin 384 jul 29 18:35 conf.d
|
||||||
|
-rw-r--r-- 1 bruno admin 1397 jul 28 22:49 pear.conf
|
||||||
|
-rw-r--r-- 1 bruno admin 5422 jul 28 22:49 php-fpm.conf
|
||||||
|
drwxr-xr-x 3 bruno admin 96 jul 28 22:49 php-fpm.d
|
||||||
|
-rw-r--r-- 1 bruno admin 72665 jul 28 22:49 php.ini
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`t | tree`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini tree
|
||||||
|
/opt/homebrew/etc/php/7.4
|
||||||
|
├── conf.d
|
||||||
|
│ ├── apcu.ini
|
||||||
|
│ ├── ext-opcache.ini
|
||||||
|
│ ├── igbinary.ini
|
||||||
|
│ ├── imagick.ini
|
||||||
|
│ ├── mcrypt.ini
|
||||||
|
│ ├── memcached.ini
|
||||||
|
│ ├── msgpack.ini
|
||||||
|
│ ├── ssh2.ini
|
||||||
|
│ ├── xdebug.ini
|
||||||
|
│ └── yaml.ini
|
||||||
|
├── pear.conf
|
||||||
|
├── php-fpm.conf
|
||||||
|
├── php-fpm.d
|
||||||
|
│ └── www.conf
|
||||||
|
└── php.ini
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`ed | edit <filename>`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini ed php.ini
|
||||||
|
|
||||||
|
# ouvre /opt/homebrew/etc/php/7.4/php.ini dans $EDITOR
|
||||||
|
```
|
||||||
|
|
||||||
|
`o | open <filename>`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini o php.ini
|
||||||
|
|
||||||
|
# ouvre /opt/homebrew/etc/php/7.4/php.ini dans Nova / bbedit
|
||||||
|
|
||||||
|
$ 74ini o
|
||||||
|
|
||||||
|
# ouvre le dossier /opt/homebrew/etc/php/7.4/ dans le finder
|
||||||
|
```
|
||||||
|
|
||||||
|
`w | where | ?`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini w
|
||||||
|
/opt/homebrew/etc/php/7.4
|
||||||
|
```
|
||||||
|
|
||||||
|
`i | interactive | prompt | shell`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ 74ini i
|
||||||
|
Entering interactive mode in /opt/homebrew/etc/php/7.4 folder:
|
||||||
|
\>\>\
|
||||||
|
```
|
||||||
|
|
||||||
|
`e | exec <quoted command>`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ canon e "mv 2021.jpg 2021.png"
|
||||||
|
```
|
||||||
|
|
||||||
|
`c | cd <subdir>`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~
|
||||||
|
$ canon c 2021
|
||||||
|
|
||||||
|
~/Pictures/Raw/2021
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`/ <subdir> | /<subdir>`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~
|
||||||
|
$ canon / 2021
|
||||||
|
|
||||||
|
~/Pictures/Raw/2021
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Commandes globales:
|
||||||
|
|
||||||
|
`diraction disable <dirname>`: désactive l'alias
|
||||||
|
|
||||||
|
`diraction enable <dirname>`: active l'alias
|
||||||
|
|
||||||
|
`diraction destroy <dirname>`: supprime l'alias
|
||||||
|
|
||||||
|
`diraction destroy-all`: supprime toutes les directions (requiert l'argument -f ou --force)
|
||||||
|
|
||||||
|
`diraction reset`: destroy the diraction and reload them from the configuration
|
||||||
|
|
||||||
|
`diraction -h | --help`: aide
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Préférences:
|
||||||
|
|
||||||
|
- DIRACTION_AUTO_CONFIG
|
||||||
|
- DIRACTION_DEF_FILE
|
||||||
|
- DIRACTION_EDITOR
|
||||||
|
- DIRACTION_INTERACTIVE_PROMPT
|
||||||
|
- DIRACTION_EXPORT_VARIABLES
|
||||||
|
- DIRACTION_READONLY_VARIABLES
|
||||||
|
|
||||||
@@ -395,8 +395,6 @@ drwxr-xr-x 1 root root 196 Mar 15 09:35 public
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## emby
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
https://github.com/mickael-kerjean/filestash/wiki/Release-0.2:-Photo-Management
|
https://github.com/mickael-kerjean/filestash/wiki/Release-0.2:-Photo-Management
|
||||||
|
|||||||
@@ -4,6 +4,25 @@ https://docs.docker.com/
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
Docker ne fonctionne pas nativement sur Mac car le noyau de macOS n'est pas compatible (BSD vs Linux). Docker fonctionne en fait dans une machine virtuelle utilisant HyperKit.
|
||||||
|
|
||||||
|
Le fichier Docker.raw que vous avez mentionné ci-dessus est le disque virtuel de cette machine virtuelle.
|
||||||
|
|
||||||
|
Toutes les images Docker sont stockées à l'intérieur de la machine virtuelle (dans le fichier Docker.raw), vous ne pouvez donc pas les voir sur le système de fichiers du Mac.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Library/Containers/com.docker.docker/Data/vms/0/data
|
||||||
|
.rw-r--r--@ 60Gi bruno staff 6 jan 16:01 23 jul 2021 Docker.raw
|
||||||
|
```
|
||||||
|
|
||||||
|
Régler la taille et l'emplacement de la VM: Dashboard -> Settings -> Resources -> Advanced (réduire la taille de la VM supprime les images,containers et volumes)
|
||||||
|
|
||||||
|
https://docs.docker.com/desktop/faqs/macfaqs/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Containers installés:
|
### Containers installés:
|
||||||
|
|
||||||
#### Synology Docker GUI:
|
#### Synology Docker GUI:
|
||||||
@@ -15,7 +34,7 @@ https://docs.docker.com/
|
|||||||
| hoobs | hoobs/hoobs:latest | | |
|
| hoobs | hoobs/hoobs:latest | | |
|
||||||
| photonix | damianmoore/photonix:latest | | |
|
| photonix | damianmoore/photonix:latest | | |
|
||||||
| PiHole | pihole/pihole:latest | | |
|
| PiHole | pihole/pihole:latest | | |
|
||||||
| f | linuxserver/photoshow:latest | | |
|
| photoshow | linuxserver/photoshow:latest | | |
|
||||||
|
|
||||||
#### Portainer:
|
#### Portainer:
|
||||||
|
|
||||||
@@ -49,13 +68,13 @@ uid=1026(bruno) gid=100(users) groups=100(users),101(administrators)
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ id
|
$ id
|
||||||
uid=501(bruno) gid=20(staff) groups=20(staff),12(everyone)...
|
uid=501(bruno) gid=20(staff) groups=20(staff),12(everyone)...
|
||||||
|
|
||||||
❯ id -u
|
$ id -u
|
||||||
501
|
501
|
||||||
|
|
||||||
❯ id -g
|
$ id -g
|
||||||
20
|
20
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -70,7 +89,7 @@ chown 1000:1000 /volume1/docker/personal/ghost/ghost
|
|||||||
Créer un fichier **docker-compose.yml** dans **/volume1/docker/personal/ghost**
|
Créer un fichier **docker-compose.yml** dans **/volume1/docker/personal/ghost**
|
||||||
(pas de TAB)
|
(pas de TAB)
|
||||||
|
|
||||||
```
|
```bash
|
||||||
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -93,20 +112,22 @@ Stopping photoprism_photoprism_1 ... done
|
|||||||
|
|
||||||
Pour mettre à jour le container, supprimer le container dans la GUI et relancer `docker-compose up -d`
|
Pour mettre à jour le container, supprimer le container dans la GUI et relancer `docker-compose up -d`
|
||||||
|
|
||||||
```
|
```bash
|
||||||
/volume1/docker/personal/ghost $ sudo docker-compose pull
|
/volume1/docker/personal/ghost $ sudo docker-compose pull
|
||||||
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
/volume1/docker/personal/ghost $ sudo docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```bash
|
||||||
docker-compose up --force-recreate --build -d
|
$ docker-compose up --force-recreate --build -d
|
||||||
```
|
```
|
||||||
|
|
||||||
http://tonylawrence.com/posts/unix/synology/free-your-synology-ports/
|
http://tonylawrence.com/posts/unix/synology/free-your-synology-ports/
|
||||||
|
|
||||||
|
|
||||||
Arreter un container:
|
Arreter un container:
|
||||||
docker-compose down
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -116,15 +137,15 @@ Arreter un container:
|
|||||||
**Liste des containers qui tournent:**
|
**Liste des containers qui tournent:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker ps (Docker <1.13)
|
$ docker ps (Docker <1.13)
|
||||||
❯ docker container ls
|
$ docker container ls
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
||||||
4c66e278fd6d gitlab/gitlab-ce:latest "/assets/wrapper" 9 months ago Up 2 hours (unhealthy) 0.0.0.0:922->22/tcp, 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp gitlab
|
4c66e278fd6d gitlab/gitlab-ce:latest "/assets/wrapper" 9 months ago Up 2 hours (unhealthy) 0.0.0.0:922->22/tcp, 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp gitlab
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker container ls --format 'table {{.Names}}\t{{.Status}}'
|
$ docker container ls --format 'table {{.Names}}\t{{.Status}}'
|
||||||
NAMES STATUS
|
NAMES STATUS
|
||||||
watchtower Up 38 minutes
|
watchtower Up 38 minutes
|
||||||
portainer Up 2 hours
|
portainer Up 2 hours
|
||||||
@@ -133,7 +154,7 @@ homebridge Up 2 days
|
|||||||
bizmodeller-mymediaforalexa-amd641 Up 13 days
|
bizmodeller-mymediaforalexa-amd641 Up 13 days
|
||||||
PiHole Up 3 weeks (healthy)
|
PiHole Up 3 weeks (healthy)
|
||||||
|
|
||||||
❯ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Networks}}\t{{.Mounts}}"
|
$ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Networks}}\t{{.Mounts}}"
|
||||||
CONTAINER ID IMAGE COMMAND CREATED AT STATUS PORTS NAMES NETWORKS MOUNTS
|
CONTAINER ID IMAGE COMMAND CREATED AT STATUS PORTS NAMES NETWORKS MOUNTS
|
||||||
18fba7e277be portainer/portainer-ce "/portainer" 2020-11-09 22:22:47 +0100 CET Up 15 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp portainer bridge portainer_data,/run/host-serv…
|
18fba7e277be portainer/portainer-ce "/portainer" 2020-11-09 22:22:47 +0100 CET Up 15 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp portainer bridge portainer_data,/run/host-serv…
|
||||||
|
|
||||||
@@ -142,8 +163,8 @@ CONTAINER ID IMAGE COMMAND CREATED AT
|
|||||||
**Liste des containers stoppés:**
|
**Liste des containers stoppés:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker ps --filter "status=exited"
|
$ docker ps --filter "status=exited"
|
||||||
❯ docker container ls -f "status=exited"
|
$ docker container ls -f "status=exited"
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 50 minutes ago photonix
|
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 50 minutes ago photonix
|
||||||
23c90981855b redis:3.2.8 "docker-entrypoint.s…" About an hour ago Exited (0) 50 minutes ago photonix-redis
|
23c90981855b redis:3.2.8 "docker-entrypoint.s…" About an hour ago Exited (0) 50 minutes ago photonix-redis
|
||||||
@@ -151,11 +172,25 @@ d2b481b91f10 portainer/portainer "/portainer" 9 mon
|
|||||||
9763d849e8b1 portainer/portainer "/portainer" 9 months ago Exited (255) 9 months ago 0.0.0.0:9000->9000/tcp affectionate_antonelli
|
9763d849e8b1 portainer/portainer "/portainer" 9 months ago Exited (255) 9 months ago 0.0.0.0:9000->9000/tcp affectionate_antonelli
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Etat d'un container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker inspect -f '{{.State.Status}}' mycontainer
|
||||||
|
|
||||||
|
# created : n'a jamais été lancé depuis qu'il a été crée (docker create)
|
||||||
|
# running : en cours d'exécution (docker start)
|
||||||
|
# restarting : redémarre (no, on-failure, always, unless-stopped)
|
||||||
|
# exited : le process a l'intérieur du container est terminé
|
||||||
|
# paused : les process sont suspendus pour une durée indéterminée (consommation mémoire identique à l'état 'running')
|
||||||
|
# dead : le container est non fonctionnel. Il ne peut pas être redémarré, mais juste supprimé.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
**Liste de tous les containers:**
|
**Liste de tous les containers:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker ps --all
|
$ docker ps --all
|
||||||
❯ docker container ls --all
|
$ docker container ls --all
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 54 minutes ago photonix
|
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 54 minutes ago photonix
|
||||||
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
|
||||||
@@ -168,43 +203,56 @@ d2b481b91f10 portainer/portainer "/portainer" 9 mon
|
|||||||
**Liste des ID des containers qui tournent:**
|
**Liste des ID des containers qui tournent:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker ps -q
|
$ docker ps -q
|
||||||
❯ docker container ls -q
|
$ docker container ls -q
|
||||||
104f0c7e80a1
|
104f0c7e80a1
|
||||||
4c66e278fd6d
|
4c66e278fd6d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Démarrer un container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Démarre un container déjà crée mais arrêté.
|
||||||
|
|
||||||
|
$ docker start photoprism_photoprism_1
|
||||||
|
photoprism_photoprism_1
|
||||||
|
$ docker start 4beabb9fd090
|
||||||
|
4beabb9fd090
|
||||||
|
```
|
||||||
|
|
||||||
**Stopper un container:**
|
**Stopper un container:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker stop gitlab
|
$ docker stop gitlab
|
||||||
❯ docker stop 4c66e278fd6d
|
gitlab
|
||||||
|
$ docker stop 4c66e278fd6d
|
||||||
|
4c66e278fd6d
|
||||||
```
|
```
|
||||||
|
|
||||||
**Stopper tous les containers:**
|
**Stopper tous les containers:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker container stop $(docker container ls -aq)
|
$ docker container stop $(docker container ls -aq)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Stopper tous les containers associés à une image:**
|
**Stopper tous les containers associés à une image:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker ps -q --filter ancestor=IMAGE_NAME | xargs docker stop
|
$ docker ps -q --filter ancestor=IMAGE_NAME | xargs docker stop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Supprimer un container:**
|
**Supprimer un container:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker container rm d2b481b91f10 9763d849e8b1
|
$ docker container rm d2b481b91f10 9763d849e8b1
|
||||||
d2b481b91f10
|
d2b481b91f10
|
||||||
9763d849e8b1
|
9763d849e8b1
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ sudo docker rm b5576f445729
|
$ sudo docker rm b5576f445729
|
||||||
Error response from daemon: You cannot remove a running container b5576f44572913f1154e429b2bc84f84e696f4006adbaf8c2fb44f9dc1ff013a. Stop the container before attempting removal or force remove
|
Error response from daemon: You cannot remove a running container b5576f44572913f1154e429b2bc84f84e696f4006adbaf8c2fb44f9dc1ff013a. Stop the container before attempting removal or force remove
|
||||||
|
|
||||||
$ sudo docker rm b5576f445729 --force
|
$ sudo docker rm b5576f445729 --force
|
||||||
@@ -214,21 +262,49 @@ b5576f445729
|
|||||||
**Supprimer tous les containers:**
|
**Supprimer tous les containers:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker container rm $(docker container ls -aq)
|
$ docker container rm $(docker container ls -aq)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Exécuter une commande dans un container:**
|
**Exécuter une commande dans un container:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
|
$ sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
|
||||||
CONTAINER ID NAMES
|
CONTAINER ID NAMES
|
||||||
700a2cd00cba lychee
|
700a2cd00cba lychee
|
||||||
❯ sudo docker container exec 700a2cd00cba hostname
|
|
||||||
|
$ sudo docker container exec 700a2cd00cba hostname
|
||||||
700a2cd00cba
|
700a2cd00cba
|
||||||
❯ sudo docker container exec 700a2cd00cba hostname -I
|
|
||||||
|
$ sudo docker container exec 700a2cd00cba hostname -I
|
||||||
172.18.0.3
|
172.18.0.3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Se connecter en root à un container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
|
||||||
|
CONTAINER ID NAMES
|
||||||
|
700a2cd00cba lychee
|
||||||
|
|
||||||
|
$ sudo docker exec -it 700a2cd00cba bash
|
||||||
|
```
|
||||||
|
|
||||||
|
**Créer et démarrer un container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker container run
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run
|
||||||
|
```
|
||||||
|
|
||||||
|
**Renommer un container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker rename photoprism_photoprism_1 photoprism_1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Images:
|
## Images:
|
||||||
@@ -236,7 +312,7 @@ CONTAINER ID NAMES
|
|||||||
**Liste des images:**
|
**Liste des images:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker image ls
|
$ docker image ls
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
oznu/homebridge latest 3fa073f20624 4 days ago 625MB
|
oznu/homebridge latest 3fa073f20624 4 days ago 625MB
|
||||||
hoobs/hoobs latest c35c2f7222f3 4 days ago 558MB
|
hoobs/hoobs latest c35c2f7222f3 4 days ago 558MB
|
||||||
@@ -251,7 +327,7 @@ v2tec/watchtower latest 3069a9fb302a 2 ye
|
|||||||
Changer le [format de la sortie](https://docs.docker.com/engine/reference/commandline/images/#format-the-output):
|
Changer le [format de la sortie](https://docs.docker.com/engine/reference/commandline/images/#format-the-output):
|
||||||
|
|
||||||
```
|
```
|
||||||
❯ docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"
|
$ docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"
|
||||||
REPOSITORY TAG IMAGE ID CREATED AT SIZE
|
REPOSITORY TAG IMAGE ID CREATED AT SIZE
|
||||||
oznu/homebridge latest 3fa073f20624 2020-11-06 07:05:24 +0100 CET 625MB
|
oznu/homebridge latest 3fa073f20624 2020-11-06 07:05:24 +0100 CET 625MB
|
||||||
hoobs/hoobs latest c35c2f7222f3 2020-11-05 15:17:26 +0100 CET 558MB
|
hoobs/hoobs latest c35c2f7222f3 2020-11-05 15:17:26 +0100 CET 558MB
|
||||||
@@ -272,19 +348,19 @@ Sur une connection ssh: `ssh foo@bar docker images --format "$(jq .imagesFormat
|
|||||||
**Supprimer une image:**
|
**Supprimer une image:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker image rm 75835a67d134
|
$ docker image rm 75835a67d134
|
||||||
```
|
```
|
||||||
|
|
||||||
**Supprimer toutes les images non référencées par un container existant:**
|
**Supprimer toutes les images non référencées par un container existant:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker image prune -a
|
$ docker image prune -a
|
||||||
```
|
```
|
||||||
|
|
||||||
Infos sur une image:
|
Infos sur une image:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker image inspect 79aeacedba12
|
$ docker image inspect 79aeacedba12
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Id": "sha256:79aeacedba12f180af279aa030c7a64a0b2a9dc428a1dc1c4c074caafa05426d",
|
"Id": "sha256:79aeacedba12f180af279aa030c7a64a0b2a9dc428a1dc1c4c074caafa05426d",
|
||||||
@@ -301,7 +377,7 @@ Infos sur une image:
|
|||||||
|
|
||||||
# Date de création d'une image:
|
# Date de création d'une image:
|
||||||
|
|
||||||
❯ docker image inspect 79aeacedba12 | grep 'Created'
|
$ docker image inspect 79aeacedba12 | grep 'Created'
|
||||||
"Created": "2020-10-24T08:06:20.266765865Z",
|
"Created": "2020-10-24T08:06:20.266765865Z",
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -313,7 +389,7 @@ Infos sur une image:
|
|||||||
**Liste des volumes:**
|
**Liste des volumes:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker volume ls
|
$ docker volume ls
|
||||||
DRIVER VOLUME NAME
|
DRIVER VOLUME NAME
|
||||||
local 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
local 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||||
local 9d1fbf38c96c6474e159d512ff218c67ff7307c42f46cb01724358db854f3dd9
|
local 9d1fbf38c96c6474e159d512ff218c67ff7307c42f46cb01724358db854f3dd9
|
||||||
@@ -324,15 +400,15 @@ local portainer_data
|
|||||||
|
|
||||||
**Supprimer un volume:**
|
**Supprimer un volume:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ docker volume rm 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
$ docker volume rm 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||||
4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
|
||||||
```
|
```
|
||||||
|
|
||||||
**Supprimer tous les volumes inutilisés:**
|
**Supprimer tous les volumes inutilisés:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ docker volume prune
|
$ docker volume prune
|
||||||
WARNING! This will remove all local volumes not used by at least one container.
|
WARNING! This will remove all local volumes not used by at least one container.
|
||||||
Are you sure you want to continue? [y/N] y
|
Are you sure you want to continue? [y/N] y
|
||||||
Total reclaimed space: 0B
|
Total reclaimed space: 0B
|
||||||
@@ -344,8 +420,8 @@ Total reclaimed space: 0B
|
|||||||
|
|
||||||
**Liste des réseaux:**
|
**Liste des réseaux:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ docker network ls
|
$ docker network ls
|
||||||
NETWORK ID NAME DRIVER SCOPE
|
NETWORK ID NAME DRIVER SCOPE
|
||||||
cb8db3bfdaa8 bridge bridge local
|
cb8db3bfdaa8 bridge bridge local
|
||||||
5a1ec0a7d634 host host local
|
5a1ec0a7d634 host host local
|
||||||
@@ -356,24 +432,30 @@ a522745b92b7 pixapop_default bridge local
|
|||||||
|
|
||||||
**Supprimer tous les réseaux inutilisés:**
|
**Supprimer tous les réseaux inutilisés:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ docker network prune
|
$ docker network prune
|
||||||
```
|
```
|
||||||
|
|
||||||
**Supprimer tous les réseaux crées il y a plus de 12h:**
|
**Supprimer tous les réseaux crées il y a plus de 12h:**
|
||||||
|
|
||||||
```
|
```bash
|
||||||
❯ docker network prune --filter "until=12h"
|
$ docker network prune --filter "until=12h"
|
||||||
WARNING! This will remove all custom networks not used by at least one container.
|
WARNING! This will remove all custom networks not used by at least one container.
|
||||||
Are you sure you want to continue? [y/N] y
|
Are you sure you want to continue? [y/N] y
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Voir les containers attaché à un réseau:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker network inspect --format '{{range $cid,$v := .Containers}}{{printf "%s: %s\n" $cid $v.Name}}{{end}}' "<network_id>"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Stats:
|
## Stats:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ docker stats
|
$ docker stats
|
||||||
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDSCONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDSCONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
|
||||||
18fba7e277be portainer 0.00% 11.86MiB / 1.941GiB 0.60% 773kB / 6.04MB 287kB / 3.53MB 12
|
18fba7e277be portainer 0.00% 11.86MiB / 1.941GiB 0.60% 773kB / 6.04MB 287kB / 3.53MB 12
|
||||||
```
|
```
|
||||||
@@ -383,7 +465,7 @@ CONTAINER ID NAME CPU % MEM USAGE / LIMIT
|
|||||||
## Prune:
|
## Prune:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ sudo docker system prune
|
$ sudo docker system prune
|
||||||
Password:
|
Password:
|
||||||
WARNING! This will remove:
|
WARNING! This will remove:
|
||||||
- all stopped containers
|
- all stopped containers
|
||||||
@@ -513,11 +595,11 @@ b47b4299cc38 bizmodeller-mymediaforalexa-amd641 0.0.0.0:52050-52051->52
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
~/Documents/docker master* ⇡
|
~/Documents/docker master* ⇡
|
||||||
❯ docker volume create portainer_data
|
$ docker volume create portainer_data
|
||||||
portainer_data
|
portainer_data
|
||||||
|
|
||||||
~/Documents/docker master* ⇡
|
~/Documents/docker master* ⇡
|
||||||
❯ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
|
$ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
|
||||||
Unable to find image 'portainer/portainer-ce:latest' locally
|
Unable to find image 'portainer/portainer-ce:latest' locally
|
||||||
latest: Pulling from portainer/portainer-ce
|
latest: Pulling from portainer/portainer-ce
|
||||||
d1e017099d17: Already exists
|
d1e017099d17: Already exists
|
||||||
@@ -644,16 +726,16 @@ Entry | Description | Equivalent
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```bash
|
||||||
docker top
|
$ docker top
|
||||||
|
|
||||||
❯ docker service ls
|
$ docker service ls
|
||||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||||
|
|
||||||
❯ docker node ls
|
$ docker node ls
|
||||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||||
|
|
||||||
❯ docker config ls
|
$ docker config ls
|
||||||
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
83
docs/Divers/docker/watchtower.md
Normal file
83
docs/Divers/docker/watchtower.md
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Watchtower
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Full Exclude
|
||||||
|
|
||||||
|
Exclure certains containers:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Dans les containers à ignorer:
|
||||||
|
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
someimage:
|
||||||
|
container_name: someimage
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=false"
|
||||||
|
```
|
||||||
|
|
||||||
|
Inclure certains containers:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# docker-compose de watchtower
|
||||||
|
|
||||||
|
WATCHTOWER_LABEL_ENABLE
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Dans les containers à surveiller:
|
||||||
|
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
someimage:
|
||||||
|
container_name: someimage
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=true"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Monitor only
|
||||||
|
|
||||||
|
Par container:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
someimage:
|
||||||
|
container_name: someimage
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.monitor-only=true"
|
||||||
|
```
|
||||||
|
|
||||||
|
Tous les containers:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# docker-compose de watchtower
|
||||||
|
|
||||||
|
WATCHTOWER_MONITOR_ONLY
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://containrrr.dev/watchtower/
|
||||||
|
|
||||||
|
https://www.portainer.io/blog/using-env-files-in-stacks-with-portainer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Gotify:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-e WATCHTOWER_NOTIFICATIONS=gotify \
|
||||||
|
-e WATCHTOWER_NOTIFICATION_GOTIFY_URL="https://my.gotify.tld/" \
|
||||||
|
-e WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN="SuperSecretToken" \
|
||||||
|
|
||||||
|
-e WATCHTOWER_NOTIFICATION_GOTIFY_TLS_SKIP_VERIFY=true
|
||||||
|
```
|
||||||
|
|
||||||
329
docs/Divers/dotbare.md
Normal file
329
docs/Divers/dotbare.md
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
# dotbare
|
||||||
|
|
||||||
|
https://github.com/kazhala/dotbare
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
#### Dépendances
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install fzf tree bat (ou highlight, coderay) delta (ou diff-so-fancy)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# zinit
|
||||||
|
|
||||||
|
zinit light kazhala/dotbare
|
||||||
|
|
||||||
|
# antibody
|
||||||
|
|
||||||
|
antibody bundle kazhala/dotbare
|
||||||
|
```
|
||||||
|
|
||||||
|
ou
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare
|
||||||
|
|
||||||
|
puis source ~/.dotbare/dotbare.plugin.zsh dans les fichiers .zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### bash:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare
|
||||||
|
|
||||||
|
puis source ~/.dotbare/dotbare.plugin.bash dans les fichiers .bashrc ou .bash_profile
|
||||||
|
```
|
||||||
|
|
||||||
|
#####
|
||||||
|
|
||||||
|
#### Initialisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# init dépôt git bare (dans $HOME/.cfg).
|
||||||
|
|
||||||
|
$ dotbare finit
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation:
|
||||||
|
|
||||||
|
#### Ajouter les fichiers à suivre:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Fichiers
|
||||||
|
|
||||||
|
$ dotbare fadd -f
|
||||||
|
# ou
|
||||||
|
$ dotbare add [FIELNAME]
|
||||||
|
|
||||||
|
# Répertoires
|
||||||
|
|
||||||
|
$ dotbare fadd -d
|
||||||
|
# ou
|
||||||
|
$ dotbare add [DIRECTORY]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Commit changes and push to remote:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare commit -m "First commit"
|
||||||
|
$ dotbare remote add origin [URL]
|
||||||
|
$ dotbare push -u origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Alias:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias dbpush='dotbare push -u mbv master'
|
||||||
|
alias dbadd='dotbare add -f $1'
|
||||||
|
alias dbcomm='dotbare commit -am $1'
|
||||||
|
alias dbback='dotbare fbackup'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Préférences:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Default value
|
||||||
|
export DOTBARE_DIR="$HOME/.cfg"
|
||||||
|
|
||||||
|
export DOTBARE_TREE="$HOME"
|
||||||
|
|
||||||
|
export DOTBARE_BACKUP="${XDG_DATA_HOME:-$HOME/.local/share}/dotbare"
|
||||||
|
|
||||||
|
export DOTBARE_KEY="
|
||||||
|
--bind=alt-a:toggle-all # toggle all selection
|
||||||
|
--bind=alt-j:jump # label jump mode, sort of like vim-easymotion
|
||||||
|
--bind=alt-0:top # set cursor back to top
|
||||||
|
--bind=alt-s:toggle-sort # toggle sorting
|
||||||
|
--bind=alt-t:toggle-preview # toggle preview
|
||||||
|
"
|
||||||
|
|
||||||
|
export DOTBARE_FZF_DEFAULT_OPTS="--preview-window=right:65%"
|
||||||
|
|
||||||
|
export DOTBARE_PREVIEW="cat -n {}"
|
||||||
|
|
||||||
|
export DOTBARE_DIFF_PAGER="delta --diff-so-fancy --line-numbers"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fbackup:
|
||||||
|
|
||||||
|
D'après la variable DOTBARE_BACKUP
|
||||||
|
|
||||||
|
- Backup files to /Users/bruno/.local/share/dotbare.
|
||||||
|
- This is useful when untracking files or migrating to new machines.
|
||||||
|
- Default: backup all tracked files using cp command to /Users/bruno/.local/share/dotbare directory.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# -$HOME/.local/share/dotbare
|
||||||
|
|
||||||
|
#Sauvegarger tous les fichiers:
|
||||||
|
|
||||||
|
$ dotbare fbackup
|
||||||
|
|
||||||
|
# Pour choisir les fichiers à backuper:
|
||||||
|
|
||||||
|
$ dotbare fbackup -s
|
||||||
|
|
||||||
|
# -s, --select list all tracked files and only backup the selected files.
|
||||||
|
# -p PATH, --path PATH specify path of files to backup.
|
||||||
|
# -m, --move use 'mv' instead of the default 'cp' command to backup.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fedit:
|
||||||
|
|
||||||
|
- Select files/commits through fzf and edit selected files/commits in EDITOR.
|
||||||
|
- Default: list all tracked dotfiles and edit the selected files.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fedit
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -m uniquement les fichiers modifiés
|
||||||
|
# -c affiche les commits
|
||||||
|
```
|
||||||
|
|
||||||
|
#### fgrep:
|
||||||
|
|
||||||
|
- Grep words within tracked files and select to edit matches.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fgrep
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -c COL, --col COL specify the column number to start searching.
|
||||||
|
# -f, --full include all column during search, as if using '--col 1'.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### flog:
|
||||||
|
|
||||||
|
- Interactive log viewer with action menu.
|
||||||
|
- Action menu contains options including revert|reset|edit|checkout|exit.
|
||||||
|
- Default: list all commits and prompt a menu to select action to perform.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare flog
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -r, --revert revert the selected commit and skip action menu.
|
||||||
|
# -R, --reset reset HEAD back to selected commit and skip action menu.
|
||||||
|
# -e, --edit edit selected commit through interactive rebase and skip action menu.
|
||||||
|
# -c, --checkout checkout selected commit and skip action menu.
|
||||||
|
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### freset:
|
||||||
|
|
||||||
|
- Reset(unstage) the selected staged files. (Default)
|
||||||
|
- Reset the HEAD to certain commits by using -c flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare freset
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -c, --commit reset HEAD to certain commit, default --mixed flag, reset HEAD to certain commit put all changes into modified state.
|
||||||
|
# -S, --soft reset commit using --soft flag, reset HEAD to certain commit without modify working tree.
|
||||||
|
# -H, --hard reset commit using --hard flag, reset HEAD to certain commit discard all changes from the working tree.
|
||||||
|
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fcheckout:
|
||||||
|
|
||||||
|
- Select files/commit/branch through fzf and checkout the selected objects.
|
||||||
|
- Files: checkout the version in HEAD or in a specific commit (reset files content back to the selected commit).
|
||||||
|
- Branch: switch to the selected branch.
|
||||||
|
- Commit: switch to a specific commit.
|
||||||
|
- Default: list all modified files and reset selected files back to HEAD.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fcheckout
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -s, --select list all tracked files and select a commit to checkout the selected files.
|
||||||
|
# -b, --branch list all branch and checkout/switch the selected branch.
|
||||||
|
# -c, --commit list all commits and checkout selected commit.
|
||||||
|
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fstash
|
||||||
|
|
||||||
|
- View and manage stash interactively
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fstash
|
||||||
|
|
||||||
|
# Default: list all stashes and apply the selected stash files
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
#. -s, --select list modified files and stash the selected files
|
||||||
|
# -d, --delete list all stashes and delete the selected stash files
|
||||||
|
# -p, --pop use 'stash pop' instead of 'stash apply'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fstat
|
||||||
|
|
||||||
|
- Display interactive git status menu
|
||||||
|
- Toggle file stage/unstage interactively
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fstat
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### funtrack
|
||||||
|
|
||||||
|
- Untrack selected files from git
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare funtrack
|
||||||
|
|
||||||
|
# Default: list all tracked files and permanently untrack the selected files (using git rm --cached filename).
|
||||||
|
# Files will be remove from index while keeping the file in your current system.
|
||||||
|
# However, when your other computers pull down the changes, the untracked files will be deleted.
|
||||||
|
# Make sure to run dotbare fbackup before pulling down the changes.
|
||||||
|
|
||||||
|
# Alternatively use the -t flag (using git update-index --assume-unchanged [path]) to temporarily untrack a file but keeping the files when other computers pull down the changes.
|
||||||
|
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
# -t, --temp list all trackes files and temporarily ignore changes of the selected files.
|
||||||
|
# -r, --resume list all trackes files and resume tracking changes of the selected files.
|
||||||
|
# -y, --yes acknowledge all actions that will be taken and skip confirmation.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fupgrade
|
||||||
|
|
||||||
|
- Upgrade dotbare to the latest master
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotbare fupgrade
|
||||||
|
|
||||||
|
# -h, --help show this help message and exit.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Liste des fichiers sauvegardés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/.local/share/dotbare 08:42:08
|
||||||
|
❯ l
|
||||||
|
Permissions Size User Group Date Modified Date Created Name
|
||||||
|
.rwxr-xr-x 1,1Ki bruno staff 25 jul 2021 25 jul 2021 .backup_list.conf*
|
||||||
|
.rwxr-xr-x 2,5Ki bruno staff 25 jul 2021 25 jul 2021 .bash_aliases*
|
||||||
|
.rwxr-xr-x 7,8Ki bruno staff 4 fév 20:07 25 jul 2021 .bash_profile*
|
||||||
|
.rw-r--r-- 259 bruno staff 4 fév 20:07 24 jul 2021 .bashrc
|
||||||
|
drwxr-xr-x - bruno staff 12 aoû 2021 12 aoû 2021 .config/
|
||||||
|
.rw-r--r-- 236 bruno staff 21 nov 2021 1 aoû 2021 .diractions
|
||||||
|
.rwxr-xr-x 21Ki bruno staff 25 jul 2021 25 jul 2021 .dircolors*
|
||||||
|
.rwxr-xr-x 10 bruno staff 25 jul 2021 25 jul 2021 .exclude-rsync.txt*
|
||||||
|
.rw-r--r-- 318 bruno staff 16 fév 15:02 4 aoû 2021 .gitconfig
|
||||||
|
.rwxr-xr-x 134 bruno staff 12 aoû 2021 25 jul 2021 .gitignore*
|
||||||
|
.rw-r--r-- 645 bruno staff 7 aoû 2021 7 aoû 2021 .my.cnf.gpg
|
||||||
|
drwxr-xr-x - bruno staff 5 mai 08:33 12 aoû 2021 .nano/
|
||||||
|
.rw-r--r-- 2,7Ki bruno staff 25 jul 2021 25 jul 2021 .nanorc
|
||||||
|
.rw-r--r--@ 9,7Ki bruno staff 1 aoû 2021 1 aoû 2021 .p10k.zsh
|
||||||
|
drwxr-xr-x - bruno staff 12 aoû 2021 12 aoû 2021 .ssh/
|
||||||
|
.rwxr-xr-x 69 bruno staff 25 jul 2021 25 jul 2021 .ticker.conf*
|
||||||
|
.rwxr-xr-x 355 bruno staff 25 jul 2021 25 jul 2021 .ticker.yaml*
|
||||||
|
.rw-r--r-- 130 bruno staff 17 aoû 2021 23 jul 2021 .zprofile
|
||||||
|
.rwxr-xr-x@ 349 bruno staff 31 jul 2021 31 jul 2021 .zsh_plugins.txt*
|
||||||
|
.rw-r--r-- 28 bruno staff 1 aoû 2021 1 aoû 2021 .zshbookmarks
|
||||||
|
.rw-r--r--@ 25Ki bruno staff 4 mai 08:06 12 aoû 2021 .zshrc
|
||||||
|
.rw-r--r--@ 16Ki bruno staff 31 jul 2021 31 jul 2021 .zshrc-antibody.bak
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
141
docs/Divers/git/Untitled.md
Normal file
141
docs/Divers/git/Untitled.md
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
# Git : Divers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Trouver tous les repos:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -type d -exec [ -e '{}/.git' ] ';' -prune -print
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Gitleaks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gitleaks detect -v
|
||||||
|
|
||||||
|
○
|
||||||
|
│╲
|
||||||
|
│ ○
|
||||||
|
○ ░
|
||||||
|
░ gitleaks
|
||||||
|
|
||||||
|
Finding: APIKEY="P500SaGgEA79l6wktSbakYGPjXfvAkTw0PMXykzKkrxLp"
|
||||||
|
Secret: P500SaGgEA79l6wktSbakYGPjXfvAkTw0PMXykzKkrxLp
|
||||||
|
RuleID: generic-api-key
|
||||||
|
Entropy: 4.631305
|
||||||
|
File: soco-cli-gui.sh
|
||||||
|
Line: 49
|
||||||
|
Commit: 8adf31b467bbe71d9a56b74761c40aeec5ceb171
|
||||||
|
Author: JohnDoe
|
||||||
|
Email: john@doe.com
|
||||||
|
Date: 2023-03-13T07:56:12Z
|
||||||
|
Fingerprint: 8adf31b467bbe71d9a56b74761c40aeec5ceb171:soco-cli-gui.sh:generic-api-key:49
|
||||||
|
|
||||||
|
Finding: APIKEY="P500SaGgEA79l6wktSbakYGPjXfvAkTw0PMXykzKkrxLp"
|
||||||
|
Secret: P500SaGgEA79l6wktSbakYGPjXfvAkTw0PMXykzKkrxLp
|
||||||
|
RuleID: generic-api-key
|
||||||
|
Entropy: 4.631305
|
||||||
|
File: soco-cli-gui.sh
|
||||||
|
Line: 1443
|
||||||
|
Commit: bdc25bc0a3eb61663a6437621f0ac3b7c41701ee
|
||||||
|
Author: JohnDoe
|
||||||
|
Email: john@doe.com
|
||||||
|
Date: 2023-03-11T14:57:24Z
|
||||||
|
Fingerprint: bdc25bc0a3eb61663a6437621f0ac3b7c41701ee:soco-cli-gui.sh:generic-api-key:1443
|
||||||
|
|
||||||
|
Finding: GITHUB_TOKEN=gdxfdo25vth9pvk3mev05s1z87y4t4s
|
||||||
|
Secret: gdxfdo25vth9pvk3mev05s1z87y4t4s
|
||||||
|
RuleID: generic-api-key
|
||||||
|
Entropy: 3.862815
|
||||||
|
File: soco-cli-gui.sh
|
||||||
|
Line: 17
|
||||||
|
Commit: e3fc8b675561b3d608e12a10cc1dd70241dcbc84
|
||||||
|
Author: JohnDoe
|
||||||
|
Email: john@doe.com
|
||||||
|
Date: 2021-01-16T11:04:35Z
|
||||||
|
Fingerprint: e3fc8b675561b3d608e12a10cc1dd70241dcbc84:soco-cli-gui.sh:generic-api-key:17
|
||||||
|
|
||||||
|
3:39PM INF 60 commits scanned.
|
||||||
|
3:39PM INF scan completed in 36.7ms
|
||||||
|
3:39PM WRN leaks found: 3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On indique les chaines à remplacer dans le fichier 'replace.txt':
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main 15:39:25
|
||||||
|
$ echo '13314ba0099450eaa6c0b2233d0f6adde1f5c718==>GITHUB_TOKEN' >> replace.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main* 15:39:43
|
||||||
|
$ echo 'AIzaSyBtEqykacvWuWiLqq1-eIBZBrJzAYEx_xU==>GM_APIKEY' >> replace.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On initie le remplacement avec --force:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main* 15:39:49
|
||||||
|
$ git filter-repo --replace-text replace.txt
|
||||||
|
Aborting: Refusing to destructively overwrite repo history since
|
||||||
|
this does not look like a fresh clone.
|
||||||
|
(expected one remote, origin)
|
||||||
|
Please operate on a fresh clone instead. If you want to proceed
|
||||||
|
anyway, use --force.
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main* 15:40:13
|
||||||
|
$ git filter-repo --replace-text replace.txt --force
|
||||||
|
Parsed 60 commits
|
||||||
|
New history written in 0.37 seconds; now repacking/cleaning...
|
||||||
|
Repacking your repo and cleaning out old unneeded objects
|
||||||
|
HEAD est maintenant à 0279b2d Rework alarms functions
|
||||||
|
Énumération des objets: 187, fait.
|
||||||
|
Décompte des objets: 100% (187/187), fait.
|
||||||
|
Compression par delta en utilisant jusqu'à 8 fils d'exécution
|
||||||
|
Compression des objets: 100% (111/111), fait.
|
||||||
|
Écriture des objets: 100% (187/187), fait.
|
||||||
|
Total 187 (delta 111), réutilisés 87 (delta 74), réutilisés du paquet 0 (depuis 0)
|
||||||
|
Completely finished after 0.83 seconds.
|
||||||
|
```
|
||||||
|
|
||||||
|
gitleaks ne détecte plus aucin leaks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main* 15:40:22
|
||||||
|
$ gitleaks detect -v
|
||||||
|
|
||||||
|
○
|
||||||
|
│╲
|
||||||
|
│ ○
|
||||||
|
○ ░
|
||||||
|
░ gitleaks
|
||||||
|
|
||||||
|
3:40PM INF 60 commits scanned.
|
||||||
|
3:40PM INF scan completed in 29.8ms
|
||||||
|
3:40PM INF no leaks found
|
||||||
|
```
|
||||||
|
|
||||||
|
On pousse avec --force vers les remotes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts/sonos main* 15:51:51
|
||||||
|
$ git push dsm923 main --force
|
||||||
|
Énumération des objets: 186, fait.
|
||||||
|
Décompte des objets: 100% (186/186), fait.
|
||||||
|
Compression par delta en utilisant jusqu'à 8 fils d'exécution
|
||||||
|
Compression des objets: 100% (73/73), fait.
|
||||||
|
Écriture des objets: 100% (186/186), 150.65 Kio | 75.32 Mio/s, fait.
|
||||||
|
Total 186 (delta 111), réutilisés 186 (delta 111), réutilisés du paquet 0 (depuis 0)
|
||||||
|
remote: Resolving deltas: 100% (111/111), done.
|
||||||
|
To dsm923e:/volume1/Repositories/repos/sonos.git
|
||||||
|
+ 56bbfb1...0279b2d main -> main (forced update)
|
||||||
|
```
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ Sur le serveur (DS916), aller dans le dossier Repo:
|
|||||||
```bash
|
```bash
|
||||||
dsm916> cd /volume1/Repositories/
|
dsm916> cd /volume1/Repositories/
|
||||||
|
|
||||||
dsm916> git init –-bare wp2012.git
|
dsm916> git init --bare wp2012.git
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -152,7 +152,7 @@ Bash.git est un repo --bare sur le NAS.
|
|||||||
Créer un répertoire contenant les données du dépôt (working tree) ainsi qu'un répertoire .git
|
Créer un répertoire contenant les données du dépôt (working tree) ainsi qu'un répertoire .git
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git clone ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/bash.git
|
$ git clone ssh://bruno@photos-nas.ovh:42667/volume1/Repositories/bash.git
|
||||||
|
|
||||||
$ cd bash
|
$ cd bash
|
||||||
drwxr-xr-x 12 bruno staff 384 May 8 07:46 .git
|
drwxr-xr-x 12 bruno staff 384 May 8 07:46 .git
|
||||||
@@ -571,6 +571,14 @@ mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (fetch)
|
|||||||
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (push)
|
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (push)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[Push to multiple remotes at once](https://leighmcculloch.com/posts/git-push-to-multiple-remotes-at-once/)
|
||||||
|
|
||||||
|
https://gist.github.com/rvl/c3f156e117e22a25f242
|
||||||
|
|
||||||
|
[Pushing to multiple git remotes simultaneously](https://jeffkreeftmeijer.com/git-multiple-remotes/)
|
||||||
|
|
||||||
|
[Working with Git remotes and pushing to multiple Git repositories](https://jigarius.com/blog/multiple-git-remote-repositories)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Etiquettes:
|
### Etiquettes:
|
||||||
@@ -775,6 +783,96 @@ https://blog.zenika.com/2017/01/24/pull-request-demystifie/
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Connaitre la version courante:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git show
|
||||||
|
commit a3f86d08322bc3ef14157ced679907b2b8ec27ee (HEAD -> master, tag: debian/1.0.12-5, origin/master, origin/HEAD)
|
||||||
|
Author: James Valleroy <jvalleroy@mailbox.org>
|
||||||
|
Date: Sat Jan 8 21:31:13 2022 -0500
|
||||||
|
|
||||||
|
Release v1.0.12-5 to unstable
|
||||||
|
|
||||||
|
$ git show | grep -m 1 "Release"
|
||||||
|
Release v1.0.12-5 to unstable
|
||||||
|
|
||||||
|
|
||||||
|
$ git show
|
||||||
|
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||||
|
Author: Jay Salvat <jay@jaysalvat.com>
|
||||||
|
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||||
|
|
||||||
|
Build v2.5.4
|
||||||
|
|
||||||
|
$ git show | grep -m 1 "Build" | awk -F"v" '{print $2}'
|
||||||
|
2.5.4
|
||||||
|
|
||||||
|
$ ssh -q -t funnymac@ftp.cluster011.ovh.net "cd www/photoblog/js/vegas && git show | grep -m 1 \"Build\"" | awk -F"v" '{print $2}' | sed 's/.$//'
|
||||||
|
2.5.4
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git log
|
||||||
|
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||||
|
Author: Jay Salvat <jay@jaysalvat.com>
|
||||||
|
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||||
|
|
||||||
|
Build v2.5.4
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Savoir si mise-à-jour est dispo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote show origin | grep $(git rev-parse --abbrev-ref HEAD) | tail -1
|
||||||
|
master pousse vers master (à jour)
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! warning "Si on a un repo partiel, **git remote** recontruit le repo git"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote -v update
|
||||||
|
POST git-upload-pack (188 bytes)
|
||||||
|
Depuis https://salsa.debian.org/php-team/pear/php-gettext
|
||||||
|
= [à jour] master -> origin/master
|
||||||
|
= [à jour] pristine-tar -> origin/pristine-tar
|
||||||
|
= [à jour] upstream -> origin/upstream
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote update
|
||||||
|
|
||||||
|
$ git status -uno
|
||||||
|
Sur la branche master
|
||||||
|
Votre branche est à jour avec 'origin/master'.
|
||||||
|
|
||||||
|
rien à valider (utilisez -u pour afficher les fichiers non suivis)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git remote update
|
||||||
|
|
||||||
|
$git show-branch origin/master
|
||||||
|
[origin/master] Release v1.0.12-6 to unstable
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
local_commit=$(git rev-list --all -n1)
|
||||||
|
remote_commit=$(git ls-remote origin master)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git ls-remote origin master
|
||||||
|
7abeca2bd7df910ac546e06a62c128a40f56874a refs/heads/master
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### => [Session de travail avec git](git-session.md) <=
|
#### => [Session de travail avec git](git-session.md) <=
|
||||||
|
|
||||||
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=
|
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=
|
||||||
|
|||||||
@@ -6,22 +6,30 @@ https://gitea.io/en-us/
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Installer Gitea
|
#### Installer Gitea sur Synology:
|
||||||
|
|
||||||
IL faut créer le paquet Gitea:
|
Il faut créer le paquet Gitea:
|
||||||
|
|
||||||
https://github.com/flipswitchingmonkey/gitea-spk
|
https://github.com/flipswitchingmonkey/gitea-spk
|
||||||
|
|
||||||
|
Pour DSM7, le paquet est dispo sur le repo SynoCommunity:
|
||||||
|
|
||||||
|
https://github.com/SynoCommunity/spksrc/pull/5028
|
||||||
|
|
||||||
|
#### Installer Gitea depuis les binaires:
|
||||||
|
|
||||||
|
https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Importer un repo local dans Gitea:
|
#### Importer un repo local dans Gitea:
|
||||||
|
|
||||||
Dans Gitea, créer un nouveau dépôt (ne pas cocher Initialiser le dépôt): gitea_bash
|
Dans Gitea, créer un nouveau dépôt (ne pas cocher Initialiser le dépôt): wordpress
|
||||||
|
|
||||||
Dans le repo local, ajouter le dépôt gitea comme nouveau repo distant:
|
Dans le repo local, ajouter le dépôt gitea comme nouveau repo distant:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git remote add gitea https://clicclac.synology.me:3001/bruno/gitea_bash.git
|
$ git remote add origin https://gitea.photos-nas.ovh/shell/wordpress.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Il ne reste plus qu' à pousser les commits sur le dépôt gitea:
|
Il ne reste plus qu' à pousser les commits sur le dépôt gitea:
|
||||||
@@ -32,3 +40,10 @@ $ git push gitea master
|
|||||||
|
|
||||||
https://charlesreid1.github.io/setting-up-a-self-hosted-github-clone-with-gitea.html#gitea-pushing-local
|
https://charlesreid1.github.io/setting-up-a-self-hosted-github-clone-with-gitea.html#gitea-pushing-local
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Vérifier la clé ssh:
|
||||||
|
|
||||||
|
Configuration -> Clés SSH / GPG -> Vérifier
|
||||||
|
|
||||||
|
Il faut aller très vite, il y a un timeout.
|
||||||
|
|||||||
176
docs/Divers/git/github.md
Normal file
176
docs/Divers/git/github.md
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
# GitHub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Cloner juste un sous-dossier d'un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents $ git init vegas
|
||||||
|
|
||||||
|
~/Documents
|
||||||
|
$ cd vegas
|
||||||
|
drwxr-xr-x@ - bruno staff 17 nov 16:14 17 nov 16:14 -I .git/
|
||||||
|
|
||||||
|
~/Documents/vegas master
|
||||||
|
$ git remote add origin https://github.com/jaysalvat/vegas.git
|
||||||
|
|
||||||
|
~/Documents/vegas master
|
||||||
|
$ git config core.sparsecheckout true
|
||||||
|
|
||||||
|
~/Documents/vegas master
|
||||||
|
$ echo "dist/*" >> .git/info/sparse-checkout
|
||||||
|
|
||||||
|
~/Documents/vegas master
|
||||||
|
$ git pull --depth=1 origin master
|
||||||
|
remote: Enumerating objects: 56, done.
|
||||||
|
remote: Counting objects: 100% (56/56), done.
|
||||||
|
remote: Compressing objects: 100% (41/41), done.
|
||||||
|
remote: Total 56 (delta 16), reused 39 (delta 14), pack-reused 0
|
||||||
|
Dépaquetage des objets: 100% (56/56), 89.72 Kio | 1.91 Mio/s, fait.
|
||||||
|
Depuis https://github.com/jaysalvat/vegas
|
||||||
|
* branch master -> FETCH_HEAD
|
||||||
|
* [nouvelle branche] master -> origin/master
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Récupérer un sous-dossier d'un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ svn export --force https://github.com/jaysalvat/vegas/trunk/dist
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Télécharger la dernière release:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wget -O vegas.zip https://github.com/jaysalvat/vegas/archive/refs/heads/master.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Dernier tag d'un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -s 'https://github.com/go-gitea/gitea/tags/'|grep -Eo "$Version v[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}"|sort -r|head -n1
|
||||||
|
v1.22.0
|
||||||
|
|
||||||
|
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.[0].name'
|
||||||
|
v1.22.0-dev
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Récupérer tous les tags d'un repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.'
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "v1.22.0-dev",
|
||||||
|
"zipball_url": "https://api.github.com/repos/go-gitea/gitea/zipball/refs/tags/v1.22.0-dev",
|
||||||
|
"tarball_url": "https://api.github.com/repos/go-gitea/gitea/tarball/refs/tags/v1.22.0-dev",
|
||||||
|
"commit": {
|
||||||
|
"sha": "d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a",
|
||||||
|
"url": "https://api.github.com/repos/go-gitea/gitea/commits/d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a"
|
||||||
|
},
|
||||||
|
"node_id": "MDM6UmVmNzI0OTU1Nzk6cmVmcy90YWdzL3YxLjIyLjAtZGV2"
|
||||||
|
},
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/releases/latest | jq -r '.'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Repo privé
|
||||||
|
|
||||||
|
Sur Github.com, aller dans Réglages -> Personal access tokens
|
||||||
|
|
||||||
|
Créer un tokens (classic) avec repo, admin:org,admin:public_key,admin:repo_hook,admin:org_hook
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -H 'Authorization: token ghp_xxx' \
|
||||||
|
-H 'Accept: application/vnd.github.v3.raw' \
|
||||||
|
-O \
|
||||||
|
-L https://api.github.com/repos/Bruno21/bashbirds/contents/bashbirds.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl https://x-access-token:ghp_xxx@raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### GitHub CLI
|
||||||
|
|
||||||
|
https://docs.github.com/en/github-cli/github-cli/quickstart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ gh auth login
|
||||||
|
? What account do you want to log into? GitHub.com
|
||||||
|
? What is your preferred protocol for Git operations on this host? SSH
|
||||||
|
? Upload your SSH public key to your GitHub account? /Users/bruno/.ssh/id_rsa.pub
|
||||||
|
? Title for your SSH key: GitHub CLI
|
||||||
|
? How would you like to authenticate GitHub CLI? Login with a web browser
|
||||||
|
|
||||||
|
! First copy your one-time code: 2A9B-F28C
|
||||||
|
Press Enter to open github.com in your browser...
|
||||||
|
|
||||||
|
✓ Authentication complete.
|
||||||
|
- gh config set -h github.com git_protocol ssh
|
||||||
|
✓ Configured git protocol
|
||||||
|
✓ Uploaded the SSH key to your GitHub account: /Users/bruno/.ssh/id_rsa.pub
|
||||||
|
✓ Logged in as Bruno21
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Créer un repo sur Github.com:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gh repo create Bruno21/bashbirds --private
|
||||||
|
✓ Created repository Bruno21/bashbirds on GitHub
|
||||||
|
https://github.com/Bruno21/bashbirds
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Créer un repo sur Github.com (mode interactif):
|
||||||
|
|
||||||
|
Push an existing local repository to GitHub
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gh repo create
|
||||||
|
? What would you like to do? Push an existing local repository to GitHub
|
||||||
|
? Path to local repository .
|
||||||
|
? Repository name bashbirds
|
||||||
|
? Description
|
||||||
|
? Visibility Private
|
||||||
|
✓ Created repository Bruno21/bashbirds on GitHub
|
||||||
|
https://github.com/Bruno21/bashbirds
|
||||||
|
? Add a remote? Yes
|
||||||
|
? What should the new remote be called? github
|
||||||
|
✓ Added remote git@github.com:Bruno21/bashbirds.git
|
||||||
|
? Would you like to push commits from the current branch to "github"? Yes
|
||||||
|
The authenticity of host 'github.com (140.82.121.4)' can't be established.
|
||||||
|
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
|
||||||
|
This key is not known by any other names.
|
||||||
|
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
|
||||||
|
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
|
||||||
|
Énumération des objets: 13, fait.
|
||||||
|
Décompte des objets: 100% (13/13), fait.
|
||||||
|
Compression par delta en utilisant jusqu'à 8 fils d'exécution
|
||||||
|
Compression des objets: 100% (13/13), fait.
|
||||||
|
Écriture des objets: 100% (13/13), 80.34 Kio | 5.36 Mio/s, fait.
|
||||||
|
Total 13 (delta 5), réutilisés 0 (delta 0), réutilisés du paquet 0 (depuis 0)
|
||||||
|
remote: Resolving deltas: 100% (5/5), done.
|
||||||
|
To github.com:Bruno21/bashbirds.git
|
||||||
|
* [new branch] HEAD -> plus
|
||||||
|
la branche 'plus' est paramétrée pour suivre 'github/plus'.
|
||||||
|
✓ Pushed commits to git@github.com:Bruno21/bashbirds.git
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
@@ -83,6 +83,16 @@ GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmess
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installer une application:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GO111MODULE=on go install github.com/olivere/iterm2-imagetools/cmd/imgcat@latest
|
||||||
|
|
||||||
|
GO111MODULE=on go install github.com/olivere/iterm2-imagetools/cmd/imgls@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Créer une application:
|
### Créer une application:
|
||||||
|
|
||||||
Dans le dossier **src**, créer un nouveau dossier pour l'application **hello**:
|
Dans le dossier **src**, créer un nouveau dossier pour l'application **hello**:
|
||||||
|
|||||||
9
docs/Divers/iTerm2.md
Normal file
9
docs/Divers/iTerm2.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# iTerm2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Afficher des images dans iTerm:
|
||||||
|
|
||||||
|
https://iterm2.com/documentation-images.html
|
||||||
|
|
||||||
|
https://github.com/olivere/iterm2-imagetools
|
||||||
445
docs/Divers/images/avif.md
Normal file
445
docs/Divers/images/avif.md
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
# avif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<u>Convertisseur:</u>
|
||||||
|
|
||||||
|
- squoosh-cli
|
||||||
|
|
||||||
|
- avif-cli
|
||||||
|
- cavif-rs
|
||||||
|
- sharp
|
||||||
|
- [avif.io](https://avif.io/)
|
||||||
|
- [squoosh](https://squoosh.app/)
|
||||||
|
- [XnConvert](https://www.xnview.com/fr/xnconvert/)
|
||||||
|
- libheif
|
||||||
|
- avifenc
|
||||||
|
- go-avif
|
||||||
|
- AVIFQuickLook
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [squoosh-cli](https://www.npmjs.com/package/@squoosh/cli)
|
||||||
|
|
||||||
|
Supporte mozjpeg, webp, avif, jxl, wp2
|
||||||
|
|
||||||
|
Les options sont visibles dans [codecs.ts](https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm i -g @squoosh/cli
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Usage: squoosh-cli [options] <files...>
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-d, --output-dir <dir> Output directory (default: ".")
|
||||||
|
-s, --suffix <suffix> Append suffix to output files (default: "")
|
||||||
|
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
||||||
|
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
||||||
|
--resize [config] Resize the image before compressing
|
||||||
|
--quant [config] Reduce the number of colors used (aka. paletting)
|
||||||
|
--rotate [config] Rotate image
|
||||||
|
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
||||||
|
--webp [config] Use WebP to generate a .webp file with the given configuration
|
||||||
|
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
||||||
|
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
||||||
|
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
||||||
|
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
||||||
|
-h, --help display help for command
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ squoosh-cli --webp true -d webp ./2022-04-28_Biche_8247_8b.png
|
||||||
|
1/1 ✔ Squoosh results:
|
||||||
|
./2022-04-28_Biche_8247_8b.png: 2.18MB
|
||||||
|
└ webp/2022-04-28_Biche_8247_8b.webp → 75.00KB (3.37%)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ squoosh-cli --output-dir 'squoosh-cli' --mozjpeg '{
|
||||||
|
"quality":70,
|
||||||
|
"baseline":false,
|
||||||
|
"arithmetic":false,
|
||||||
|
"progressive":true,
|
||||||
|
"op timize_coding":true,
|
||||||
|
"smoothing":0,
|
||||||
|
"color_space":3,
|
||||||
|
"quant_table":3,
|
||||||
|
"trellis_multipass":false,
|
||||||
|
"trellis_opt_zero":false,
|
||||||
|
"trellis_opt_table":false,
|
||||||
|
"trellis_loops":1,
|
||||||
|
"auto_subsample":true,
|
||||||
|
"chroma_sub sample":2,
|
||||||
|
"separate_chroma_quality":false,
|
||||||
|
"chroma_quality":75
|
||||||
|
}' png/2022-04-16_Brocard_8990_8b.png
|
||||||
|
|
||||||
|
1/1 ✔ Squoosh results:
|
||||||
|
2022-04-16_Brocard_8990_8b.png: 1.93MB
|
||||||
|
└ 2022-04-16_Brocard_8990_8b.jpg → 83.67KB (4.24%)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -name "*.jpg" -exec bash -c 'file="{}"; squoosh-cli --mozjpeg auto "$file"' \;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ squoosh-cli --output-dir 'squoosh-cli' --avif '{
|
||||||
|
"cqLevel":33,
|
||||||
|
"cqAlphaLevel":-1,
|
||||||
|
"denoiseLevel":0,
|
||||||
|
"tileColsLog2":0,
|
||||||
|
"tileRowsLog2":0,
|
||||||
|
"speed":6,
|
||||||
|
"subsample":1,
|
||||||
|
"chromaDeltaQ":false,
|
||||||
|
"sharpness":0,
|
||||||
|
"tune":0
|
||||||
|
}' png/*.png
|
||||||
|
|
||||||
|
$ squoosh-cli --output-dir 'squoosh-cli' --avif "{}" png/*.png
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### ImageMagick
|
||||||
|
|
||||||
|
Mettre des options avec [define](https://imagemagick.org/script/defines.php).
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ magick -quality 75 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b.avif
|
||||||
|
|
||||||
|
❯ magick -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.avif
|
||||||
|
|
||||||
|
❯ convert -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.avif
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ for image in png/*.png ; do convert "$image" "${image%.*}.avif" ; done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [avif-cli](https://github.com/lovell/avif-cli)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install avif
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ npx avif --input="5_2019.jpg" --quality=70
|
||||||
|
|
||||||
|
❯ npx avif --input="**/*.{png}" --output="./avif-cli" --quality=70
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
set -o noglob
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
quality=70
|
||||||
|
#quality='lossless'
|
||||||
|
images=$(find ./png -type f -name *.png)
|
||||||
|
|
||||||
|
for img in $images; do
|
||||||
|
file=$(basename "$img")
|
||||||
|
avif_out="avif-cli"
|
||||||
|
|
||||||
|
#webp_out=$img.webp
|
||||||
|
|
||||||
|
if [ ! -f $avif_out ]; then
|
||||||
|
if [ "$quality" != "lossless" ]; then
|
||||||
|
npx avif --input="$img" --output="./$avif_out" --quality=$quality
|
||||||
|
else
|
||||||
|
npx avif --input="$img" --output="./$avif_out" --lossless
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [cavif-rs](https://github.com/kornelski/cavif-rs)
|
||||||
|
|
||||||
|
Convert JPEG/PNG images to AVIF image format (based on AV1/rav1e)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cargo install cavif
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ cavif --quality 90 2022-04-16_Brocard_8990_8b.png
|
||||||
|
2022-04-16_Brocard_8990_8b.avif: 524KB (522893B color, 0B alpha, 242B HEIF)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
set -o noglob
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
quality=70
|
||||||
|
images=$(find ./png -type f -name *.png)
|
||||||
|
|
||||||
|
for img in $images; do
|
||||||
|
file=$(basename "$img")
|
||||||
|
avif_out="cavif/${file%.*}_q$quality.avif"
|
||||||
|
|
||||||
|
if [ ! -f $avif_out ]; then
|
||||||
|
cavif --quality $quality $img -o $avif_out
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [sharp](https://sharp.pixelplumbing.com)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install sharp
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
sharp-example.js
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const sharp = require('sharp')
|
||||||
|
|
||||||
|
const convertToAVIF = () => {
|
||||||
|
sharp('path_to_image')
|
||||||
|
.toFormat('avif', {palette: true})
|
||||||
|
.toFile(__dirname + 'path_to_output_image')
|
||||||
|
}
|
||||||
|
|
||||||
|
convertToAVIF()
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# path_to_image : ./imgs/example.jpg
|
||||||
|
# path_to_output_image : /sharp-compressed/compressed-example.avif
|
||||||
|
|
||||||
|
$ node sharp-example.js
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [libheif](https://github.com/strukturag/libheif)
|
||||||
|
|
||||||
|
libheif is an ISO/IEC 23008-12:2017 HEIF and AVIF (AV1 Image File Format) file format decoder and encoder.
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
go env -w GO111MODULE=off
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ heif-enc 2022-04-28_Biche_8247_8b.png -A -o 2022-04-28_Biche_8247_8b_3.avif
|
||||||
|
libpng warning: iCCP: known incorrect sRGB profile
|
||||||
|
|
||||||
|
❯ heif-enc 2022-04-28_Biche_8247_8b.png -A -L -p chroma=444 --matrix_coefficients=0 -o 2022-04-28_Biche_8247_8b_3.avif (lossless)
|
||||||
|
libpng warning: iCCP: known incorrect sRGB profile
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Paramètres par défaut
|
||||||
|
|
||||||
|
❯ heif-enc -P
|
||||||
|
Parameters for encoder `x265 HEVC encoder (3.4+31-6722fce1f)`:
|
||||||
|
quality, default=50, [0;100]
|
||||||
|
lossless, default=false
|
||||||
|
preset, default=slow, { ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow,placebo }
|
||||||
|
tune, default=ssim, { psnr,ssim,grain,fastdecode }
|
||||||
|
tu-intra-depth, default=2, [1;4]
|
||||||
|
complexity, [0;100]
|
||||||
|
chroma, default=420, { 420,422,444 }
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
set -o noglob
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
#quality=70
|
||||||
|
quality='lossless'
|
||||||
|
images=$(find ./png -type f -name *.png)
|
||||||
|
|
||||||
|
for img in $images; do
|
||||||
|
file=$(basename "$img")
|
||||||
|
avif_out="heif-enc/${file%.*}_q$quality.avif"
|
||||||
|
|
||||||
|
#webp_out=$img.webp
|
||||||
|
|
||||||
|
if [ ! -f $avif_out ]; then
|
||||||
|
if [ "$quality" != "lossless" ]; then
|
||||||
|
heif-enc "$img" -A -q $quality -o "$avif_out"
|
||||||
|
else
|
||||||
|
heif-enc "$img" -A -L -p chroma=444 --matrix_coefficients=0 -o "$avif_out"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### avifenc
|
||||||
|
|
||||||
|
https://web.dev/compress-images-avif/
|
||||||
|
|
||||||
|
x64
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install joedrago/repo/avifenc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ avifenc --max 63 image.jpg image.avif
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### avifenc (libavif)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install libavif
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 8 thread
|
||||||
|
|
||||||
|
❯ avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim --jobs 8 png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ avifenc --speed 0 --min 25 --max 35 png/2022-04-16_Brocard_8990_8b.png avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||||
|
libpng warning: iCCP: known incorrect sRGB profile
|
||||||
|
Successfully loaded: png/2022-04-16_Brocard_8990_8b.png
|
||||||
|
AVIF to be written: (Lossy)
|
||||||
|
* Resolution : 1600x1067
|
||||||
|
* Bit Depth : 8
|
||||||
|
* Format : YUV444
|
||||||
|
* Alpha : Not premultiplied
|
||||||
|
* Range : Full
|
||||||
|
* Color Primaries: 2
|
||||||
|
* Transfer Char. : 2
|
||||||
|
* Matrix Coeffs. : 6
|
||||||
|
* ICC Profile : Present (3144 bytes)
|
||||||
|
* XMP Metadata : Absent (0 bytes)
|
||||||
|
* EXIF Metadata : Absent (0 bytes)
|
||||||
|
* Transformations: None
|
||||||
|
* Progressive : Unavailable
|
||||||
|
Encoding with AV1 codec 'aom' speed [0], color QP [25 (Medium) <-> 35 (Low)], alpha QP [0 (Lossless) <-> 0 (Lossless)], tileRowsLog2 [0], tileColsLog2 [0], 1 worker thread(s), please wait...
|
||||||
|
Encoded successfully.
|
||||||
|
* Color AV1 total size: 70133 bytes
|
||||||
|
* Alpha AV1 total size: 0 bytes
|
||||||
|
Wrote AVIF: avifenc/2022-04-16_Brocard_8990_8b.avif
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
set -o noglob
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
#quality=70
|
||||||
|
quality='lossless'
|
||||||
|
images=$(find ./png -type f -name *.png)
|
||||||
|
|
||||||
|
for img in $images; do
|
||||||
|
file=$(basename "$img")
|
||||||
|
avif_out="avifenc/${file%.*}_q$quality.avif"
|
||||||
|
|
||||||
|
#webp_out=$img.webp
|
||||||
|
|
||||||
|
if [ ! -f $avif_out ]; then
|
||||||
|
if [ "$quality" != "lossless" ]; then
|
||||||
|
#npx avif --input="$img" --output="./$avif_out" --quality=$quality
|
||||||
|
avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim --jobs 8 $img $avif_out
|
||||||
|
else
|
||||||
|
#npx avif --input="$img" --output="./$avif_out" --lossless
|
||||||
|
avifenc -l --jobs 8 $img $avif_out
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [go-avif](https://github.com/Kagami/go-avif)
|
||||||
|
|
||||||
|
go-avif implements AVIF (AV1 Still Image File Format) encoder for Go using libaom, the high quality AV1 codec.
|
||||||
|
x64
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [AVIFQuickLook](https://github.com/dreampiggy/AVIFQuickLook)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Bench
|
||||||
|
|
||||||
|
Conversion de 70 PNG 8bits:
|
||||||
|
|
||||||
|
| avif-cli | avifenc (libavif) | cavif | heif-enc (libheif) | squoosh-cli | |
|
||||||
|
| -------- | ----------------- | ----- | ------------------ | ----------- | ---- |
|
||||||
|
| 148s | 23s | 183s | 92s | 107s | |
|
||||||
|
|
||||||
511
docs/Divers/images/exif.md
Normal file
511
docs/Divers/images/exif.md
Normal file
@@ -0,0 +1,511 @@
|
|||||||
|
# exif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Supprimer les exifs:
|
||||||
|
|
||||||
|
#### Avec exiv2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# exiv2
|
||||||
|
|
||||||
|
exiv2 rm 12-2017.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Avec exiftool:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Crée une copie de l'original (12_2017-2.jpg_original)
|
||||||
|
|
||||||
|
exiftool -all= 12_2017-2.jpg
|
||||||
|
Warning: ICC_Profile deleted. Image colors may be affected - 12_2017-2.jpg
|
||||||
|
1 image files updated
|
||||||
|
|
||||||
|
|
||||||
|
# Sans backup
|
||||||
|
|
||||||
|
exiftool -overwrite_original -all= 12_2017-2.jpg_original
|
||||||
|
Warning: ICC_Profile deleted. Image colors may be affected - 12_2017-2.jpg_original
|
||||||
|
1 image files updated
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Voir les exifs:
|
||||||
|
|
||||||
|
Afficher tous les tags que exiftool reconnait:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -list
|
||||||
|
Available tags:
|
||||||
|
A100DataOffset AAFManufacturerID ABDate ABLabel ABRelatedNames AB_UID
|
||||||
|
ACoordOfBottomRightCorner ACoordOfTopRightCorner ADJDebugInfo
|
||||||
|
ADLBracketingStep ADLBracketingType AEAperture AEApertureSteps AEBAutoCancel
|
||||||
|
AEBBracketValue AEBSequence AEBSequenceAutoCancel AEBShotCount AEBXv
|
||||||
|
AEBracketingSteps AECAggressiveness AECCurrentExpIndex AECCurrentSensorLuma
|
||||||
|
.../...
|
||||||
|
Command-line shortcuts:
|
||||||
|
AllDates Canon ColorSpaceTags Common CommonIFD0 LargeTags MakerNotes Nikon
|
||||||
|
Unsafe ls-l
|
||||||
|
|
||||||
|
$ exiftool -list | grep Keyword
|
||||||
|
AppleDataOffsets AppleKeywords AppleMailDateReceived AppleMailDateSent
|
||||||
|
ArchivedFileName Arranger ArrangerKeywords ArtDirector ArtFilter
|
||||||
|
ComponentsInSequence Composer ComposerKeywords ComposerSortOrder Composers
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AllDates:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -AllDates 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
Date/Time Original : 2022:08:12 19:55:01
|
||||||
|
Create Date : 2022:08:12 19:55:01
|
||||||
|
Modify Date : 2022:08:14 21:05:21
|
||||||
|
```
|
||||||
|
|
||||||
|
Canon:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -Canon 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
Camera Model Name : Canon EOS R6
|
||||||
|
Date/Time Original : 2022:08:12 19:55:01
|
||||||
|
Shutter Speed : 1/1250
|
||||||
|
Aperture : 4.0
|
||||||
|
Metering Mode : Multi-segment
|
||||||
|
Exposure Compensation : +4/3
|
||||||
|
ISO : 320
|
||||||
|
Lens : EF600mm f/4L IS III USM
|
||||||
|
Focal Length : 600.0 mm
|
||||||
|
Image Size : 1600x1067
|
||||||
|
Flash : No Flash
|
||||||
|
White Balance : Manual
|
||||||
|
Sharpness : 40
|
||||||
|
Saturation : +6
|
||||||
|
Color Space : sRGB
|
||||||
|
File Size : 335 kB
|
||||||
|
Serial Number : 083021004471
|
||||||
|
```
|
||||||
|
|
||||||
|
Common:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -Common 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
File Size : 335 kB
|
||||||
|
Camera Model Name : Canon EOS R6
|
||||||
|
Date/Time Original : 2022:08:12 19:55:01
|
||||||
|
Image Size : 1600x1067
|
||||||
|
Focal Length : 600.0 mm
|
||||||
|
Shutter Speed : 1/1250
|
||||||
|
Aperture : 4.0
|
||||||
|
ISO : 320
|
||||||
|
White Balance : Manual
|
||||||
|
Flash : No Flash
|
||||||
|
```
|
||||||
|
|
||||||
|
CommonIFD0:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -CommonIFD0 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
Make : Canon
|
||||||
|
Camera Model Name : Canon EOS R6
|
||||||
|
Software : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||||
|
Modify Date : 2022:08:14 21:05:21
|
||||||
|
Artist : Pesenti
|
||||||
|
Copyright : clicclac.info
|
||||||
|
```
|
||||||
|
|
||||||
|
LargeTags:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -LargeTags 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
EXIF : (Binary data 20300 bytes, use -b option to extract)
|
||||||
|
ICC Profile : (Binary data 3144 bytes, use -b option to extract)
|
||||||
|
IPTC : (Binary data 192 bytes, use -b option to extract)
|
||||||
|
Thumbnail Image : (Binary data 19320 bytes, use -b option to extract)
|
||||||
|
XMP : (Binary data 13314 bytes, use -b option to extract)
|
||||||
|
```
|
||||||
|
|
||||||
|
ls-l:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -ls-l 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
File Permissions : -rw-r--r--
|
||||||
|
File Hard Links : 1
|
||||||
|
File User ID : bruno
|
||||||
|
File Group ID : staff
|
||||||
|
File Size : 334966
|
||||||
|
File Modification Date/Time : 2022:08:14 21:05:22+02:00
|
||||||
|
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
Sans option:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
ExifTool Version Number : 12.42
|
||||||
|
File Name : 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
Directory : .
|
||||||
|
File Size : 335 kB
|
||||||
|
File Modification Date/Time : 2022:08:14 21:05:22+02:00
|
||||||
|
File Access Date/Time : 2022:08:15 08:56:12+02:00
|
||||||
|
File Inode Change Date/Time : 2022:08:15 08:56:10+02:00
|
||||||
|
File Permissions : -rw-r--r--
|
||||||
|
File Type : JPEG
|
||||||
|
File Type Extension : jpg
|
||||||
|
MIME Type : image/jpeg
|
||||||
|
Exif Byte Order : Little-endian (Intel, II)
|
||||||
|
Make : Canon
|
||||||
|
Camera Model Name : Canon EOS R6
|
||||||
|
X Resolution : 72
|
||||||
|
Y Resolution : 72
|
||||||
|
Resolution Unit : inches
|
||||||
|
Software : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||||
|
Modify Date : 2022:08:14 21:05:21
|
||||||
|
Artist : Pesenti
|
||||||
|
Copyright : clicclac.info
|
||||||
|
Exposure Time : 1/1250
|
||||||
|
F Number : 4.0
|
||||||
|
Exposure Program : Shutter speed priority AE
|
||||||
|
ISO : 320
|
||||||
|
Sensitivity Type : Recommended Exposure Index
|
||||||
|
Recommended Exposure Index : 320
|
||||||
|
Exif Version : 0231
|
||||||
|
Date/Time Original : 2022:08:12 19:55:01
|
||||||
|
Create Date : 2022:08:12 19:55:01
|
||||||
|
Offset Time : +02:00
|
||||||
|
Offset Time Original : +02:00
|
||||||
|
Offset Time Digitized : +02:00
|
||||||
|
Shutter Speed Value : 1/1250
|
||||||
|
Aperture Value : 4.0
|
||||||
|
Exposure Compensation : +4/3
|
||||||
|
Max Aperture Value : 4.2
|
||||||
|
Metering Mode : Multi-segment
|
||||||
|
Flash : No Flash
|
||||||
|
Focal Length : 600.0 mm
|
||||||
|
Sub Sec Time Original : 29
|
||||||
|
Sub Sec Time Digitized : 29
|
||||||
|
Color Space : sRGB
|
||||||
|
Focal Plane X Resolution : 1520
|
||||||
|
Focal Plane Y Resolution : 1520
|
||||||
|
Focal Plane Resolution Unit : cm
|
||||||
|
Custom Rendered : Normal
|
||||||
|
Exposure Mode : Auto
|
||||||
|
White Balance : Manual
|
||||||
|
Scene Capture Type : Standard
|
||||||
|
Serial Number : 083021004471
|
||||||
|
Lens Info : 600mm f/?
|
||||||
|
Lens Model : EF600mm f/4L IS III USM
|
||||||
|
Lens Serial Number : 7110000203
|
||||||
|
Compression : JPEG (old-style)
|
||||||
|
Thumbnail Offset : 992
|
||||||
|
Thumbnail Length : 19320
|
||||||
|
Displayed Units X : inches
|
||||||
|
Displayed Units Y : inches
|
||||||
|
Current IPTC Digest : 118667209c5b6206903e30011744a4a4
|
||||||
|
Coded Character Set : UTF8
|
||||||
|
Application Record Version : 4
|
||||||
|
Keywords : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||||
|
Time Created : 19:55:01+02:00
|
||||||
|
Digital Creation Date : 2022:08:12
|
||||||
|
Digital Creation Time : 19:55:01+02:00
|
||||||
|
By-line : Pesenti
|
||||||
|
Copyright Notice : clicclac.info
|
||||||
|
Copyright Flag : True
|
||||||
|
Photoshop Thumbnail : (Binary data 19320 bytes, use -b option to extract)
|
||||||
|
IPTC Digest : 118667209c5b6206903e30011744a4a4
|
||||||
|
Profile CMM Type : Linotronic
|
||||||
|
Profile Version : 2.1.0
|
||||||
|
Profile Class : Display Device Profile
|
||||||
|
Color Space Data : RGB
|
||||||
|
Profile Connection Space : XYZ
|
||||||
|
Profile Date Time : 1998:02:09 06:49:00
|
||||||
|
Profile File Signature : acsp
|
||||||
|
Primary Platform : Microsoft Corporation
|
||||||
|
CMM Flags : Not Embedded, Independent
|
||||||
|
Device Manufacturer : Hewlett-Packard
|
||||||
|
Device Model : sRGB
|
||||||
|
Device Attributes : Reflective, Glossy, Positive, Color
|
||||||
|
Rendering Intent : Perceptual
|
||||||
|
Connection Space Illuminant : 0.9642 1 0.82491
|
||||||
|
Profile Creator : Hewlett-Packard
|
||||||
|
Profile ID : 0
|
||||||
|
Profile Copyright : Copyright (c) 1998 Hewlett-Packard Company
|
||||||
|
Profile Description : sRGB IEC61966-2.1
|
||||||
|
Media White Point : 0.95045 1 1.08905
|
||||||
|
Media Black Point : 0 0 0
|
||||||
|
Red Matrix Column : 0.43607 0.22249 0.01392
|
||||||
|
Green Matrix Column : 0.38515 0.71687 0.09708
|
||||||
|
Blue Matrix Column : 0.14307 0.06061 0.7141
|
||||||
|
Device Mfg Desc : IEC http://www.iec.ch
|
||||||
|
Device Model Desc : IEC 61966-2.1 Default RGB colour space - sRGB
|
||||||
|
Viewing Cond Desc : Reference Viewing Condition in IEC61966-2.1
|
||||||
|
Viewing Cond Illuminant : 19.6445 20.3718 16.8089
|
||||||
|
Viewing Cond Surround : 3.92889 4.07439 3.36179
|
||||||
|
Viewing Cond Illuminant Type : D50
|
||||||
|
Luminance : 76.03647 80 87.12462
|
||||||
|
Measurement Observer : CIE 1931
|
||||||
|
Measurement Backing : 0 0 0
|
||||||
|
Measurement Geometry : Unknown
|
||||||
|
Measurement Flare : 0.999%
|
||||||
|
Measurement Illuminant : D65
|
||||||
|
Technology : Cathode Ray Tube Display
|
||||||
|
Red Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||||
|
Green Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||||
|
Blue Tone Reproduction Curve : (Binary data 2060 bytes, use -b option to extract)
|
||||||
|
XMP Toolkit : Adobe XMP Core 7.0-c000 1.000000, 0000/00/00-00:00:00
|
||||||
|
Metadata Date : 2022:08:14 21:05:21+02:00
|
||||||
|
Rating : 4
|
||||||
|
Label : Selection
|
||||||
|
Creator Tool : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||||
|
Format : image/jpeg
|
||||||
|
Lens : EF600mm f/4L IS III USM
|
||||||
|
Image Number : 0
|
||||||
|
Approximate Focus Distance : 46.1
|
||||||
|
Flash Compensation : 0
|
||||||
|
Firmware : 1.5.2
|
||||||
|
Distortion Correction Already Applied: True
|
||||||
|
Lateral Chromatic Aberration Correction Already Applied: True
|
||||||
|
Vignette Correction Already Applied: True
|
||||||
|
Date Created : 2022:08:12 19:55:01.29+02:00
|
||||||
|
Document ID : xmp.did:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||||
|
Preserved File Name : IMG_6405.CR3
|
||||||
|
Original Document ID : C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||||
|
Instance ID : xmp.iid:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||||
|
Marked : True
|
||||||
|
Raw File Name : 2022-08-12_Chevreuils_6405.CR3
|
||||||
|
Version : 14.4.1
|
||||||
|
Process Version : 11.0
|
||||||
|
Color Temperature : 6050
|
||||||
|
Tint : +4
|
||||||
|
Exposure 2012 : +1.50
|
||||||
|
Contrast 2012 : 0
|
||||||
|
Highlights 2012 : +13
|
||||||
|
Shadows 2012 : +8
|
||||||
|
Whites 2012 : +12
|
||||||
|
Blacks 2012 : 0
|
||||||
|
Texture : +13
|
||||||
|
Clarity 2012 : +16
|
||||||
|
Dehaze : 0
|
||||||
|
Vibrance : +9
|
||||||
|
Saturation : +6
|
||||||
|
Parametric Shadows : 0
|
||||||
|
Parametric Darks : 0
|
||||||
|
Parametric Lights : 0
|
||||||
|
Parametric Highlights : 0
|
||||||
|
Parametric Shadow Split : 25
|
||||||
|
Parametric Midtone Split : 50
|
||||||
|
Parametric Highlight Split : 75
|
||||||
|
Sharpness : 40
|
||||||
|
Sharpen Radius : +1.0
|
||||||
|
Sharpen Detail : 25
|
||||||
|
Sharpen Edge Masking : 0
|
||||||
|
Luminance Smoothing : 0
|
||||||
|
Color Noise Reduction : 25
|
||||||
|
Color Noise Reduction Detail : 50
|
||||||
|
Color Noise Reduction Smoothness: 50
|
||||||
|
Hue Adjustment Red : 0
|
||||||
|
Hue Adjustment Orange : 0
|
||||||
|
Hue Adjustment Yellow : 0
|
||||||
|
Hue Adjustment Green : 0
|
||||||
|
Hue Adjustment Aqua : 0
|
||||||
|
Hue Adjustment Blue : 0
|
||||||
|
Hue Adjustment Purple : 0
|
||||||
|
Hue Adjustment Magenta : 0
|
||||||
|
Saturation Adjustment Red : 0
|
||||||
|
Saturation Adjustment Orange : 0
|
||||||
|
Saturation Adjustment Yellow : 0
|
||||||
|
Saturation Adjustment Green : 0
|
||||||
|
Saturation Adjustment Aqua : 0
|
||||||
|
Saturation Adjustment Blue : 0
|
||||||
|
Saturation Adjustment Purple : 0
|
||||||
|
Saturation Adjustment Magenta : 0
|
||||||
|
Luminance Adjustment Red : 0
|
||||||
|
Luminance Adjustment Orange : 0
|
||||||
|
Luminance Adjustment Yellow : 0
|
||||||
|
Luminance Adjustment Green : 0
|
||||||
|
Luminance Adjustment Aqua : 0
|
||||||
|
Luminance Adjustment Blue : 0
|
||||||
|
Luminance Adjustment Purple : 0
|
||||||
|
Luminance Adjustment Magenta : 0
|
||||||
|
Split Toning Shadow Hue : 0
|
||||||
|
Split Toning Shadow Saturation : 0
|
||||||
|
Split Toning Highlight Hue : 0
|
||||||
|
Split Toning Highlight Saturation: 0
|
||||||
|
Split Toning Balance : 0
|
||||||
|
Color Grade Midtone Hue : 0
|
||||||
|
Color Grade Midtone Sat : 0
|
||||||
|
Color Grade Shadow Lum : 0
|
||||||
|
Color Grade Midtone Lum : 0
|
||||||
|
Color Grade Highlight Lum : 0
|
||||||
|
Color Grade Blending : 50
|
||||||
|
Color Grade Global Hue : 0
|
||||||
|
Color Grade Global Sat : 0
|
||||||
|
Color Grade Global Lum : 0
|
||||||
|
Auto Lateral CA : 1
|
||||||
|
Lens Profile Enable : 1
|
||||||
|
Lens Manual Distortion Amount : 0
|
||||||
|
Vignette Amount : 0
|
||||||
|
Defringe Purple Amount : 0
|
||||||
|
Defringe Purple Hue Lo : 30
|
||||||
|
Defringe Purple Hue Hi : 70
|
||||||
|
Defringe Green Amount : 0
|
||||||
|
Defringe Green Hue Lo : 40
|
||||||
|
Defringe Green Hue Hi : 60
|
||||||
|
Perspective Upright : 0
|
||||||
|
Perspective Vertical : 0
|
||||||
|
Perspective Horizontal : 0
|
||||||
|
Perspective Rotate : 0.0
|
||||||
|
Perspective Aspect : 0
|
||||||
|
Perspective Scale : 100
|
||||||
|
Perspective X : 0.00
|
||||||
|
Perspective Y : 0.00
|
||||||
|
Grain Amount : 0
|
||||||
|
Post Crop Vignette Amount : 0
|
||||||
|
Shadow Tint : 0
|
||||||
|
Red Hue : 0
|
||||||
|
Red Saturation : 0
|
||||||
|
Green Hue : 0
|
||||||
|
Green Saturation : 0
|
||||||
|
Blue Hue : 0
|
||||||
|
Blue Saturation : 0
|
||||||
|
Override Look Vignette : False
|
||||||
|
Tone Curve Name 2012 : Custom
|
||||||
|
Camera Profile : Adobe Standard
|
||||||
|
Camera Profile Digest : 441F68BD6BC3369B59256B103CE2CD5C
|
||||||
|
Lens Profile Setup : Custom
|
||||||
|
Lens Profile Name : Adobe (Canon EF 600mm f/4L IS III USM)
|
||||||
|
Lens Profile Filename : Canon (Canon EF 600mm f4L IS III USM) - RAW.lcp
|
||||||
|
Lens Profile Digest : A58C82ECDC77A3A3EAD3EA167A0DED19
|
||||||
|
Lens Profile Is Embedded : False
|
||||||
|
Lens Profile Distortion Scale : 100
|
||||||
|
Lens Profile Vignetting Scale : 100
|
||||||
|
Has Settings : True
|
||||||
|
Crop Top : 0.174748
|
||||||
|
Crop Left : 0
|
||||||
|
Crop Bottom : 1
|
||||||
|
Crop Right : 0.825252
|
||||||
|
Crop Angle : 0
|
||||||
|
Crop Constrain To Warp : 0
|
||||||
|
Has Crop : True
|
||||||
|
Already Applied : True
|
||||||
|
Creator : Pesenti
|
||||||
|
Rights : clicclac.info
|
||||||
|
Subject : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||||
|
History Action : derived, saved
|
||||||
|
History Parameters : converted from image/x-canon-cr3 to image/jpeg, saved to new location
|
||||||
|
History Instance ID : xmp.iid:3de77c21-df1e-4bd1-9559-2cf2841fbb35
|
||||||
|
History When : 2022:08:14 21:05:21+02:00
|
||||||
|
History Software Agent : Adobe Photoshop Lightroom Classic 11.4.1 (Macintosh)
|
||||||
|
History Changed : /
|
||||||
|
Derived From Document ID : C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||||
|
Derived From Original Document ID: C63EBF3F8F3BED8866DB0BDC4A24F281
|
||||||
|
Weighted Flat Subject : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||||
|
Tone Curve PV2012 : 0, 0, 31, 42, 56, 88, 191, 208, 255, 255
|
||||||
|
Tone Curve PV2012 Red : 0, 0, 255, 255
|
||||||
|
Tone Curve PV2012 Green : 0, 0, 255, 255
|
||||||
|
Tone Curve PV2012 Blue : 0, 0, 255, 255
|
||||||
|
Look Name : Adobe Color
|
||||||
|
Look Amount : 1
|
||||||
|
Look UUID : B952C231111CD8E0ECCF14B86BAA7077
|
||||||
|
Look Supports Amount : false
|
||||||
|
Look Supports Monochrome : false
|
||||||
|
Look Supports Output Referred : false
|
||||||
|
Look Group : Profiles
|
||||||
|
Look Parameters Version : 14.4.1
|
||||||
|
Look Parameters Process Version : 11.0
|
||||||
|
Look Parameters Convert To Grayscale: False
|
||||||
|
Look Parameters Camera Profile : Adobe Standard
|
||||||
|
Look Parameters Look Table : E1095149FDB39D7A057BAB208837E2E1
|
||||||
|
Look Parameters Tone Curve PV2012: 0, 0, 22, 16, 40, 35, 127, 127, 224, 230, 240, 246, 255, 255
|
||||||
|
Look Parameters Tone Curve PV2012 Red: 0, 0, 255, 255
|
||||||
|
Look Parameters Tone Curve PV2012 Green: 0, 0, 255, 255
|
||||||
|
Look Parameters Tone Curve PV2012 Blue: 0, 0, 255, 255
|
||||||
|
DCT Encode Version : 100
|
||||||
|
APP14 Flags 0 : [14], Encoded with Blend=1 downsampling
|
||||||
|
APP14 Flags 1 : (none)
|
||||||
|
Color Transform : YCbCr
|
||||||
|
Comment : Optimized by JPEGmini 3.18.9.220874607-AV 0xf034c802
|
||||||
|
Image Width : 1600
|
||||||
|
Image Height : 1067
|
||||||
|
Encoding Process : Baseline DCT, Huffman coding
|
||||||
|
Bits Per Sample : 8
|
||||||
|
Color Components : 3
|
||||||
|
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
|
||||||
|
Aperture : 4.0
|
||||||
|
Image Size : 1600x1067
|
||||||
|
Megapixels : 1.7
|
||||||
|
Scale Factor To 35 mm Equivalent: 3.4
|
||||||
|
Shutter Speed : 1/1250
|
||||||
|
Create Date : 2022:08:12 19:55:01.29+02:00
|
||||||
|
Date/Time Original : 2022:08:12 19:55:01.29+02:00
|
||||||
|
Modify Date : 2022:08:14 21:05:21+02:00
|
||||||
|
Thumbnail Image : (Binary data 19320 bytes, use -b option to extract)
|
||||||
|
Date/Time Created : 2022:08:12 19:55:01+02:00
|
||||||
|
Digital Creation Date/Time : 2022:08:12 19:55:01+02:00
|
||||||
|
Circle Of Confusion : 0.009 mm
|
||||||
|
Depth Of Field : 0.41 m (45.90 - 46.31 m)
|
||||||
|
Field Of View : 1.0 deg
|
||||||
|
Focal Length : 600.0 mm (35 mm equivalent: 2051.8 mm)
|
||||||
|
Hyperfocal Distance : 10243.22 m
|
||||||
|
Light Value : 12.6
|
||||||
|
Lens ID : Canon EF 600mm f/4L IS III USM
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Voir les infos GPS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# zsh
|
||||||
|
❯ exiftool 12_2017.jpg -'GPS*'
|
||||||
|
|
||||||
|
# bash
|
||||||
|
❯ exiftool 12_2017.jpg -GPS*
|
||||||
|
GPS Version ID : 2.2.0.0
|
||||||
|
GPS Latitude Ref : North
|
||||||
|
GPS Longitude Ref : East
|
||||||
|
GPS Altitude : 0.7094 m
|
||||||
|
GPS Latitude : 43 deg 31' 30.64" N
|
||||||
|
GPS Longitude : 4 deg 38' 15.31" E
|
||||||
|
GPS Position : 43 deg 31' 30.64" N, 4 deg 38' 15.31" E
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Mots-clé:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exiftool -s -Keywords 2022-08-12_Chevreuils_6405.jpg
|
||||||
|
Keywords : accouplement, brocard, capreolus capreolus, chevrette, chevreuil, rut
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprimer les coord. GPS:
|
||||||
|
|
||||||
|
❯ exiftool -gps:all= 12_2017.jpg
|
||||||
|
1 image files updated
|
||||||
|
|
||||||
|
❯ exiftool 12_2017.jpg -'GPS*'
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Restaurer l'original:
|
||||||
|
|
||||||
|
❯ exiftool -restore_original 12_2017.jpg
|
||||||
|
1 image files found
|
||||||
|
1 image files restored from original
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
https://adamtheautomator.com/exiftool/
|
||||||
16
docs/Divers/images/heic.md
Normal file
16
docs/Divers/images/heic.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# heic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### sips (scriptable image processing system)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sips -s format heic -s formatOptions 50 png/2022-04-16_Brocard_8990_8b.png --out sips/2022-04-16_Brocard_8990_8b.heic
|
||||||
|
/Users/bruno/Desktop/avif/png/2022-04-16_Brocard_8990_8b.png
|
||||||
|
/Users/bruno/Desktop/avif/sips/2022-04-16_Brocard_8990_8b.heic
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
heif-enc - convert image to HEIC/HEIF
|
||||||
51
docs/Divers/images/mozjpeg.md
Normal file
51
docs/Divers/images/mozjpeg.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# mozjpeg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install mozjpeg
|
||||||
|
```
|
||||||
|
|
||||||
|
Si libjpeg est déjà installé, cjpeg et jpegtran sont déjà présent. Il faut linker les binaires de mozjpeg:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ln -s /opt/homebrew/opt/mozjpeg/bin/cjpeg /usr/local/bin/mozcjpeg
|
||||||
|
ln -s /opt/homebrew/opt/mozjpeg/bin/jpegtran /usr/local/bin/mozjpegtran
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Usage:
|
||||||
|
|
||||||
|
**cjpeg** = lossy (avec pertes).
|
||||||
|
|
||||||
|
**cjpeg** accepte les image aux formats JPEG, PNG, BMP et Targa.
|
||||||
|
|
||||||
|
<u>Options:</u>
|
||||||
|
|
||||||
|
- -quality (entre 5 et 95)(défaut 75)
|
||||||
|
- -progressive (par défaut) sinon -baseline
|
||||||
|
- -optimize (par défaut)
|
||||||
|
- -outfile <name>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**jpegtran** = lossless (sans pertes).
|
||||||
|
|
||||||
|
**jpegtran** accepte les image au format JPEG.
|
||||||
|
|
||||||
|
<u>Options:</u>
|
||||||
|
|
||||||
|
- -progressive (défaut) sinon -baseline
|
||||||
|
- -optimize (par défaut)
|
||||||
|
- -outfile <name>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ mozcjpeg 2022-05-10_Cerf_8869-CR3_DxO_DeepPRIME.png > 5_2022.jpg
|
||||||
|
libpng warning: iCCP: known incorrect sRGB profile
|
||||||
|
```
|
||||||
|
|
||||||
273
docs/Divers/images/webp.md
Normal file
273
docs/Divers/images/webp.md
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
# webp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Convertisseurs:
|
||||||
|
|
||||||
|
- Photoshop 23.2 +
|
||||||
|
- XnConvert
|
||||||
|
- WebPShop
|
||||||
|
- [cwebp](#cwebp)
|
||||||
|
- [squoosh-cli](#squoosh)
|
||||||
|
- [ImageMagick](#ImageMagick)
|
||||||
|
- WebpConvert
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### <a id="cwebp"></a>cwebp
|
||||||
|
|
||||||
|
Doc: https://developers.google.com/speed/webp/docs/cwebp
|
||||||
|
|
||||||
|
App: https://developers.google.com/speed/webp/docs/precompiled
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install webp
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ cwebp -longhelp
|
||||||
|
Usage:
|
||||||
|
cwebp [-preset <...>] [options] in_file [-o out_file]
|
||||||
|
|
||||||
|
If input size (-s) for an image is not specified, it is
|
||||||
|
assumed to be a PNG, JPEG, TIFF or WebP file.
|
||||||
|
Note: Animated PNG and WebP files are not supported.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h / -help ............. short help
|
||||||
|
-H / -longhelp ......... long help
|
||||||
|
-q <float> ............. quality factor (0:small..100:big), default=75
|
||||||
|
-alpha_q <int> ......... transparency-compression quality (0..100),
|
||||||
|
default=100
|
||||||
|
-preset <string> ....... preset setting, one of:
|
||||||
|
default, photo, picture,
|
||||||
|
drawing, icon, text
|
||||||
|
-preset must come first, as it overwrites other parameters
|
||||||
|
-z <int> ............... activates lossless preset with given
|
||||||
|
level in [0:fast, ..., 9:slowest]
|
||||||
|
|
||||||
|
-m <int> ............... compression method (0=fast, 6=slowest), default=4
|
||||||
|
-segments <int> ........ number of segments to use (1..4), default=4
|
||||||
|
-size <int> ............ target size (in bytes)
|
||||||
|
-psnr <float> .......... target PSNR (in dB. typically: 42)
|
||||||
|
|
||||||
|
-s <int> <int> ......... input size (width x height) for YUV
|
||||||
|
-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50
|
||||||
|
-f <int> ............... filter strength (0=off..100), default=60
|
||||||
|
-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0
|
||||||
|
-strong ................ use strong filter instead of simple (default)
|
||||||
|
-nostrong .............. use simple filter instead of strong
|
||||||
|
-sharp_yuv ............. use sharper (and slower) RGB->YUV conversion
|
||||||
|
-partition_limit <int> . limit quality to fit the 512k limit on
|
||||||
|
the first partition (0=no degradation ... 100=full)
|
||||||
|
-pass <int> ............ analysis pass number (1..10)
|
||||||
|
-qrange <min> <max> .... specifies the permissible quality range
|
||||||
|
(default: 0 100)
|
||||||
|
-crop <x> <y> <w> <h> .. crop picture with the given rectangle
|
||||||
|
-resize <w> <h> ........ resize picture (after any cropping)
|
||||||
|
-mt .................... use multi-threading if available
|
||||||
|
-low_memory ............ reduce memory usage (slower encoding)
|
||||||
|
-map <int> ............. print map of extra info
|
||||||
|
-print_psnr ............ prints averaged PSNR distortion
|
||||||
|
-print_ssim ............ prints averaged SSIM distortion
|
||||||
|
-print_lsim ............ prints local-similarity distortion
|
||||||
|
-d <file.pgm> .......... dump the compressed output (PGM file)
|
||||||
|
-alpha_method <int> .... transparency-compression method (0..1), default=1
|
||||||
|
-alpha_filter <string> . predictive filtering for alpha plane,
|
||||||
|
one of: none, fast (default) or best
|
||||||
|
-exact ................. preserve RGB values in transparent area, default=off
|
||||||
|
-blend_alpha <hex> ..... blend colors against background color
|
||||||
|
expressed as RGB values written in
|
||||||
|
hexadecimal, e.g. 0xc0e0d0 for red=0xc0
|
||||||
|
green=0xe0 and blue=0xd0
|
||||||
|
-noalpha ............... discard any transparency information
|
||||||
|
-lossless .............. encode image losslessly, default=off
|
||||||
|
-near_lossless <int> ... use near-lossless image
|
||||||
|
preprocessing (0..100=off), default=100
|
||||||
|
-hint <string> ......... specify image characteristics hint,
|
||||||
|
one of: photo, picture or graph
|
||||||
|
|
||||||
|
-metadata <string> ..... comma separated list of metadata to
|
||||||
|
copy from the input to the output if present.
|
||||||
|
Valid values: all, none (default), exif, icc, xmp
|
||||||
|
|
||||||
|
-short ................. condense printed message
|
||||||
|
-quiet ................. don't print anything
|
||||||
|
-version ............... print version number and exit
|
||||||
|
-noasm ................. disable all assembly optimizations
|
||||||
|
-v ..................... verbose, e.g. print encoding/decoding times
|
||||||
|
-progress .............. report encoding progress
|
||||||
|
|
||||||
|
Experimental Options:
|
||||||
|
-jpeg_like ............. roughly match expected JPEG size
|
||||||
|
-af .................... auto-adjust filter strength
|
||||||
|
-pre <int> ............. pre-processing filter
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cwebp -q 90 image.png -o image.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for infile in Screenshot*.png
|
||||||
|
do
|
||||||
|
echo $infile
|
||||||
|
base=$(basename "$infile" .png)
|
||||||
|
cwebp -preset picture -v "$infile" -o "$base".webp
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cwebp png/2022-04-16_Brocard_8990_8b.png -q 75 -mt -o cwebp/2022-04-16_Brocard_8990_8b_q75.webp
|
||||||
|
|
||||||
|
$ cwebp png/2022-04-16_Brocard_8990_8b.png -preset photo -mt -o cwebp/2022-04-16_Brocard_8990_8b_preset-photo.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# lossless
|
||||||
|
|
||||||
|
$ cwebp png/2022-04-16_Brocard_8990_8b.png -z 9 -mt -o cwebp/2022-04-16_Brocard_8990_8b.webp
|
||||||
|
|
||||||
|
$ cwebp png/2022-04-16_Brocard_8990_8b.png -lossless -m 6 -q 100 -mt -o cwebp/2022-04-16_Brocard_8990_8b.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### <a id="squoosh"></a>[squoosh-cli](https://www.npmjs.com/package/@squoosh/cli)
|
||||||
|
|
||||||
|
Supporte mozjpeg, webp, avif, jxl, wp2
|
||||||
|
|
||||||
|
Les options sont visibles dans [codecs.ts](https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm i -g @squoosh/cli
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Usage: squoosh-cli [options] <files...>
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-d, --output-dir <dir> Output directory (default: ".")
|
||||||
|
-s, --suffix <suffix> Append suffix to output files (default: "")
|
||||||
|
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
||||||
|
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
||||||
|
--resize [config] Resize the image before compressing
|
||||||
|
--quant [config] Reduce the number of colors used (aka. paletting)
|
||||||
|
--rotate [config] Rotate image
|
||||||
|
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
||||||
|
--webp [config] Use WebP to generate a .webp file with the given configuration
|
||||||
|
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
||||||
|
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
||||||
|
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
||||||
|
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
||||||
|
-h, --help display help for command
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ squoosh-cli --webp true -d webp ./2022-04-28_Biche_8247_8b.png
|
||||||
|
1/1 ✔ Squoosh results:
|
||||||
|
./2022-04-28_Biche_8247_8b.png: 2.18MB
|
||||||
|
└ webp/2022-04-28_Biche_8247_8b.webp → 75.00KB (3.37%)
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ squoosh-cli --output-dir 'squoosh-cli' --webp '{
|
||||||
|
"quality":75,
|
||||||
|
"target_size":0,
|
||||||
|
"target_PSNR":0,
|
||||||
|
"method":4,
|
||||||
|
"sns_strength":50,
|
||||||
|
"filter_strength":60,
|
||||||
|
"filter_sharpness":0,
|
||||||
|
"filter_type":1,
|
||||||
|
"partitions":0,
|
||||||
|
"segments":4,
|
||||||
|
"pass":1,
|
||||||
|
"show_compressed":0,
|
||||||
|
"preprocessing":0,
|
||||||
|
"autofilter":0,
|
||||||
|
"partition_limit":0,
|
||||||
|
"alpha_compression":1,
|
||||||
|
"alpha_filtering":1,
|
||||||
|
"alpha_quality":100,
|
||||||
|
"lossless":0,
|
||||||
|
"exact":0,
|
||||||
|
"image_hint":0,
|
||||||
|
"emulate_jpeg_size":0,
|
||||||
|
"thread_level":0,
|
||||||
|
"low_memory":0,
|
||||||
|
"near_lossless":100,
|
||||||
|
"use_delta_palette":0,
|
||||||
|
"use_sharp_yuv":0
|
||||||
|
}' png/*.png
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### <a id="ImageMagick"></a>ImageMagick
|
||||||
|
|
||||||
|
[Webp options](https://imagemagick.org/script/webp.php).
|
||||||
|
|
||||||
|
[-define](https://imagemagick.org/script/defines.php) command-line option.
|
||||||
|
|
||||||
|
[Command-line tools](https://imagemagick.org/script/command-line-tools.php)
|
||||||
|
|
||||||
|
[Command-line Options](https://imagemagick.org/script/command-line-options.php#quality)
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ magick -quality 75 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b.webp
|
||||||
|
|
||||||
|
❯ magick -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.webp
|
||||||
|
|
||||||
|
❯ convert -define heic:speed=2 png/2022-04-16_Brocard_8990_8b.png magick/2022-04-16_Brocard_8990_8b_2.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
magick png/2022-04-16_Brocard_8990_8b.png -quality 50 -define webp:lossless=true png/2022-04-16_Brocard_8990_8b_ll-true.webp
|
||||||
|
|
||||||
|
magick png/2022-04-16_Brocard_8990_8b.png -quality 90 -define webp:lossless=false png/2022-04-16_Brocard_8990_8b_ll-false.webp
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### [WebpConvert](https://github.com/rizqirizqi/webpconvert)
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install -g webpconvert
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Options:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
-p, --prefix Specify the prefix of output filename. [chaîne de caractères] [défaut : ""]
|
||||||
|
-s, --suffix Specify the suffix of output filename. [chaîne de caractères] [défaut : ""]
|
||||||
|
-q, --quality Specify the quality of webp image. Lower values yield better compression but the least image quality. [nombre] [défaut : 80]
|
||||||
|
-m, --mute Disable output messages. [booléen] [défaut : false]
|
||||||
|
-h, --help Affiche l'aide [booléen]
|
||||||
|
-v, --version Affiche le numéro de version [booléen]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ webpconvert -q 80 --suffix="webpconvert-q80" png/2022-05-10_Cerf_8817_8b.png webpconvert/2022-05-10_Cerf_8817_8b.webp
|
||||||
|
|
||||||
|
❯ webpconvert -q 80 --suffix="webpconvert-q80" png/ webpconvert/
|
||||||
|
```
|
||||||
|
|
||||||
101
docs/Divers/joplin.md
Normal file
101
docs/Divers/joplin.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# Joplin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Joplin server
|
||||||
|
|
||||||
|
#### Docker:
|
||||||
|
|
||||||
|
`docker-compose.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:13.1
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /Users/bruno/Documents/docker/joplin-data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- APP_PORT=22300
|
||||||
|
- POSTGRES_PASSWORD=joplin
|
||||||
|
- POSTGRES_USER=joplin
|
||||||
|
- POSTGRES_DB=joplin
|
||||||
|
app:
|
||||||
|
image: joplin/server:latest
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- "22300:22300"
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- APP_BASE_URL=https://silverbook.local/joplin
|
||||||
|
- DB_CLIENT=pg
|
||||||
|
- POSTGRES_PASSWORD=joplin
|
||||||
|
- POSTGRES_DATABASE=joplin
|
||||||
|
- POSTGRES_USER=joplin
|
||||||
|
- POSTGRES_PORT=5432
|
||||||
|
- POSTGRES_HOST=db
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Apache:
|
||||||
|
|
||||||
|
Activer les modules dans`httpd.conf`
|
||||||
|
|
||||||
|
```http
|
||||||
|
LoadModule proxy_html_module lib/httpd/modules/mod_proxy_html.so
|
||||||
|
LoadModule proxy_module lib/httpd/modules/mod_proxy.so
|
||||||
|
LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so
|
||||||
|
LoadModule ssl_module lib/httpd/modules/mod_ssl.so
|
||||||
|
LoadModule vhost_alias_module lib/httpd/modules/mod_vhost_alias.so
|
||||||
|
```
|
||||||
|
|
||||||
|
Editer le fichier`httpd-vhosts.conf`
|
||||||
|
|
||||||
|
```http
|
||||||
|
<VirtualHost *:443>
|
||||||
|
DocumentRoot "/Users/bruno/Sites"
|
||||||
|
ServerName silverbook.local
|
||||||
|
<Proxy *>
|
||||||
|
Order deny,allow
|
||||||
|
Allow from all
|
||||||
|
</Proxy>
|
||||||
|
ProxyPass "/joplin" http://localhost:22300
|
||||||
|
ProxyPassReverse "/joplin" http://localhost:22300
|
||||||
|
ProxyPreserveHost On
|
||||||
|
ProxyRequests off
|
||||||
|
SSLEngine on
|
||||||
|
SSLProxyEngine On
|
||||||
|
SSLCertificateFile "/usr/local/etc/httpd/server.crt"
|
||||||
|
SSLCertificateKeyFile "/usr/local/etc/httpd/server.key"
|
||||||
|
</VirtualHost>
|
||||||
|
```
|
||||||
|
|
||||||
|
<u>Joplin server</u> sera accessible à https://silverbook.local/joplin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pour rendre <u>Joplin server</u> disponible à https://joplin.silverbook.local, modifier le fichier`httpd-vhosts.conf`
|
||||||
|
|
||||||
|
```http
|
||||||
|
<VirtualHost *:443>
|
||||||
|
...
|
||||||
|
ServerName joplin.silverbook.local
|
||||||
|
ProxyPass "/" http://localhost:22300
|
||||||
|
ProxyPassReverse "/" http://localhost:22300
|
||||||
|
...
|
||||||
|
</VirtualHost>
|
||||||
|
```
|
||||||
|
|
||||||
|
et le fichier `docker-compose.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- APP_BASE_URL=https://joplin.silverbook.local
|
||||||
|
```
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ The hint "Limitations for Android-User: change to “ssl_ecdh_curve prime256v1;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Nextcloud sur NAS Synology](../Synology/nextcloud.md)
|
[Nextcloud sur NAS Synology](../Synology/dsm6/nextcloud.md)
|
||||||
|
|
||||||
[Nextcloud sur VPS/Plesk](../Plesk/nextcloud.md)
|
[Nextcloud sur VPS/Plesk](../Plesk/nextcloud.md)
|
||||||
|
|
||||||
|
|||||||
59
docs/Divers/pentest.md
Normal file
59
docs/Divers/pentest.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# pentest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Outils
|
||||||
|
|
||||||
|
- Kali Linux est une distribution Linux intégrant tous les outils nécessaires à la réalisation de tests d’intrusion. Plus de 300 outils de sécurité sont à la disposition du pentester qui peut ainsi vérifier les vulnérabilités d’un système à une offensive. Tous nos outils favoris sont bien entendu inclus dans cette distribution et c’est pourquoi nous la recommandons et nous l’utilisons quotidiennement.
|
||||||
|
|
||||||
|
- [nmap](https://nmap.org/) est un scanner de ports. Il permet d’analyser un serveur distant et de déterminer quels ports sont ouverts. Il lui sera également possible de recueillir des informations sur le système d’exploitation utilisé ainsi que sur les services hébergés.
|
||||||
|
|
||||||
|
- [Metasploit](https://www.metasploit.com/) est conçu pour réaliser des tests de pénétration. Il fournit donc des outils pour détecter des vulnérabilités, fournir un maximum d’informations dessus et aider à les exploiter. Un framework de développement est disponible afin de pouvoir configurer et utiliser des « exploits » (morceau de code permettant d’utiliser une vulnérabilité connue sur un système ou un logiciel) pour tenter de pénétrer un système cible.
|
||||||
|
|
||||||
|
- Wireshark
|
||||||
|
|
||||||
|
- John The Ripper
|
||||||
|
|
||||||
|
- Hashcat
|
||||||
|
|
||||||
|
- [Hydra](https://github.com/vanhauser-thc/thc-hydra) est un outil très performant pour réaliser des attaques en force brute. Il supporte de nombreux protocoles et teste toutes les combinaisons possibles de mots de passe afin d’obtenir l’accès à un système.
|
||||||
|
|
||||||
|
- Burp Suite
|
||||||
|
|
||||||
|
- [Zed Attack Proxy (ZAP)](https://www.zaproxy.org) est un outil open-source permettant de réaliser des tests de pénétration sur les applications web. Il se place entre l’application web et le navigateur utilisé par le testeur. Il va ensuite intercepter puis inspecter tous les échanges ayant lieu entre le navigateur et l’application web. Il va également modifier le contenu de certains messages avant de les faire parvenir à leur destinataire et de vérifier le comportement de l’application.
|
||||||
|
|
||||||
|
- [sqlmap](https://sqlmap.org/) est un outil open-source ayant pour objectif d’automatiser des attaques par injection SQL sur des applications web. Il permet donc d’identifier les vulnérabilités d’une application ou d’un site web vis-à-vis d’une attaque par injection SQL.
|
||||||
|
|
||||||
|
- aircrack-ng
|
||||||
|
|
||||||
|
- Dirb
|
||||||
|
|
||||||
|
- [Nikto](https://cirt.net/nikto2) est un scanner de vulnérabilités open-source destiné plus particulièrement aux serveurs web. Il va notamment permettre de vérifier les versions des logiciels et des modules utilisés sur le serveur, mais également scanner l’arborescence des répertoires à la recherche d’informations sensibles.
|
||||||
|
|
||||||
|
- dir search
|
||||||
|
|
||||||
|
- [SSLScan](https://sourceforge.net/projects/sslscan/) est un outil léger et simple à utiliser permettant de scanner les requêtes échangées avec un service SSL (comme https par exemple, sécurisant bon nombre de sites web). Il permet ainsi d’obtenir des informations sur le chiffrement et sur les certificats utilisés.
|
||||||
|
|
||||||
|
- [Social Engineer Toolkit (SET)](https://www.social-engineer.org/framework/se-tools/computer-based/social-engineer-toolkit-set/) est conçu spécifiquement pour faire de l’ingénierie sociale. Il est totalement configurable et permet entre autres choses de créer facilement des emails de phishing dans le cadre d’un pentest.
|
||||||
|
|
||||||
|
- [theHarvester](https://pypi.org/project/theHarvester/) est également un outil de test de pénétration. Il permet de récupérer un grand nombre d’informations comme des noms de serveurs, noms de domaines, comptes emails, ports ouverts et même noms d’employés sur le système d’information d’une entreprise. Pour cela, il base son analyse sur de nombreuses sources en accès public comme les moteurs de recherche.
|
||||||
|
|
||||||
|
- [OpenVas](https://www.openvas.org/) est l’acronyme de « Open Vulnerability Assessment Scanner ». Comme son nom l’indique, il s’agit d’un scanner de vulnérabilités. Il est capable de scanner tout matériel possédant une adresse IP et relié au réseau : poste de travail, serveur, routeur, pare-feu, smartphone, site web, objet connecté, poste téléphonique sur IP…
|
||||||
|
|
||||||
|
Le logiciel cartographie les cibles potentielles sur le réseau, détecte les ports accessibles, identifie les services actifs et leurs versions. A partir de ces informations, les différents éléments seront scannés à la recherche de vulnérabilités et un rapport sera généré.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://www.lemondeinformatique.fr/actualites/lire-11-outils-pour-s-initier-au-pentest-80103.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- [SearchSploit](https://www.exploit-db.com/searchsploit)
|
||||||
|
- [metasploit](https://www.metasploit.com)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OWASP
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Si WebTools ne fonctionne plus, il faut le [resetter](https://github.com/ukdtom/
|
|||||||
guide.xml 100% 2792KB 92.8KB/s 00:30
|
guide.xml 100% 2792KB 92.8KB/s 00:30
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Logs:
|
### Logs:
|
||||||
|
|
||||||
@@ -156,7 +156,23 @@ Pour les logs des plug-ins, aller directement sur le serveur:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Impossible d'indexer le contenu d'un dossier:
|
||||||
|
|
||||||
|
1. In DSM go to "Control Panel > Shared folder:.
|
||||||
|
|
||||||
|
2. Select the media folder you want Plex to have access to.
|
||||||
|
|
||||||
|
3. Click Edit.
|
||||||
|
|
||||||
|
4. Click on the Permissions tab.
|
||||||
|
|
||||||
|
5. In the dropdown change "Local users" to System internal user".
|
||||||
|
|
||||||
|
6. Find and select the PlexMediaServer user (or Plex user for DSM 6).
|
||||||
|
|
||||||
|
7. Tick the Read/Write permission box and click Save (or OK for DSM 6).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Liens:
|
### Liens:
|
||||||
|
|
||||||
|
|||||||
551
docs/Divers/rclone.md
Normal file
551
docs/Divers/rclone.md
Normal file
@@ -0,0 +1,551 @@
|
|||||||
|
# rclone
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> pcloud
|
||||||
|
|
||||||
|
https://rclone.org/pcloud/
|
||||||
|
|
||||||
|
##### rclone config show:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone config show
|
||||||
|
[pcloud]
|
||||||
|
type = pcloud
|
||||||
|
hostname = eapi.pcloud.com
|
||||||
|
token = {"access_token":"zj6mZDnONSzyJXpmZpIYvXkZWhYVxcv5zNzbjHhUTF3FvzEuPkxy","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}
|
||||||
|
root_folder_id = 16135343175
|
||||||
|
|
||||||
|
[pcloud2]
|
||||||
|
type = pcloud
|
||||||
|
hostname = eapi.pcloud.com
|
||||||
|
token = {"access_token":"zj6mZDnONSzyJXpmZ28jB7kZgGoK40Ez6LVEVPUezEmUYXmKDzg7","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Copier un fichier sur pcloud:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# rclone copy <file> <remote:path>
|
||||||
|
~/.config/rclone
|
||||||
|
❯ rclone copy rclone.conf pcloud:
|
||||||
|
|
||||||
|
❯ rclone copy -vv pcloud:topgrade.toml .
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Lister les fichiers sur pcloud:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone ls pcloud:
|
||||||
|
400 rclone.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### root_folder_id: 16135343175
|
||||||
|
|
||||||
|
répertoire que rclone considère comme root sur le disque pCloud.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
https://my.pcloud.com/#page=filemanager&folder=16135343175
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> Synology
|
||||||
|
|
||||||
|
https://rclone.org/sftp/
|
||||||
|
|
||||||
|
##### rclone config show
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone config show
|
||||||
|
[ds923]
|
||||||
|
type = sftp
|
||||||
|
host = photos-nas.ovh
|
||||||
|
port = 42667
|
||||||
|
use_insecure_cipher = true
|
||||||
|
shell_type = unix
|
||||||
|
md5sum_command = /bin/md5sum
|
||||||
|
sha1sum_command = /bin/sha1sum
|
||||||
|
```
|
||||||
|
|
||||||
|
##### rclone lsf
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone lsf ds923:/home
|
||||||
|
#recycle/
|
||||||
|
.bash_aliases
|
||||||
|
.bash_history
|
||||||
|
.bash_logout
|
||||||
|
.bashrc
|
||||||
|
.cache/
|
||||||
|
.config/
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> rclone lsf ds923:/Films
|
||||||
|
#recycle/
|
||||||
|
11.6 (2013).m4v
|
||||||
|
12 years a slave.m4v
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> rclone lsf ds923:/web
|
||||||
|
.well-known/
|
||||||
|
1-login.php
|
||||||
|
Locale/
|
||||||
|
_index.html
|
||||||
|
admin/
|
||||||
|
adminer/
|
||||||
|
```
|
||||||
|
|
||||||
|
##### rclone copy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~
|
||||||
|
❯ rclone copy security.txt -vv ds923:/homes/bruno --sftp-path-override=/volume1/homes/bruno
|
||||||
|
|
||||||
|
# -vv verbose
|
||||||
|
|
||||||
|
❯ rclone copy -vv ds923:/homes/bruno/security.txt --sftp-path-override=/volume1/homes/bruno .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> iCloud
|
||||||
|
|
||||||
|
https://rclone.org/iclouddrive/
|
||||||
|
|
||||||
|
```
|
||||||
|
[iclouddrive]
|
||||||
|
type = iclouddrive
|
||||||
|
apple_id = bxxxxxxxxxxxx@orange.fr
|
||||||
|
password = Passw0rd4
|
||||||
|
cookies = X-APPLE-WEBAUTH-HSA-TRUST=2422434b85789793...
|
||||||
|
trust_token = HSARMTKNSRVXWFlaTNRjqj9rT3DEMu9UFBfRYvmzbJ3B2pWGryz46M....
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rclone config reconnect iclouddrive:
|
||||||
|
```
|
||||||
|
|
||||||
|
L'erreur `Missing PCS cookies from the request` est due à la Protection Avancée des Données (Préférences iCloud). Pour utiliser rclone, il faut la désactiver.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> Seafile
|
||||||
|
|
||||||
|
https://rclone.org/seafile/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[seafile923]
|
||||||
|
type = seafile
|
||||||
|
url = https://seafile.photos-nas.ovh
|
||||||
|
user = liste@blabla.info
|
||||||
|
pass =
|
||||||
|
2fa = true
|
||||||
|
library = Ma bibliothèque
|
||||||
|
auth_token = 71892276ff3cbd92ef86951c9b0939a4b7213286
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone copy security.txt -vv seafile923:
|
||||||
|
|
||||||
|
❯ rclone copy -vv seafile923:security.txt .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> sur-le-sentier.fr
|
||||||
|
|
||||||
|
https://rclone.org/sftp/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone config show
|
||||||
|
|
||||||
|
[sls]
|
||||||
|
type = sftp
|
||||||
|
host = sur-le-sentier.fr
|
||||||
|
user = sentier
|
||||||
|
use_insecure_cipher = false
|
||||||
|
shell_type = unix
|
||||||
|
md5sum_command = md5sum
|
||||||
|
sha1sum_command = sha1sum
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone copy security.txt sls:/var/www/vhosts/sur-le-sentier.fr
|
||||||
|
|
||||||
|
❯ rclone copy sls:/var/www/vhosts/sur-le-sentier.fr/security.txt .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> maboiteverte.fr
|
||||||
|
|
||||||
|
https://rclone.org/sftp/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone config show
|
||||||
|
|
||||||
|
[mbv]
|
||||||
|
type = sftp
|
||||||
|
host = maboiteverte.fr
|
||||||
|
use_insecure_cipher = false
|
||||||
|
shell_type = unix
|
||||||
|
md5sum_command = md5sum
|
||||||
|
sha1sum_command = sha1sum
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone copy security.txt -vv mbv:/var/www/vhosts/maboiteverte.fr
|
||||||
|
|
||||||
|
❯ rclone copy mbv:/var/www/vhosts/maboiteverte.fr/security.txt .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Mac -> ovh
|
||||||
|
|
||||||
|
https://rclone.org/sftp/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone config show
|
||||||
|
|
||||||
|
[ovh]
|
||||||
|
type = sftp
|
||||||
|
host = ftp.cluster011.ovh.net
|
||||||
|
user = funnymac
|
||||||
|
shell_type = unix
|
||||||
|
md5sum_command = md5sum
|
||||||
|
sha1sum_command = sha1sum
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone copy security.txt -vv ovh:/homez.528/funnymac
|
||||||
|
|
||||||
|
❯ rclone copy ovh:/homez.528/funnymac/security.txt .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Synology -> pCloud
|
||||||
|
|
||||||
|
https://github.com/ravem/synology-pcloud-and-rclone
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Commandes:
|
||||||
|
|
||||||
|
#### rclone about
|
||||||
|
|
||||||
|
Affiche les infos du serveur:
|
||||||
|
|
||||||
|
```
|
||||||
|
❯ rclone about sls:
|
||||||
|
Total: 115.535 GiB
|
||||||
|
Used: 36.288 GiB
|
||||||
|
Free: 79.248 GiB
|
||||||
|
|
||||||
|
# Options:
|
||||||
|
--full affiche les valeurs en octets
|
||||||
|
--json affiche le résultat en json
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone authorize
|
||||||
|
|
||||||
|
Pour autoriser un rclone distant ou fonctionnant sans interface graphique depuis un ordinateur équipé d'un navigateur, suivez les instructions de configuration de rclone.
|
||||||
|
|
||||||
|
#### rclone backend
|
||||||
|
|
||||||
|
Cette commande exécute une commande spécifique au backend.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone backend help sls:
|
||||||
|
2025/04/03 08:30:43 NOTICE: Failed to backend: sftp backend has no commands
|
||||||
|
|
||||||
|
❯ rclone backend help pcloud:
|
||||||
|
2025/04/03 08:31:56 NOTICE: Failed to backend: pcloud backend has no commands
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone bisync
|
||||||
|
|
||||||
|
Effectuer une synchronisation bidirectionnelle entre deux chemins.
|
||||||
|
|
||||||
|
#### rclone cat
|
||||||
|
|
||||||
|
Envoie des fichiers à la sortie standard.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone cat mbv:/var/www/vhosts/maboiteverte.fr/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone check
|
||||||
|
|
||||||
|
Vérifie que les fichiers de la source et de la destination correspondent.
|
||||||
|
|
||||||
|
#### rclone checksum
|
||||||
|
|
||||||
|
Vérifie les fichiers de la destination par rapport à un fichier SUM.
|
||||||
|
|
||||||
|
#### rclone cleanup
|
||||||
|
|
||||||
|
Nettoyez la destination si possible. Videz la corbeille ou supprimez les anciennes versions de fichiers. Non pris en charge par toutes les destination.
|
||||||
|
|
||||||
|
#### rclone config
|
||||||
|
|
||||||
|
Lancez une session de configuration interactive pour créer de nouveaux référentiels distants et gérer ceux existants.
|
||||||
|
|
||||||
|
#### rclone copy
|
||||||
|
|
||||||
|
Copie des fichiers de la source à la destination, en ignorant les fichiers identiques.
|
||||||
|
|
||||||
|
#### rclone copyto
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### rclone copyurl
|
||||||
|
|
||||||
|
Copie le contenu de l'URL fournie dans dest:path.
|
||||||
|
|
||||||
|
#### rclone cryptcheck
|
||||||
|
|
||||||
|
Cryptcheck contrôle l'intégrité d'un système distant chiffré.
|
||||||
|
|
||||||
|
#### rclone cryptdecode
|
||||||
|
|
||||||
|
Cryptdecode renvoie les noms de fichiers non chiffrés.
|
||||||
|
|
||||||
|
#### rclone dedupe
|
||||||
|
|
||||||
|
Recherche interactive des noms de fichiers en double et suppression/renommage.
|
||||||
|
|
||||||
|
#### rclone delete
|
||||||
|
|
||||||
|
Supprime les fichiers du chemin d'accès. Contrairement à purge, il obéit aux filtres include/exclude et peut donc être utilisé pour supprimer des fichiers de manière sélective.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Fichier > 100M
|
||||||
|
❯ rclone --min-size 100M lsl sls:/var/www/vhosts/sur-le-sentier.fr
|
||||||
|
|
||||||
|
# Suppression à vide
|
||||||
|
❯ rclone --dry-run --min-size 100M delete sls:/var/www/vhosts/sur-le-sentier.fr
|
||||||
|
|
||||||
|
# Suppression interactive
|
||||||
|
❯ rclone --interactive --min-size 100M delete sls:/var/www/vhosts/sur-le-sentier.fr
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone deletefile
|
||||||
|
|
||||||
|
Supprime un seul fichier d'un site distant. Contrairement à delete, il ne peut pas être utilisé pour supprimer un répertoire et n'obéit pas aux filtres include/exclude.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone --interactive delete sls:/var/www/vhosts/sur-le-sentier.fr/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone gendocs
|
||||||
|
|
||||||
|
Produit la documentation markdown pour rclone dans le répertoire fourni.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone gendocs rclone
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone hashsum
|
||||||
|
|
||||||
|
Génère un fichier de hachage (md5, sha1, whirlpool, crc32, sha256) pour tous les objets du répertoire.
|
||||||
|
|
||||||
|
```
|
||||||
|
md5, sha1, whirlpool, crc32, sha256
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone hashsum MD5 sls:/var/www/vhosts/sur-le-sentier.fr/logs/
|
||||||
|
93193fb044ccc71cb27203532ac334b8 error_log
|
||||||
|
d41d8cd98f00b204e9800998ecf8427e access_log
|
||||||
|
73abaaade6cd1c0a40162014867261f9 proxy_error_log
|
||||||
|
0801b1b10ac5ff6adb9e7bc8fe3647ad access_ssl_log
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone link
|
||||||
|
|
||||||
|
Générer un lien public vers le fichier/dossier.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone link sls:/var/www/vhosts/sur-le-sentier.fr/logs/
|
||||||
|
2025/04/03 11:04:55 NOTICE: Failed to link: sftp://sentier@sur-le-sentier.fr:22//var/www/vhosts/sur-le-sentier.fr/logs/ doesn't support public links
|
||||||
|
|
||||||
|
❯ rclone link pcloud:
|
||||||
|
https://e.pcloud.link/publink/show?code=kZyR1dZalrSWYGJiKYObHx04EzVw8U4hxik
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone listremotes
|
||||||
|
|
||||||
|
Liste toutes les destinations présentes dans le fichier de configuration et définies dans les variables d'environnement.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone listremotes
|
||||||
|
pcloud:
|
||||||
|
pcloud2:
|
||||||
|
ds923:
|
||||||
|
iclouddrive:
|
||||||
|
seafile923:
|
||||||
|
sls:
|
||||||
|
mbv:
|
||||||
|
ovh:
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone md5sum
|
||||||
|
|
||||||
|
Produit un fichier md5sum pour tous les objets du chemin.
|
||||||
|
|
||||||
|
Equivalent à `rclone hashsum MD5 remote:path`
|
||||||
|
|
||||||
|
#### rclone mkdir
|
||||||
|
|
||||||
|
Créez le chemin d'accès s'il n'existe pas déjà.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone mkdir sls:/var/www/vhosts/sur-le-sentier.fr/mkdir/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone mount
|
||||||
|
|
||||||
|
Rclone mount permet à Linux, FreeBSD, macOS et Windows de monter n'importe quel système de stockage en nuage de Rclone en tant que système de fichiers avec FUSE.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone move
|
||||||
|
|
||||||
|
Déplace le contenu du répertoire source vers le répertoire de destination.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rclone move rclone/ sls:/var/www/vhosts/sur-le-sentier.fr/rclone/
|
||||||
|
|
||||||
|
# Supprimer les dossiers vides
|
||||||
|
rclone move --delete-empty-src-dirs rclone/ sls:/var/www/vhosts/sur-le-sentier.fr/rclone/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone moveto
|
||||||
|
|
||||||
|
Déplacer un fichier ou un répertoire de la source vers la destination.
|
||||||
|
|
||||||
|
#### rclone ncdu
|
||||||
|
|
||||||
|
Explorer une destination avec une interface utilisateur textuelle.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone ncdu sls:/var/www/vhosts/sur-le-sentier.fr/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone purge
|
||||||
|
|
||||||
|
Retirer le chemin d'accès et tout son contenu.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Supprime le dossier rclone
|
||||||
|
|
||||||
|
❯ rclone purge sls:/var/www/vhosts/sur-le-sentier.fr/rclone/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone rcat
|
||||||
|
|
||||||
|
Copie l'entrée standard dans un fichier distant.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ echo "Hello" | rclone rcat sls:/var/www/vhosts/sur-le-sentier.fr/test_rcat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone rmdir
|
||||||
|
|
||||||
|
Supprimer le répertoire vide au niveau du chemin d'accès.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone rmdir sls:/var/www/vhosts/sur-le-sentier.fr/empty_folder
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone rmdirs
|
||||||
|
|
||||||
|
Supprimer les répertoires vides au niveau du chemin d'accès.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#sls
|
||||||
|
mkdir empty_folder/empty_folder2
|
||||||
|
|
||||||
|
❯ rclone rmdir sls:/var/www/vhosts/sur-le-sentier.fr/empty_folder/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone sha1sum
|
||||||
|
|
||||||
|
Produit un fichier sha1sum pour tous les objets du chemin.
|
||||||
|
|
||||||
|
Equivalent à `rclone hashsum SHA1 remote:path`
|
||||||
|
|
||||||
|
#### rclone size
|
||||||
|
|
||||||
|
Affiche la taille totale et le nombre d'objets situés dans le répertoire distant remote:path.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone size --max-depth 1 sls:/var/www/vhosts/sur-le-sentier.fr/
|
||||||
|
Total objects: 14
|
||||||
|
Total size: 13.468 MiB (14121727 Byte)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone sync
|
||||||
|
|
||||||
|
Rendre la source et la destination identiques, en ne modifiant que la destination.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone sync --interactive rclone sls:/var/www/vhosts/sur-le-sentier.fr/rclone/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone tree
|
||||||
|
|
||||||
|
Liste le contenu d'un fichier distant de la même manière que la commande unix tree.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone tree sls:/var/www/vhosts/sur-le-sentier.fr/httpdocs/
|
||||||
|
|
||||||
|
/
|
||||||
|
├── Locale
|
||||||
|
│ ├── de_DE
|
||||||
|
│ │ └── LC_MESSAGES
|
||||||
|
│ │ ├── sentier.mo
|
||||||
|
│ │ └── sentier.po
|
||||||
|
│ ├── en_US
|
||||||
|
│ │ └── LC_MESSAGES
|
||||||
|
│ │ ├── sentier.mo
|
||||||
|
│ │ └── sentier.po
|
||||||
|
│ ├── es_ES
|
||||||
|
│ │ └── LC_MESSAGES
|
||||||
|
│ │ ├── sentier.mo
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rclone version
|
||||||
|
|
||||||
|
Affiche le numéro de version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ rclone version --check
|
||||||
|
yours: 1.69.1
|
||||||
|
latest: 1.69.1 (released 2025-02-14)
|
||||||
|
beta: 1.70.0-beta.8641.839eef0db (released 2025-03-26)
|
||||||
|
upgrade: https://beta.rclone.org/v1.70.0-beta.8641.839eef0db
|
||||||
|
|
||||||
|
❯ rclone version
|
||||||
|
rclone v1.69.1
|
||||||
|
- os/version: darwin 15.3.2 (64 bit)
|
||||||
|
- os/kernel: 24.3.0 (arm64)
|
||||||
|
- os/type: darwin
|
||||||
|
- os/arch: arm64 (ARMv8 compatible)
|
||||||
|
- go/version: go1.24.0
|
||||||
|
- go/linking: dynamic
|
||||||
|
- go/tags: none
|
||||||
|
```
|
||||||
|
|
||||||
30
docs/Divers/reseau/et12.md
Normal file
30
docs/Divers/reseau/et12.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Asus ZenWifi Pro ET12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Afficher /éteindre les LEDs
|
||||||
|
|
||||||
|
AiMesh -> Topologie -> Accueil -> Gestion -> Bouton LED On/Off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Introduction du pare-feu sur le routeur ASUS:
|
||||||
|
|
||||||
|
https://www.asus.com/fr/support/FAQ/1013630/
|
||||||
|
|
||||||
|
Comment configurer le filtre des services réseaux
|
||||||
|
|
||||||
|
https://www.asus.com/fr/support/FAQ/1013636
|
||||||
|
|
||||||
|
Comment rendre mon routeur plus sécurisé
|
||||||
|
|
||||||
|
https://www.asus.com/fr/support/FAQ/1039292
|
||||||
|
|
||||||
@@ -24,6 +24,24 @@ xigmanas.home (192.168.1.250) at 1c:fd:8:70:20:f7 on en0 ifscope [ethernet]
|
|||||||
broadcasthost (255.255.255.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
|
broadcasthost (255.255.255.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Trouver les devices sur un réseau:
|
||||||
|
|
||||||
|
https://www.blackmoreops.com/2015/12/31/use-arp-scan-to-find-hidden-devices-in-your-network/
|
||||||
|
|
||||||
|
https://github.com/royhills/arp-scan
|
||||||
|
|
||||||
|
https://github.com/royhills/arp-scan/wiki/arp-scan-User-Guide
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo arp-scan --interface=en0 --localnet
|
||||||
|
Interface: en0, type: EN10MB, MAC: 50:ed:3c:1f:98:06, IPv4: 192.168.129.54
|
||||||
|
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
|
||||||
|
|
||||||
|
523 packets received by filter, 0 packets dropped by kernel
|
||||||
|
Ending arp-scan 1.10.0: 256 hosts scanned in 1.880 seconds (136.17 hosts/sec). 0 responded
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### nmap:
|
### nmap:
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
# Asus
|
# Asus RT-AC88U @ Merlin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Backup (paramètres et partition JFFS)
|
||||||
|
|
||||||
|
A faire avant la mise-à-jour du firmware;
|
||||||
|
|
||||||
|
Administration -> Restaurer -> **Router settings** -> Enregistrer les Paramètres
|
||||||
|
|
||||||
|
Administration -> Restaurer -> **JFFS Partition** -> Backup JFFS partition
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +61,7 @@ $ service restart_dnsmasq
|
|||||||
|
|
||||||
### Dnsmasq:
|
### Dnsmasq:
|
||||||
|
|
||||||
Configuration:
|
#### Configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ nano /etc/dnsmasq.conf
|
$ nano /etc/dnsmasq.conf
|
||||||
@@ -59,13 +69,13 @@ $ nano /etc/dnsmasq.conf
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Vérifier la configuration:
|
#### Vérifier la configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ dnsmasq --test
|
$ dnsmasq --test
|
||||||
```
|
```
|
||||||
|
|
||||||
Vérifier la résolution DNS:
|
#### Vérifier la résolution DNS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ dig clicclac.synology.me +short
|
$ dig clicclac.synology.me +short
|
||||||
@@ -97,9 +107,9 @@ clicclac.synology.me. 171 IN A 90.62.226.41
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bloquer un domain:
|
#### Bloquer un domain:
|
||||||
|
|
||||||
Ajouter dans le dnsmasq.conf:
|
Ajouter dans le fichier `/etc/dnsmasq.conf`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
address=/blocked.example/
|
address=/blocked.example/
|
||||||
@@ -116,6 +126,16 @@ conf-dir=/etc/dnsmasq.d/,*.conf
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Notification de mise-à-jour:
|
||||||
|
|
||||||
|
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Update-Notification-Example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bruno@RT-AC88U-0928:/bin# /jffs/scripts/update-notification
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### amtm
|
### amtm
|
||||||
|
|
||||||
[amtm](https://diversion.ch/amtm.html) est une GUI qui permet d'installer des scripts dans les routeurs Asus fonctionnant sous le firmware [Asuswrt-Merlin](https://www.asuswrt-merlin.net) (depuis la v384.15, amtm est installé d'office) ([forum](https://www.snbforums.com/threads/amtm-the-asuswrt-merlin-terminal-menu.42415/page-124)).
|
[amtm](https://diversion.ch/amtm.html) est une GUI qui permet d'installer des scripts dans les routeurs Asus fonctionnant sous le firmware [Asuswrt-Merlin](https://www.asuswrt-merlin.net) (depuis la v384.15, amtm est installé d'office) ([forum](https://www.snbforums.com/threads/amtm-the-asuswrt-merlin-terminal-menu.42415/page-124)).
|
||||||
@@ -155,7 +175,25 @@ Modules installés:
|
|||||||
- Skynet (nécessite un fichier swap de 2 Go):
|
- Skynet (nécessite un fichier swap de 2 Go):
|
||||||
- LED Control: éteint les LED de 21h30 à 7h
|
- LED Control: éteint les LED de 21h30 à 7h
|
||||||
|
|
||||||
|
Désinstaller Skynet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh /jffs/scripts/firewall uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Reset usine
|
||||||
|
|
||||||
|
1. Éteignez le routeur.
|
||||||
|
2. Appuyez et maintenez le bouton "WPS" puis allumez le routeur.
|
||||||
|
3. Le voyant d'alimentation est allumé **(continue à tenir le bouton WPS****).**
|
||||||
|
4. Relâchez le **bouton WPS** lorsque le voyant d'alimentation commence à clignoter.
|
||||||
|
5. Le voyant d'alimentation cesse de clignoter et le routeur redémarre automatiquement.
|
||||||
|
|
||||||
|
https://www.asus.com/fr/support/FAQ/1039077
|
||||||
|
|
||||||
|
Login / password: admin / admin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -177,4 +215,11 @@ Asus-wrt vs Asus-Merlin:
|
|||||||
|
|
||||||
https://www.snbforums.com/threads/dnsmasq-conf-add-without-custom-firmware.43244/
|
https://www.snbforums.com/threads/dnsmasq-conf-add-without-custom-firmware.43244/
|
||||||
|
|
||||||
https://www.snbforums.com/threads/how-to-use-dnsmasq-conf-add.8785/
|
https://www.snbforums.com/threads/how-to-use-dnsmasq-conf-add.8785/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://www.henriksommerfeld.se/firmware-update-notifications-for-my-asus-router/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
187
docs/Divers/reseau/rt-ac88u-openwrt.md
Normal file
187
docs/Divers/reseau/rt-ac88u-openwrt.md
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Asus RT-AC88U @ openWrt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Reset usine
|
||||||
|
|
||||||
|
1. Éteignez le routeur.
|
||||||
|
2. Appuyez et maintenez le bouton "WPS" puis allumez le routeur.
|
||||||
|
3. Le voyant d'alimentation est allumé **(continue à tenir le bouton WPS****).**
|
||||||
|
4. Relâchez le **bouton WPS** lorsque le voyant d'alimentation commence à clignoter.
|
||||||
|
5. Le voyant d'alimentation cesse de clignoter et le routeur redémarre automatiquement.
|
||||||
|
|
||||||
|
https://www.asus.com/fr/support/FAQ/1039077
|
||||||
|
|
||||||
|
Login / password: admin / admin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Copier le firmware sur le routeur:
|
||||||
|
|
||||||
|
Désactiver le coupe-feu de macOS.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Downloads 3m 59s 18:21:52
|
||||||
|
❯ tftp 192.168.1.1
|
||||||
|
tftp> mode binary
|
||||||
|
tftp> put openwrt-23.05.2-bcm53xx-generic-asus_rt-ac88u-squashfs.trx
|
||||||
|
Sent 9568256 bytes in 28.7 seconds
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Connexion à OpenWrt:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@192.168.1.1's password:
|
||||||
|
|
||||||
|
|
||||||
|
BusyBox v1.36.1 (2023-11-14 13:38:11 UTC) built-in shell (ash)
|
||||||
|
|
||||||
|
_______ ________ __
|
||||||
|
| |.-----.-----.-----.| | | |.----.| |_
|
||||||
|
| - || _ | -__| || | | || _|| _|
|
||||||
|
|_______|| __|_____|__|__||________||__| |____|
|
||||||
|
|__| W I R E L E S S F R E E D O M
|
||||||
|
-----------------------------------------------------
|
||||||
|
OpenWrt 23.05.2, r23630-842932a63d
|
||||||
|
-----------------------------------------------------
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### opkg
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@OpenWrt:~# opkg update
|
||||||
|
Downloading https://downloads.openwrt.org/releases/23.05.2/targets/bcm53xx/generic/packages/Packages.gz
|
||||||
|
Updated list of available packages in /var/opkg-lists/openwrt_core
|
||||||
|
|
||||||
|
root@OpenWrt:~# opkg find '*nano*'
|
||||||
|
nano - 7.2-2 - Nano is a small and simple text editor for use on the terminal.
|
||||||
|
|
||||||
|
root@OpenWrt:~# opkg install nano
|
||||||
|
Installing nano (7.2-2) to root...
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Mise-à-jour
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# opkg update && opkg install brcmfmac-firmware-4366b1-pcie
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Infos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# uname -a
|
||||||
|
Linux OpenWrt 5.15.137 #0 SMP Tue Nov 14 13:38:11 2023 armv7l GNU/Linux
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# cat /etc/os-release
|
||||||
|
NAME="OpenWrt"
|
||||||
|
VERSION="23.05.2"
|
||||||
|
ID="openwrt"
|
||||||
|
ID_LIKE="lede openwrt"
|
||||||
|
PRETTY_NAME="OpenWrt 23.05.2"
|
||||||
|
VERSION_ID="23.05.2"
|
||||||
|
HOME_URL="https://openwrt.org/"
|
||||||
|
BUG_URL="https://bugs.openwrt.org/"
|
||||||
|
SUPPORT_URL="https://forum.openwrt.org/"
|
||||||
|
BUILD_ID="r23630-842932a63d"
|
||||||
|
OPENWRT_BOARD="bcm53xx/generic"
|
||||||
|
OPENWRT_ARCH="arm_cortex-a9"
|
||||||
|
OPENWRT_TAINTS=""
|
||||||
|
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
|
||||||
|
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
|
||||||
|
OPENWRT_DEVICE_PRODUCT="Generic"
|
||||||
|
OPENWRT_DEVICE_REVISION="v0"
|
||||||
|
OPENWRT_RELEASE="OpenWrt 23.05.2 r23630-842932a63d"
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# cat /proc/cpuinfo
|
||||||
|
processor : 0
|
||||||
|
model name : ARMv7 Processor rev 0 (v7l)
|
||||||
|
BogoMIPS : 1400.00
|
||||||
|
Features : half thumb fastmult edsp tls
|
||||||
|
CPU implementer : 0x41
|
||||||
|
CPU architecture: 7
|
||||||
|
CPU variant : 0x3
|
||||||
|
CPU part : 0xc09
|
||||||
|
CPU revision : 0
|
||||||
|
|
||||||
|
processor : 1
|
||||||
|
model name : ARMv7 Processor rev 0 (v7l)
|
||||||
|
BogoMIPS : 1400.00
|
||||||
|
Features : half thumb fastmult edsp tls
|
||||||
|
CPU implementer : 0x41
|
||||||
|
CPU architecture: 7
|
||||||
|
CPU variant : 0x3
|
||||||
|
CPU part : 0xc09
|
||||||
|
CPU revision : 0
|
||||||
|
|
||||||
|
Hardware : BCM5301X
|
||||||
|
Revision : 0000
|
||||||
|
Serial : 0000000000000000
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liens
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### OpenWrt:
|
||||||
|
|
||||||
|
- [Table of Hardware](https://openwrt.org/toh/start)
|
||||||
|
- [Table of Hardware: devices with 16/128MB or more](https://openwrt.org/toh/views/toh_available_16128)
|
||||||
|
-
|
||||||
|
- [OpenWrt Support for Asus RT-AC88U](https://forum.openwrt.org/t/openwrt-support-for-asus-rt-ac88u/78635)
|
||||||
|
|
||||||
|
- [OpenWrt Wiki](https://openwrt.org/toh/asus/rt-ac88u)
|
||||||
|
|
||||||
|
- [Quick start guide for OpenWrt installation](https://openwrt.org/docs/guide-quick-start/start)
|
||||||
|
|
||||||
|
- [OpenWrt Factory Install](https://openwrt.org/docs/guide-quick-start/factory_installation)
|
||||||
|
|
||||||
|
#### Firmwares:
|
||||||
|
|
||||||
|
- [OpenWrt Firmware Selector](https://firmware-selector.openwrt.org/?version=23.05.2&target=bcm53xx%2Fgeneric&id=asus_rt-ac88u) -
|
||||||
|
|
||||||
|
- [Archive Firmwares](https://archive.openwrt.org/releases/23.05.2/targets/bcm53xx/generic/)
|
||||||
|
|
||||||
|
#### TFTP:
|
||||||
|
|
||||||
|
- [Installing openWrt via TFTP](https://openwrt.org/docs/guide-user/installation/generic.flashing.tftp)
|
||||||
|
- [Setting up a TFTP server for TFTP Recovery/Install](https://openwrt.org/docs/guide-user/troubleshooting/tftpserver)
|
||||||
|
- [Run a TFTP Server for Network Device Setups](https://rick.cogley.info/post/run-a-tftp-server-on-mac-osx/)
|
||||||
|
- [TFTP Server for macOS](https://macandegg.com/2022/02/tftp-server-for-macos/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Livebox:
|
||||||
|
|
||||||
|
- [[La fibre.info] Remplacement de la Livebox par un routeur Openwrt](https://lafibre.info/remplacer-livebox/remplacement-de-la-livebox-par-un-routeur-openwrt-18-dhcp-v4v6-tv/)
|
||||||
|
|
||||||
|
- [[Github] Remplacer une Livebox par un routeur OpenWrt (ipv4,ipv6 & TV)](https://github.com/ubune/openwrt-livebox)
|
||||||
|
|
||||||
|
- [[La fibre.info] Index des solutions de remplacement de la Livebox](https://lafibre.info/remplacer-livebox/index-des-solutions-de-remplacement-de-la-livebox/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Divers:
|
||||||
|
|
||||||
|
- [SNBForums (Asus)](https://www.snbforums.com/forums/asus-wireless.37/)
|
||||||
|
- [[La fibre.info] OpenWrt](https://lafibre.info/openwrt/)
|
||||||
39
docs/Divers/tmux.md
Normal file
39
docs/Divers/tmux.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# tmux
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tmux
|
||||||
|
```
|
||||||
|
|
||||||
|
Ctrl + B -> mode Commande
|
||||||
|
|
||||||
|
Ctrl + B puis % : partage l'écran en 2
|
||||||
|
|
||||||
|
Ctrl + B puis -> / <- : passe d'un terminal à l'autre
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Intégration iTerm2
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tmux -CC
|
||||||
|
```
|
||||||
|
|
||||||
|
Ouvre une 2e fenêtre, un terminal tmux
|
||||||
|
|
||||||
|
Ctrl + clic sur la fenêtre, choisir *Split Pane Vertically*
|
||||||
|
|
||||||
|
On passe d'un panneau à l'autre par un simple clic.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On ferme la fenêtre -> choisir Detach tmux Session
|
||||||
|
|
||||||
|
Sur la 1e fenêtre
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tmux -CC attach
|
||||||
|
```
|
||||||
|
|
||||||
|
On retrouve la 2e fenêtre dans le même état (la session précédente est restaurée).
|
||||||
348
docs/Divers/wordpress.md
Normal file
348
docs/Divers/wordpress.md
Normal file
@@ -0,0 +1,348 @@
|
|||||||
|
# WordPress sur Debian / nginx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installation nginx/php/mariadb
|
||||||
|
|
||||||
|
Ajouter le dépôt PPA pour PHP 7.4
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install apt-transport-https lsb-release ca-certificates
|
||||||
|
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||||
|
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" >> /etc/apt/sources.list.d/php.list
|
||||||
|
apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer nginx, mariadb, php7.4 et ses modules
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install nginx mariadb-server mariadb-client unzip wget git -y
|
||||||
|
|
||||||
|
sudo apt-get install php7.4-fpm php7.4-cli
|
||||||
|
sudo apt-get install php7.4-{bcmath,bz2,curl,imagick,intl,gd,mbstring,mcrypt,memcache,mysql,redis,xdebug,xml,zip}
|
||||||
|
```
|
||||||
|
|
||||||
|
Démarrer nginx et mariadb
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl start nginx.service
|
||||||
|
sudo systemctl enable nginx.service
|
||||||
|
sudo systemctl start mariadb.service
|
||||||
|
sudo systemctl enable mariadb.service
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### PHP
|
||||||
|
|
||||||
|
Voir les logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/php/7.4/fpm/php.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### mariadb
|
||||||
|
|
||||||
|
Sécuriser mariadb
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo mysql_secure_installation
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer la base de donnée wordpress
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo mysql -u root -p
|
||||||
|
```
|
||||||
|
|
||||||
|
```mysql
|
||||||
|
# Supprimer une ancienne base:
|
||||||
|
# DROP DATABASE wordpress;
|
||||||
|
|
||||||
|
CREATE DATABASE wordpress;
|
||||||
|
GRANT ALL ON wordpress.* TO 'adm_wp'@'localhost' IDENTIFIED BY 'Kpm!65YU';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Installation WordPress
|
||||||
|
|
||||||
|
Télécharger WordPress
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /var/www/html
|
||||||
|
sudo wget https://wordpress.org/latest.tar.gz
|
||||||
|
sudo tar -xzvf latest.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
Corriger les autorisations
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#$ sudo chown -R $USER:$USER /var/www/html/wordpress/
|
||||||
|
$ sudo chown -R www-data:www-data /var/www/html/wordpress/
|
||||||
|
$ sudo chmod -R 755 /var/www/html/wordpress/
|
||||||
|
$ find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
|
||||||
|
$ find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
|
||||||
|
```
|
||||||
|
|
||||||
|
Configurer WordPress
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -s https://api.wordpress.org/secret-key/1.1/salt/
|
||||||
|
define('AUTH_KEY', 'nqx$&&2@.PlOv:R-@D5O@1J!fxBV).%}|4$E,<]3V6wK:>s;N*_qZgX1v%Clj.nY');
|
||||||
|
define('SECURE_AUTH_KEY', 'k/iGx=P!Q,I=-f-_JhI-hNNlvL]036/W;h@,-a>l:DN#w}@.RdqehTDC>Da{$`v,');
|
||||||
|
define('LOGGED_IN_KEY', 'e!2g+-jFty5(}j>Oxtdt1+krNu&[TIrP}|)G&0jt%Z+q#+?TTP1mM+MVTH-zD5#w');
|
||||||
|
define('NONCE_KEY', '9 @VoZ.-OVd!wy5mT$?&-$RHIX%xImw]M2jKK+vUet+pImeiNYGx~Jm>shu}p0B7');
|
||||||
|
define('AUTH_SALT', ':pyo`{Fk*YNww+V-]-8Oy|}daBoedBnlO?AWKw;Gj+X9n|qm#Ndk~?R-d`N!I21v');
|
||||||
|
define('SECURE_AUTH_SALT', ' +dgn@u/e#rZ.4(t}#.3d<)Y2>d)3c)t$j>_C^}sEwSK&VZ+]C=b2/.gzyA#.$Kz');
|
||||||
|
define('LOGGED_IN_SALT', 'q1},|Tm|kBb!?H*T`PkGt;}>JF/8fHRRzGaVPB[Et!#gjbm4rjG-}-J`jlzZ<I|E');
|
||||||
|
define('NONCE_SALT', 'I}Sv1zA>I*rW/[3?d[@/jg$=95NqWDdBMf{N>o: G!R fp10Ynyoq-^Hw>-7|LEK');
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cp wp-config-sample.php wp-config.php
|
||||||
|
$ nano wp-config.php
|
||||||
|
```
|
||||||
|
|
||||||
|
```php
|
||||||
|
### Modifier les réglages de base de donnée ###
|
||||||
|
|
||||||
|
// ** MySQL settings - You can get this info from your web host ** //
|
||||||
|
/** The name of the database for WordPress */
|
||||||
|
define( 'DB_NAME', 'wordpress' );
|
||||||
|
|
||||||
|
/** MySQL database username */
|
||||||
|
define( 'DB_USER', 'adm_wp' );
|
||||||
|
|
||||||
|
/** MySQL database password */
|
||||||
|
define( 'DB_PASSWORD', 'Kpm!65YU' );
|
||||||
|
|
||||||
|
/** MySQL hostname */
|
||||||
|
define( 'DB_HOST', 'localhost' );
|
||||||
|
|
||||||
|
/** Database Charset to use in creating database tables. */
|
||||||
|
define( 'DB_CHARSET', 'utf8' );
|
||||||
|
|
||||||
|
/** The Database Collate type. Don't change this if in doubt. */
|
||||||
|
define( 'DB_COLLATE', '' );
|
||||||
|
|
||||||
|
|
||||||
|
### Remplacer la section Authentication Unique Keys and Salts. ###
|
||||||
|
|
||||||
|
define('AUTH_KEY', 'nqx$&&2@.PlOv:R-@D5O@1J!fxBV).%}|4$E,<]3V6wK:>s;N*_qZgX1v%Clj.nY');
|
||||||
|
define('SECURE_AUTH_KEY', 'k/iGx=P!Q,I=-f-_JhI-hNNlvL]036/W;h@,-a>l:DN#w}@.RdqehTDC>Da{$`v,');
|
||||||
|
define('LOGGED_IN_KEY', 'e!2g+-jFty5(}j>Oxtdt1+krNu&[TIrP}|)G&0jt%Z+q#+?TTP1mM+MVTH-zD5#w');
|
||||||
|
define('NONCE_KEY', '9 @VoZ.-OVd!wy5mT$?&-$RHIX%xImw]M2jKK+vUet+pImeiNYGx~Jm>shu}p0B7');
|
||||||
|
define('AUTH_SALT', ':pyo`{Fk*YNww+V-]-8Oy|}daBoedBnlO?AWKw;Gj+X9n|qm#Ndk~?R-d`N!I21v');
|
||||||
|
define('SECURE_AUTH_SALT', ' +dgn@u/e#rZ.4(t}#.3d<)Y2>d)3c)t$j>_C^}sEwSK&VZ+]C=b2/.gzyA#.$Kz');
|
||||||
|
define('LOGGED_IN_SALT', 'q1},|Tm|kBb!?H*T`PkGt;}>JF/8fHRRzGaVPB[Et!#gjbm4rjG-}-J`jlzZ<I|E');
|
||||||
|
define('NONCE_SALT', 'I}Sv1zA>I*rW/[3?d[@/jg$=95NqWDdBMf{N>o: G!R fp10Ynyoq-^Hw>-7|LEK');
|
||||||
|
|
||||||
|
|
||||||
|
### Activer les mises à jour ###
|
||||||
|
|
||||||
|
define( 'FS_METHOD', 'direct' );
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Configurer nginx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/nginx/sites-available/test.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
#return 302 https://$server_name$request_uri;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.php index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
if ($request_uri ~ ^/(.*)\.html$) {
|
||||||
|
return 302 /$1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location /wordpress {
|
||||||
|
try_files $uri $uri/ /wordpress/index.php?$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
#include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/default
|
||||||
|
```
|
||||||
|
|
||||||
|
Vérifier la configuration et redémarrer PHP/nginx.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo /usr/sbin/nginx -t
|
||||||
|
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||||
|
nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||||
|
|
||||||
|
$ sudo systemctl restart nginx php7.4-fpm
|
||||||
|
```
|
||||||
|
|
||||||
|
Aller à http://localhost/wordpress/ pour terminer l'installation de WordPress.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Échec d’installation : Impossible de créer le dossier » dans WordPress
|
||||||
|
|
||||||
|
Aller dans Outils -> Santé du site
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo chown -R www-data:www-data wordpress/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### SSL
|
||||||
|
|
||||||
|
Générer clé et certificat auto-signés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un groupe Diffie-Hellman:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo openssl dhparam -out /etc/nginx/dhparam.pem 4096
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un snippet contenant les fichiers des clés et certificats:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/nginx/snippets/self-signed.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un snippet contenant les réglages SSL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo nano /etc/nginx/snippets/ssl-params.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
ssl_protocols TLSv1.2;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
ssl_dhparam /etc/nginx/dhparam.pem;
|
||||||
|
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
|
||||||
|
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off; # Requires nginx >= 1.5.9
|
||||||
|
ssl_stapling on; # Requires nginx >= 1.3.7
|
||||||
|
ssl_stapling_verify on; # Requires nginx => 1.3.7
|
||||||
|
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
||||||
|
resolver_timeout 5s;
|
||||||
|
# Disable strict transport security for now. You can uncomment the following
|
||||||
|
# line if you understand the implications.
|
||||||
|
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
|
||||||
|
add_header X-Frame-Options DENY;
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
```
|
||||||
|
|
||||||
|
Modifier la config nginx pour gérer SSL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo cp /etc/nginx/sites-available/test.conf /etc/nginx/sites-available/test.conf.bak
|
||||||
|
|
||||||
|
$ sudo cp /etc/nginx/sites-available/test.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
server {
|
||||||
|
#listen 80;
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
include snippets/self-signed.conf;
|
||||||
|
include snippets/ssl-params.conf;
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
#return 302 https://$server_name$request_uri;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.php index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
if ($request_uri ~ ^/(.*)\.html$) {
|
||||||
|
return 302 /$1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location /wordpress {
|
||||||
|
try_files $uri $uri/ /wordpress/index.php?$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
#include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
# redirection provisoire
|
||||||
|
#return 302 https://$server_name$request_uri;
|
||||||
|
|
||||||
|
# redirection permanente
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
https://slacker.ro/2019/07/15/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-debian-10/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
bruno / MHxhNZ2Ax*@@cvy6XM
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,30 @@
|
|||||||
$ brew install wp-cli
|
$ brew install wp-cli
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Comme wp-cli n'est pas à jour sur Homebrew, on l'installe directement:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
$ chmod +x wp-cli.phar
|
||||||
|
$ mv wp-cli.phar $HOME/.local/bin/wp
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install wp-cli-completion
|
||||||
|
|
||||||
|
# => /opt/homebrew/Cellar/wp-cli-completion/2.11.0/etc/bash_completion.d/wp
|
||||||
|
|
||||||
|
# Bash: /opt/homebrew/etc/bash_completion.d
|
||||||
|
|
||||||
|
# Zsh: /opt/homebrew/share/zsh-completions
|
||||||
|
# Bash: /opt/homebrew/share/bash-completion/completion
|
||||||
|
|
||||||
|
[[ -r $(brew --prefix)/Cellar/wp-cli-completion/2.11.0/etc/bash_completion.d/wp ]] && source $(brew --prefix)/Cellar/wp-cli-completion/2.11.0/etc/bash_completion.d/wp
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Installer le script [**wp-cli bash completion**](https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash)
|
#### Installer le script [**wp-cli bash completion**](https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash)
|
||||||
@@ -135,3 +159,40 @@ WP-CLI project config:
|
|||||||
WP-CLI version: 2.0.0
|
WP-CLI version: 2.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 4. Installer wp-cli sur sur-le-sentier.fr
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# !/usr/bin/env bash
|
||||||
|
|
||||||
|
# Télécharger
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||||
|
|
||||||
|
# Test
|
||||||
|
php wp-cli.phar --info
|
||||||
|
|
||||||
|
chmod +x wp-cli.phar
|
||||||
|
sudo mv wp-cli.phar wp
|
||||||
|
|
||||||
|
# Test
|
||||||
|
./wp --info
|
||||||
|
|
||||||
|
# Ajouter dans .bash_aliases
|
||||||
|
alias wp='$HOME/wp'
|
||||||
|
|
||||||
|
# Installer les TAB completions
|
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/v2.6.0/utils/wp-completion.bash
|
||||||
|
echo "source ~/wp-completion.bash" >> .bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Mise-à-jour
|
||||||
|
wp cli update --nightly
|
||||||
|
wp cli update
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://make.wordpress.org/cli/handbook/references/shell-friends/
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
wp super-cache
|
#### wp super-cache
|
||||||
|
|
||||||
Cette commande nécessite l'installation du package <u>wp-cli/wp-super-cache-cli</u>
|
Cette commande nécessite l'installation du package <u>wp-cli/wp-super-cache-cli</u>
|
||||||
|
|
||||||
@@ -40,13 +40,49 @@ SUBCOMMANDS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Lancer le cron immédiatement:
|
#### wp doctor
|
||||||
|
|
||||||
|
Installer le plugin wp-cli/doctor
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wp package install wp-cli/doctor-command
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp doctor check --all
|
||||||
|
|
||||||
|
+----------------------------+---------+--------------------------------------------------------------------+
|
||||||
|
| name | status | message |
|
||||||
|
+----------------------------+---------+--------------------------------------------------------------------+
|
||||||
|
| core-verify-checksums | success | WordPress verifies against its checksums. |
|
||||||
|
| file-eval | success | All 'php' files passed check for 'eval\(.*base64_decode\(.*'. |
|
||||||
|
| cache-flush | success | Use of wp_cache_flush() not found. |
|
||||||
|
| autoload-options-size | success | Autoloaded options size (NAN) is less than threshold (900kb). |
|
||||||
|
| constant-savequeries-falsy | success | Constant 'SAVEQUERIES' is undefined. |
|
||||||
|
| constant-wp-debug-falsy | error | Constant 'WP_DEBUG' is defined 'true' but expected to be falsy. |
|
||||||
|
| core-update | success | WordPress is at the latest version. |
|
||||||
|
| cron-count | success | Total number of cron jobs is within normal operating expectations. |
|
||||||
|
| cron-duplicates | success | All cron job counts are within normal operating expectations. |
|
||||||
|
| option-blog-public | error | Site is private but expected to be public. |
|
||||||
|
| plugin-active-count | success | Number of active plugins (0) is less than threshold (80). |
|
||||||
|
| plugin-deactivated | warning | Greater than 40 percent of plugins are deactivated. |
|
||||||
|
| plugin-update | warning | 1 plugin has an update available. |
|
||||||
|
| theme-update | success | Themes are up to date. |
|
||||||
|
| php-in-upload | success | No PHP files found in the Uploads folder. |
|
||||||
|
| language-update | success | Languages are up to date. |
|
||||||
|
+----------------------------+---------+--------------------------------------------------------------------+
|
||||||
|
Error: 2 checks report 'error'.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Lancer le cron immédiatement:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ wp cron event run --due-now
|
$ wp cron event run --due-now
|
||||||
```
|
```
|
||||||
|
|
||||||
Liste des crons:
|
#### Liste des crons:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ wp cron event list
|
$ wp cron event list
|
||||||
@@ -68,7 +104,7 @@ $ wp cron event list
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Changer l'URL de WordPress:
|
#### Changer l'URL de WordPress:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ wp option update home 'http://example.com'
|
$ wp option update home 'http://example.com'
|
||||||
@@ -77,13 +113,13 @@ $ wp option update siteurl 'http://example.com'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Supprimer les transients expirés:
|
#### Supprimer les transients expirés:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ wp transient delete --expired
|
$ wp transient delete --expired
|
||||||
```
|
```
|
||||||
|
|
||||||
Vider le cache:
|
#### Vider le cache:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ wp cache flush
|
$ wp cache flush
|
||||||
|
|||||||
28
docs/Divers/wp-cli/wp_maintenance.md
Normal file
28
docs/Divers/wp-cli/wp_maintenance.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# wp maintenance-mode
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp help maintenance-mod
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NAME
|
||||||
|
|
||||||
|
wp maintenance-mode
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Activates, deactivates or checks the status of the maintenance mode of a site.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp maintenance-mode <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
activate Activates maintenance mode.
|
||||||
|
deactivate Deactivates maintenance mode.
|
||||||
|
is-active Detects maintenance mode status.
|
||||||
|
status Displays maintenance mode status.
|
||||||
|
```
|
||||||
41
docs/Divers/wp-cli/wp_option.md
Normal file
41
docs/Divers/wp-cli/wp_option.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# wp option
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Aide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wp help option
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wp option
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Retrieves and sets site options, including plugin and WordPress settings.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
|
||||||
|
wp option <command>
|
||||||
|
|
||||||
|
SUBCOMMANDS
|
||||||
|
|
||||||
|
add Adds a new option value.
|
||||||
|
delete Deletes an option.
|
||||||
|
get Gets the value for an option.
|
||||||
|
get-autoload Gets the 'autoload' value for an option.
|
||||||
|
list Lists options and their values.
|
||||||
|
patch Updates a nested value in an option.
|
||||||
|
pluck Gets a nested value from an option.
|
||||||
|
set-autoload Sets the 'autoload' value for an option.
|
||||||
|
update Updates an option value.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Liste des options modifiables:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ wp option list
|
||||||
|
```
|
||||||
|
|
||||||
@@ -90,4 +90,8 @@ Success: 3 replacements to be made.
|
|||||||
|
|
||||||
Pour chercher dans toutes les tables (également celles des plug-ins): `--all-tables`
|
Pour chercher dans toutes les tables (également celles des plug-ins): `--all-tables`
|
||||||
Pour simuler: `--dry-run`
|
Pour simuler: `--dry-run`
|
||||||
Pour créer un dump des modfications: `--export=/tmp/staging.sql`
|
Pour créer un dump des modfications: `--export=/tmp/staging.sql`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://www.it-connect.fr/wordpress-et-wp-cli-rechercher-et-remplacer-dans-la-base-de-donnees/
|
||||||
30
docs/Divers/zsh/completion.md
Normal file
30
docs/Divers/zsh/completion.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# completion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://scriptingosx.com/2019/07/moving-to-zsh-part-5-completions/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ echo $fpath
|
||||||
|
/Users/bruno/.zinit/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.8.1/functions /Users/bruno/.zinit/plugins/zsh-users---zsh-completions/src
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
/opt/homebrew/etc/bash_completion.d
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### .zshrc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
autoload -U +X compinit && compinit
|
||||||
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
|
|
||||||
|
source /opt/homebrew/etc/bash_completion.d/soco-cli-gui-completion.bash
|
||||||
|
```
|
||||||
|
|
||||||
601
docs/Divers/zsh/plugins.md
Normal file
601
docs/Divers/zsh/plugins.md
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
# ZSH Plugins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Plugins (installés)
|
||||||
|
|
||||||
|
#### You Should Use *
|
||||||
|
|
||||||
|
Simple zsh plugin that reminds you that you should use one of your existing aliases for a command you just typed.
|
||||||
|
|
||||||
|
https://github.com/MichaelAquilina/zsh-you-should-use
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle MichaelAquilina/zsh-you-should-use
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light MichaelAquilina/zsh-you-should-use
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Config:
|
||||||
|
|
||||||
|
export YSU_MESSAGE_POSITION="after"
|
||||||
|
|
||||||
|
# %alias_type: alias, git alias, global alias
|
||||||
|
# %command: la commande entrée
|
||||||
|
# %alias: l'alias trouvé
|
||||||
|
|
||||||
|
export YSU_MESSAGE_FORMAT="$(tput setaf 1)Hey! I found this %alias_type for %command: %alias$(tput sgr0)"
|
||||||
|
|
||||||
|
# Fonctions
|
||||||
|
check_alias_usage
|
||||||
|
```
|
||||||
|
|
||||||
|
[alias-type](https://github.com/djui/alias-tips)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh-fast-alias-tips
|
||||||
|
|
||||||
|
Helps you remembering the aliases you defined once.
|
||||||
|
|
||||||
|
https://github.com/sei40kr/zsh-fast-alias-tips
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit ice from'gh-r' as'program'
|
||||||
|
zinit light sei40kr/fast-alias-tips-bin
|
||||||
|
zinit light sei40kr/zsh-fast-alias-tips
|
||||||
|
```
|
||||||
|
|
||||||
|
| Variable | Default value | Description |
|
||||||
|
| ------------------------ | ------------------ | ---------------------- |
|
||||||
|
| `FAST_ALIAS_TIPS_PREFIX` | `"💡 $(tput bold)"` | The prefix of the Tips |
|
||||||
|
| `FAST_ALIAS_TIPS_SUFFIX` | `"$(tput sgr0)"` | The suffix of the Tips |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### diractions *
|
||||||
|
|
||||||
|
https://github.com/AdrieanKhisbe/diractions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle "adrieankhisbe/diractions"
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light adrieankhisbe/diractions
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Editer fichier .diractions (folders)
|
||||||
|
nano ~/.diractions
|
||||||
|
# sauver répertoire courant avec le nom <mkdocs>
|
||||||
|
diraction save mkdocs
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh colored man pages *
|
||||||
|
|
||||||
|
https://github.com/ael-code/zsh-colored-man-pages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle ael-code/zsh-colored-man-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light ael-code/zsh-colored-man-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### shell-plugins (profile-secrets)*
|
||||||
|
|
||||||
|
https://github.com/gmatheu/shell-plugins
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit snippet 'https://raw.githubusercontent.com/gmatheu/shell-plugins/master/profile-secrets/init.zsh'
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Fichier des secrets par défaut:
|
||||||
|
~/.profile-secrets/secrets.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Fonctions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# décrypte le fichier des secrets
|
||||||
|
profile-secrets-decrypt: Decrypts secret file.
|
||||||
|
|
||||||
|
# encrypte le fichier des secrets (ou le crée lors du 1er lancement)
|
||||||
|
profile-secrets-encrypt: Encrypts secret file. First time it is called will create secrets file
|
||||||
|
|
||||||
|
# ajoute les variables secrets à la session courante
|
||||||
|
profile-secrets-source: Decrypts secrets file, source it and encrypts it back.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Bol *
|
||||||
|
|
||||||
|
https://github.com/ikhurramraza/bol
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light ikhurramraza/bol
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ bol print
|
||||||
|
Kuch bhi hojaye na, to kuch nahi hota
|
||||||
|
— Urwa Hocane
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd /Users/bruno/.zinit/plugins/ikhurramraza---bol/quotes/
|
||||||
|
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Bollywood
|
||||||
|
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Motivation
|
||||||
|
drwxr-xr-x 4 bruno staff 128 jul 31 21:28 Originals
|
||||||
|
drwxr-xr-x 4 bruno staff 128 jul 31 21:28 Seinfeld
|
||||||
|
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 Supernatural
|
||||||
|
drwxr-xr-x 3 bruno staff 96 jul 31 21:28 TVD
|
||||||
|
-rw-r--r-- 1 bruno staff 109 aoû 1 22:10 jvc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh-notify *
|
||||||
|
|
||||||
|
Desktop notifications for long-running commands in ZSH.
|
||||||
|
|
||||||
|
https://github.com/marzocchi/zsh-notify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle marzocchi/zsh-notify
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light marzocchi/zsh-notify
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zstyle ':notify:*' error-icon "https://media3.giphy.com/media/10ECejNtM1GyRy/200_s.gif"
|
||||||
|
zstyle ':notify:*' error-title "Command failed (in #{time_elapsed} seconds)"
|
||||||
|
zstyle ':notify:*' success-icon "https://s-media-cache-ak0.pinimg.com/564x/b5/5a/18/b55a1805f5650495a74202279036ecd2.jpg"
|
||||||
|
zstyle ':notify:*' success-title "Command finished (in #{time_elapsed} seconds)"
|
||||||
|
zstyle ':notify:*' error-sound "Glass"
|
||||||
|
zstyle ':notify:*' success-sound "default"
|
||||||
|
```
|
||||||
|
|
||||||
|
[auto-notify](https://github.com/MichaelAquilina/zsh-auto-notify)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### forgit *
|
||||||
|
|
||||||
|
This tool is designed to help you use git more efficiently (fzf).
|
||||||
|
|
||||||
|
https://github.com/wfxr/forgit
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle wfxr/forgit
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Interactive `git add` selector** (`ga`)
|
||||||
|
|
||||||
|
- **Interactive `git log` viewer** (`glo`)
|
||||||
|
|
||||||
|
- **Interactive `.gitignore` generator** (`gi`)
|
||||||
|
|
||||||
|
- **Interactive `git diff` viewer** (`gd`)
|
||||||
|
|
||||||
|
- **Interactive `git reset HEAD <file>` selector** (`grh`)
|
||||||
|
|
||||||
|
- **Interactive `git checkout <file>` selector** (`gcf`)
|
||||||
|
|
||||||
|
- **Interactive `git checkout <branch>` selector** (`gcb`)
|
||||||
|
|
||||||
|
- **Interactive `git checkout <commit>` selector** (`gco`)
|
||||||
|
|
||||||
|
- **Interactive `git stash` viewer** (`gss`)
|
||||||
|
|
||||||
|
- **Interactive `git clean` selector** (`gclean`)
|
||||||
|
|
||||||
|
- **Interactive `git cherry-pick` selector** (`gcp`)
|
||||||
|
|
||||||
|
- **Interactive `git rebase -i` selector** (`grb`)
|
||||||
|
|
||||||
|
- **Interactive `git commit --fixup && git rebase -i --autosquash` selector** (`gfu`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
#### Fast Syntax Highlighting *
|
||||||
|
|
||||||
|
https://github.com/zdharma/fast-syntax-highlighting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle zdharma/fast-syntax-highlighting
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light zdharma/fast-syntax-highlighting
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# liste des themes
|
||||||
|
❯ fast-theme -l
|
||||||
|
Found existing alias for "fast-theme". You should use: "fsh-alias"
|
||||||
|
Available themes:
|
||||||
|
clean
|
||||||
|
default
|
||||||
|
forest
|
||||||
|
free
|
||||||
|
q-jmnemonic
|
||||||
|
safari
|
||||||
|
spa
|
||||||
|
sv-orple
|
||||||
|
sv-plant
|
||||||
|
zdharma
|
||||||
|
|
||||||
|
# changer de thème
|
||||||
|
❯ fast-theme -t <theme-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### history-search-multi-word *
|
||||||
|
|
||||||
|
https://github.com/zdharma/history-search-multi-word
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit load zdharma/history-search-multi-word
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Ctrl-R
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ hist
|
||||||
|
Ctrl-K – context, Ctrl-J – bump. Entry #1 of 50
|
||||||
|
> abspath .zsh_history
|
||||||
|
history | grep man
|
||||||
|
history | grep curl
|
||||||
|
history
|
||||||
|
history | tail
|
||||||
|
history -x
|
||||||
|
antibody purge jimeh/zsh-peco-history
|
||||||
|
cd zsh-history-enquirer
|
||||||
|
cd zsh-directory-history
|
||||||
|
which zsh-history-enquirer
|
||||||
|
npm i -g zsh-history-enquirer
|
||||||
|
antibody purge tymm/zsh-directory-history
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh-autosuggestions *
|
||||||
|
|
||||||
|
https://github.com/zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle zsh-users/zsh-autosuggestions
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light zsh-users/zsh-autosuggestions
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Touche ->
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh-completions *
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/zsh-users/zsh-completions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle zsh-users/zsh-completions
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light zsh-users/zsh-completions
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### venv-wrapper
|
||||||
|
|
||||||
|
zsh plugin defining functions to wrap working with python's builtin venv module
|
||||||
|
|
||||||
|
https://github.com/glostis/venv-wrapper
|
||||||
|
|
||||||
|
```
|
||||||
|
zinit light glostis/venv-wrapper
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Créer un venv
|
||||||
|
❯ venv test2
|
||||||
|
Virtual environment `test2` does not exist.
|
||||||
|
Do you want to create it? [y/n]y
|
||||||
|
Created and activated venv test2
|
||||||
|
|
||||||
|
# Supprimer un venv
|
||||||
|
❯ rmvenv test2
|
||||||
|
Removed venv test2
|
||||||
|
|
||||||
|
# Liste des venv
|
||||||
|
❯ venv
|
||||||
|
Type `venv name_of_env` to activate a virtual environment.
|
||||||
|
|
||||||
|
Here is the list of existing virtual environments:
|
||||||
|
--------------------------------------------------
|
||||||
|
test
|
||||||
|
|
||||||
|
# Activer un venv
|
||||||
|
❯ venv test
|
||||||
|
|
||||||
|
~/Documents/venv 06:59:57
|
||||||
|
test ❯
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
$VENV_WRAPPER_PYTHON
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
!!! info
|
||||||
|
|
||||||
|
export PATH="$HOME/Documents/venv/soco-cli/bin:$PATH"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### zsh-fzf-history-search
|
||||||
|
|
||||||
|
[zsh-fzf-history-search.zsh](https://github.com/joshskidmore/zsh-fzf-history-search/blob/master/zsh-fzf-history-search.zsh)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# zsh-fzf-history-search
|
||||||
|
zinit ice lucid wait'0'
|
||||||
|
zinit light joshskidmore/zsh-fzf-history-search
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fzf-zsh-plugin
|
||||||
|
|
||||||
|
https://github.com/unixorn/fzf-zsh-plugin
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit load unixorn/fzf-zsh-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### web-search *
|
||||||
|
|
||||||
|
Lance une recherche depuis le terminal.
|
||||||
|
|
||||||
|
https://github.com/sineto/web-search
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit snippet 'https://raw.githubusercontent.com/sineto/web-search/master/web_search.plugin.zsh'
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
google <search>
|
||||||
|
ddg <search>
|
||||||
|
github <search>
|
||||||
|
youtube <search>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### z-a-man *(marche pas)
|
||||||
|
|
||||||
|
https://github.com/zinit-zsh/z-a-man
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit light zinit-zsh/z-a-man
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View README.md manpage in the terminal
|
||||||
|
zman z-a-man
|
||||||
|
# View the code documentation (via the full plugin name, as demonstrated)
|
||||||
|
zman -c zinit-zsh/z-a-man
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Plugins (autres)
|
||||||
|
|
||||||
|
#### FM
|
||||||
|
|
||||||
|
https://github.com/ddnexus/fm
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle ddnexus/fm
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zshmarks
|
||||||
|
|
||||||
|
https://github.com/jocelynmallon/zshmarks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle jocelynmallon/zshmarks
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-history-substring-search
|
||||||
|
|
||||||
|
https://github.com/zsh-users/zsh-history-substring-search
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle zsh-users/zsh-history-substring-search
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-peco-history
|
||||||
|
|
||||||
|
https://github.com/jimeh/zsh-peco-history
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle jimeh/zsh-peco-history
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-history-enquirer
|
||||||
|
|
||||||
|
https://github.com/zthxxx/zsh-history-enquirer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm i -g zsh-history-enquirer
|
||||||
|
echo 'source `npm root -g`/zsh-history-enquirer/scripts/zsh-history-enquirer.plugin.zsh' >> ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Ctrl-R
|
||||||
|
```
|
||||||
|
|
||||||
|
#### antibody-completion
|
||||||
|
|
||||||
|
https://github.com/sinetoami/antibody-completion
|
||||||
|
|
||||||
|
```
|
||||||
|
antibody bundle sinetoami/antibody-completion
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-async
|
||||||
|
|
||||||
|
https://github.com/mafredri/zsh-async
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle mafredri/zsh-async
|
||||||
|
```
|
||||||
|
|
||||||
|
#### mysql.plugin.zsh
|
||||||
|
|
||||||
|
https://github.com/voronkovich/mysql.plugin.zsh
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle voronkovich/mysql.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-autocomplete
|
||||||
|
|
||||||
|
https://github.com/marlonrichert/zsh-autocomplete
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle marlonrichert/zsh-autocomplete
|
||||||
|
```
|
||||||
|
|
||||||
|
#### zsh-notes
|
||||||
|
|
||||||
|
https://github.com/aperezdc/zsh-notes
|
||||||
|
|
||||||
|
```
|
||||||
|
antibody bundle aperezdc/zsh-notes
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Interactive-cd
|
||||||
|
|
||||||
|
https://github.com/changyuheng/zsh-interactive-cd
|
||||||
|
|
||||||
|
#### Link File Plugin
|
||||||
|
|
||||||
|
https://github.com/JaumeRF/linkfile-zsh
|
||||||
|
|
||||||
|
#### zsh-lux
|
||||||
|
|
||||||
|
https://github.com/pndurette/zsh-lux
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle pndurette/zsh-lux
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Shelf
|
||||||
|
|
||||||
|
https://github.com/ecmma/shelf
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle ecmma/shelf
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Thèmes
|
||||||
|
|
||||||
|
#### Powerlevel10k
|
||||||
|
|
||||||
|
https://github.com/romkatv/powerlevel10k/#antibody
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle romkatv/powerlevel10k
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zinit ice depth"1" # git clone depth
|
||||||
|
zinit light romkatv/powerlevel10k
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Pure
|
||||||
|
|
||||||
|
https://github.com/sindresorhus/pure
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antibody bundle sindresorhus/pure
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Plugins Managers
|
||||||
|
|
||||||
|
#### Zinit *
|
||||||
|
|
||||||
|
https://github.com/zdharma/zinit (2021) (zpluggin)*
|
||||||
|
|
||||||
|
#### zplug
|
||||||
|
|
||||||
|
https://github.com/zplug/zplug (R2017)(2020)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/zpm-zsh/zpm (2021)
|
||||||
|
|
||||||
|
https://github.com/tarjoilija/zgen (2018)
|
||||||
|
|
||||||
|
https://github.com/zsh-users/antigen (2018)
|
||||||
|
|
||||||
|
https://github.com/sorin-ionescu/prezto (2021)
|
||||||
|
|
||||||
|
https://github.com/getantibody/antibody (2020)
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Liens
|
||||||
|
|
||||||
|
https://github.com/unixorn/awesome-zsh-plugins
|
||||||
|
|
||||||
|
https://learnpracticeandshare.com/awesome-zsh-plugins-massive-collection-of-resources/#alf
|
||||||
|
|
||||||
95
docs/Divers/zsh/tools.md
Normal file
95
docs/Divers/zsh/tools.md
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
### exa
|
||||||
|
|
||||||
|
https://the.exa.website/
|
||||||
|
https://github.com/ogham/exa
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
ubuntu 20.10+ : apt install exa
|
||||||
|
debian : unstable repo
|
||||||
|
https://github.com/ogham/exa/releases/download/v0.10.0/exa-linux-armv7-v0.10.0.zip
|
||||||
|
http://ftp.br.debian.org/debian/pool/main/r/rust-exa/exa_0.10.1-1_arm64.deb
|
||||||
|
sudo dpkg -i exa_0.10.1-1_arm64.deb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### fzf
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
Debian 9+ : sudo apt-get install fzf
|
||||||
|
Ubuntu 19.10+ : sudo apt-get install fzf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### dotbare
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### zoxide
|
||||||
|
|
||||||
|
https://github.com/ajeetdsouza/zoxide
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
ubuntu 21.04+ : apt install zoxide
|
||||||
|
debian11+ : apt install zoxide
|
||||||
|
curl -sS https://webinstall.dev/zoxide | bash
|
||||||
|
|
||||||
|
#### Utilisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
j <tab>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### diractions
|
||||||
|
|
||||||
|
https://github.com/AdrieanKhisbe/diractions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### rg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### rga
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### dircolors
|
||||||
|
|
||||||
|
partie de coreutils
|
||||||
|
http://www.gnu.org/software/coreutils/
|
||||||
|
|
||||||
|
#### Installation:
|
||||||
|
|
||||||
|
ubuntu : sudo apt install coreutils
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### rust
|
||||||
|
|
||||||
|
https://www.rust-lang.org/
|
||||||
|
wsl : curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### nanorc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sudo apt install cabextract p7zip-full unzip
|
||||||
|
|
||||||
|
mstsc.exe
|
||||||
|
|
||||||
|
|
||||||
|
zinit
|
||||||
|
|
||||||
162
docs/Divers/zsh/zinit.md
Normal file
162
docs/Divers/zsh/zinit.md
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
# zinit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For more information see:
|
||||||
|
- README section on the ice-modifiers:
|
||||||
|
- https://github.com/zdharma/zinit#ice-modifiers,
|
||||||
|
|
||||||
|
- intro to Zinit at the Wiki:
|
||||||
|
- https://zdharma.org/zinit/wiki/INTRODUCTION/,
|
||||||
|
|
||||||
|
- zinit-zsh GitHub account, which holds all the available Zinit annexes:
|
||||||
|
- https://github.com/zinit-zsh/,
|
||||||
|
|
||||||
|
- For-Syntax article on the Wiki; it is less directly related to the ices, however, it explains how to use them conveniently:
|
||||||
|
- https://zdharma.org/zinit/wiki/For-Syntax/.
|
||||||
|
|
||||||
|
- zdharma-continuum
|
||||||
|
- https://github.com/zdharma-continuum/zinit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
|
a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Downloading zinit-zsh/z-a-rust…
|
||||||
|
▹▸▹▹▹ ███████████ OBJ: 100, PACK: 0/153, COMPR: 100%
|
||||||
|
Note: Compiling: z-a-rust.plugin.zsh… OK.
|
||||||
|
|
||||||
|
Downloading zinit-zsh/z-a-as-monitor…
|
||||||
|
▝ ███████████ OBJ: 100, PACK: 0/333, COMPR: 100%
|
||||||
|
Note: Compiling: z-a-readurl.plugin.zsh… OK.
|
||||||
|
|
||||||
|
Downloading zinit-zsh/z-a-patch-dl…
|
||||||
|
▐ ███████████ OBJ: 100, PACK: 0/105, COMPR: 100%
|
||||||
|
Note: Compiling: z-a-patch-dl.plugin.zsh… OK.
|
||||||
|
|
||||||
|
Downloading zinit-zsh/z-a-bin-gem-node…
|
||||||
|
▍ ███████████ OBJ: 100, PACK: 0/530, COMPR: 100%
|
||||||
|
Note: Compiling: z-a-bin-gem-node.plugin.zsh… OK.
|
||||||
|
bruno@airbook ~ %
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ zinit zstatus
|
||||||
|
Found existing alias for "zinit". You should use: "zini"
|
||||||
|
Zinit's main directory: /Users/bruno/.zinit
|
||||||
|
Zinit's binary directory: /Users/bruno/.zinit/bin
|
||||||
|
Plugin directory: /Users/bruno/.zinit/plugins
|
||||||
|
Completions directory: /Users/bruno/.zinit/completions
|
||||||
|
Loaded plugins: 13
|
||||||
|
Light loaded: 4
|
||||||
|
Downloaded plugins: 14
|
||||||
|
Enabled completions: 148
|
||||||
|
Disabled completions: 0
|
||||||
|
Completions available overall: 152
|
||||||
|
Snippets loaded:
|
||||||
|
Compiled plugins: 13
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ zinit times
|
||||||
|
Found existing alias for "zinit". You should use: "zini"
|
||||||
|
Plugin loading times:
|
||||||
|
1 ms - zinit-zsh/z-a-rust
|
||||||
|
1 ms - zinit-zsh/z-a-as-monitor
|
||||||
|
1 ms - zinit-zsh/z-a-patch-dl
|
||||||
|
2 ms - zinit-zsh/z-a-bin-gem-node
|
||||||
|
12 ms - romkatv/powerlevel10k
|
||||||
|
5 ms - zdharma/history-search-multi-word
|
||||||
|
5 ms - zsh-users/zsh-autosuggestions
|
||||||
|
33 ms - zdharma/fast-syntax-highlighting
|
||||||
|
12 ms - MichaelAquilina/zsh-you-should-use
|
||||||
|
5 ms - ael-code/zsh-colored-man-pages
|
||||||
|
4 ms - zsh-users/zsh-completions
|
||||||
|
9 ms - marzocchi/zsh-notify
|
||||||
|
19 ms - wfxr/forgit
|
||||||
|
Total: 0.109 sec
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Self update
|
||||||
|
zinit self-update
|
||||||
|
|
||||||
|
# Plugin update
|
||||||
|
zinit update
|
||||||
|
zinit update --no-pager --quiet
|
||||||
|
|
||||||
|
# Plugin parallel update
|
||||||
|
zinit update --parallel
|
||||||
|
|
||||||
|
# Increase the number of jobs in a concurrent-set to 40
|
||||||
|
zinit update --parallel 40
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ zinit status
|
||||||
|
Found existing alias for "zinit". You should use: "zini"
|
||||||
|
Assuming --all is passed
|
||||||
|
Updating Zinit…
|
||||||
|
Note: status done also for unloaded plugins
|
||||||
|
|
||||||
|
Status for plugin MichaelAquilina/zsh-you-should-use
|
||||||
|
Sur la branche master
|
||||||
|
Votre branche est à jour avec 'origin/master'.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ zinit ls
|
||||||
|
Found existing alias for "zinit". You should use: "zini"
|
||||||
|
No `tree' program, it is required by the subcommand `ls'
|
||||||
|
Download from: http://mama.indstate.edu/users/ice/tree/
|
||||||
|
It is also available probably in all distributions and Homebrew, as package `tree'
|
||||||
|
.
|
||||||
|
├── OMZ::plugins
|
||||||
|
└── plugins -> OMZ::plugins
|
||||||
|
|
||||||
|
2 directories, 0 files, located at ZINIT[SNIPPETS_DIR], i.e. /Users/bruno/.zinit/snippets
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ zinit delete chipsenkbeil/zsh-notes
|
||||||
|
Found existing alias for "zinit". You should use: "zini"
|
||||||
|
Delete /Users/bruno/.zinit/plugins/chipsenkbeil---zsh-notes? (it holds: zsh-notes.plugin.zsh, .gitignore, LICENSE, README.md, more…)
|
||||||
|
[yY/n…]
|
||||||
|
y
|
||||||
|
Done (action executed, exit code: 0)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Les plugins sont installés ici:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/Users/bruno/.zinit/plugins/
|
||||||
|
```
|
||||||
|
|
||||||
@@ -364,5 +364,45 @@ ESC - H: Affiche le MAN d'une commande
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### bookmarks:
|
||||||
|
|
||||||
|
[how-to-use-bookmarks-in-bash-zsh](https://threkk.medium.com/how-to-use-bookmarks-in-bash-zsh-6b8074e40774)
|
||||||
|
|
||||||
|
Ajouter au .zshrc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ -d "$HOME/.bookmarks" ]; then
|
||||||
|
export CDPATH=".:$HOME/.bookmarks:/"
|
||||||
|
alias goto="cd -P"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer le dossier .bookmarks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir ~/.bookmarks
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les bookmarks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/.bookmarks
|
||||||
|
$ ln -s /Users/bruno/Documents/MySQL @MySQL_backup
|
||||||
|
|
||||||
|
~/.bookmarks
|
||||||
|
$ ln -s $(brew --prefix)/var/mysql @MySQL_databases
|
||||||
|
```
|
||||||
|
|
||||||
|
Utilisation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ goto @<Tab>
|
||||||
|
@MySQL_backup@ @MySQL_databases@ @kymsu@ @kymsu_git@ @scripts_bash@
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour [bash](https://twitter.com/mattn_jp/status/1434192554036137995)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
http://grml.org/zsh/zsh-lovers.html
|
http://grml.org/zsh/zsh-lovers.html
|
||||||
|
|
||||||
|
|||||||
143
docs/Divers/zsh/zsh_with_just plugins.md
Normal file
143
docs/Divers/zsh/zsh_with_just plugins.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# Zsh sans plugin manager ni OMZ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://dev.to/hbenvenutti/using-zsh-without-omz-4gch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Au début du fichier .zshrc, insérer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
### ZSH HOME
|
||||||
|
export ZSH=$HOME/.zsh
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On insère les plugins à la fin du fichier .zshrc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# https://github.com/ikhurramraza/bol
|
||||||
|
|
||||||
|
~/.zsh/plugins
|
||||||
|
➜ git clone https://github.com/ikhurramraza/bol.git
|
||||||
|
|
||||||
|
# Inserer les citations dans /Users/bruno/.zsh/plugins/bol/quotes
|
||||||
|
|
||||||
|
# Ajouter au .zshrc
|
||||||
|
source $ZSH/plugins/bol/bol.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# https://github.com/kazhala/dotbare
|
||||||
|
|
||||||
|
~/.zsh/plugins
|
||||||
|
➜ git clone https://github.com/kazhala/dotbare.git
|
||||||
|
|
||||||
|
# Ajouter au .zshrc
|
||||||
|
source $ZSH/plugins/dotbare/dotbare.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# https://github.com/MichaelAquilina/zsh-you-should-use
|
||||||
|
|
||||||
|
~/.zsh/plugins
|
||||||
|
➜ git clone https://github.com/MichaelAquilina/zsh-you-should-use.git
|
||||||
|
|
||||||
|
# Ajouter au .zshrc
|
||||||
|
source $ZSH/plugins/dotbare/dotbare.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/history-substring-search
|
||||||
|
# https://github.com/zsh-users/zsh-history-substring-search
|
||||||
|
|
||||||
|
~/.zsh/plugins
|
||||||
|
➜ git clone https://github.com/zsh-users/zsh-history-substring-search
|
||||||
|
|
||||||
|
# Ajouter au .zshrc
|
||||||
|
source $ZSH/plugins/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# https://github.com/zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
|
~/.zsh/plugins
|
||||||
|
➜ git clone https://github.com/zsh-users/zsh-autosuggestions.git
|
||||||
|
|
||||||
|
# Ajouter au .zshrc
|
||||||
|
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
.zshrc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source $ZSH/plugins/bol/bol.plugin.zsh
|
||||||
|
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
source $ZSH/plugins/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||||
|
fpath=($ZSH/plugins/zsh-completions/src $fpath)
|
||||||
|
# rm -f ~/.zcompdump; compinit
|
||||||
|
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/bbedit
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/chezmoi
|
||||||
|
|
||||||
|
https://www.chezmoi.io/#what-does-chezmoi-do
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colored-man-pages
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/colorize
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv
|
||||||
|
|
||||||
|
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/keychain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Coloration syntaxique dans nano:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~
|
||||||
|
➜ cd
|
||||||
|
drwxr-xr-x@ - bruno staff 21 mar 21:01 21 mar 21:01 .nano
|
||||||
|
.rw-r--r--@ 2,7Ki bruno staff 21 mar 21:01 21 mar 21:01 .nanorc
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.dircolors:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
https://github.com/seebi/dircolors-solarized
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Préférences:
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --------- | ----------------------------- |
|
||||||
|
| Multitail | /usr/local/etc/multitail.conf |
|
||||||
|
| | |
|
||||||
|
| | |
|
||||||
|
|
||||||
@@ -217,3 +217,4 @@ Ajouter ce fichier au fichier de configuration `.nanorc`
|
|||||||
include "~/.nanosyntax/yml.nanorc"
|
include "~/.nanosyntax/yml.nanorc"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
https://github.com/scopatz/nanorc
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
# ack
|
# ack
|
||||||
|
|
||||||
|
Remplaçant de *grep*
|
||||||
|
|
||||||
|
https://beyondgrep.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install ack
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
49
docs/Linux/alternatives.md
Normal file
49
docs/Linux/alternatives.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# alternatives
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- [bat](bat.md)
|
||||||
|
- [exa](exa.md)
|
||||||
|
- [fd](fd.md)
|
||||||
|
- [fzf](fzf.md)
|
||||||
|
- [ripgrep](ripgrep.md)
|
||||||
|
- [zoxide](zoxide.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### bat
|
||||||
|
|
||||||
|
alternative à *cat*
|
||||||
|
|
||||||
|
https://github.com/sharkdp/bat
|
||||||
|
|
||||||
|
### exa
|
||||||
|
|
||||||
|
alternative à *ls*
|
||||||
|
|
||||||
|
https://the.exa.website
|
||||||
|
|
||||||
|
### fd
|
||||||
|
|
||||||
|
alternative à *find*
|
||||||
|
|
||||||
|
https://github.com/sharkdp/fd
|
||||||
|
|
||||||
|
### fzf
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf
|
||||||
|
|
||||||
|
### ripgrep (rg)
|
||||||
|
|
||||||
|
alternative à *grep*
|
||||||
|
|
||||||
|
https://github.com/BurntSushi/ripgrep
|
||||||
|
|
||||||
|
### zoxide (z-zi)(j-ji)
|
||||||
|
|
||||||
|
alternative à *z plugin*
|
||||||
|
|
||||||
|
https://github.com/ajeetdsouza/zoxide
|
||||||
|
|
||||||
@@ -94,10 +94,59 @@ $ ls archive.tar
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### xz (tar 1.22+)
|
||||||
|
|
||||||
|
Compresser un fichier au format .xz:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ xz -k9 monfichier
|
||||||
|
```
|
||||||
|
|
||||||
|
Compresser une archive au format .tar.xz:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tar cfJ fichier.tar.xz mondossier
|
||||||
|
```
|
||||||
|
|
||||||
|
Décompresser un fichier au format .xz:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ xz -d monfichier
|
||||||
|
```
|
||||||
|
|
||||||
|
Décompresser une archive au format .tar.xz:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tar -xJf fichier.tar.xz
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### zip
|
#### zip
|
||||||
|
|
||||||
Compresser avec zip:
|
Compresser avec zip:
|
||||||
|
|
||||||
|
```
|
||||||
|
zip <archive.zip> <file1> <file2>
|
||||||
|
zip <archive.zip> <file*>
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ zip p10k.zip p1Ok.zsh
|
||||||
|
adding: p1Ok.zsh (deflated 63%)
|
||||||
|
```
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- -q : pas des sortie écran
|
||||||
|
- -Z bzip2 : méthode de compression bzip2 (deflate par défaut)
|
||||||
|
- -9 ... -0 : niveau de compression (maxi -> mini)
|
||||||
|
- -e : avec mot-de-passe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Compresser un dossier avec zip:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ zip -r scripts.zip scripts/
|
$ zip -r scripts.zip scripts/
|
||||||
adding: scripts/ (stored 0%)
|
adding: scripts/ (stored 0%)
|
||||||
@@ -175,6 +224,46 @@ $ unzip -P password vegas.zip
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### tzst (Z Standard)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt install zstd
|
||||||
|
|
||||||
|
$ brew install zstd
|
||||||
|
```
|
||||||
|
|
||||||
|
Compresser:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Tous les .sh individuellement
|
||||||
|
$ zstd *.sh
|
||||||
|
26 files compressed :44.75% ( 24.7 KiB => 11.1 KiB)
|
||||||
|
|
||||||
|
# 1 archive pour tous les .sh
|
||||||
|
$ tar --zstd -cf scripts.tar.zst *.sh
|
||||||
|
|
||||||
|
# Niveaux de compression: -1 à -19
|
||||||
|
# Niveaux ultra (19 à 22): --ultra -22
|
||||||
|
```
|
||||||
|
|
||||||
|
Décompresser:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ unzstd scripts.tar.zst
|
||||||
|
$ zstd -d scripts.tar.zst
|
||||||
|
scripts.tar.zst : 117248 bytes
|
||||||
|
|
||||||
|
$ tar --zstd -xf scripts.tar.zst
|
||||||
|
```
|
||||||
|
|
||||||
|
BetterZip (macOS)
|
||||||
|
|
||||||
|
[Peazip](https://peazip.github.io/peazip-64bit.html) (Windows)
|
||||||
|
|
||||||
|
[7-zip-zstd](https://github.com/mcmilk/7-Zip-zstd) (command-line)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### dmg (macOS)
|
#### dmg (macOS)
|
||||||
|
|
||||||
Créer:
|
Créer:
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ snowleopard macOS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Colonnes:
|
||||||
|
|
||||||
Afficher la 1ere colonne d'un fichier:
|
Afficher la 1ere colonne d'un fichier:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -184,7 +186,76 @@ tiger
|
|||||||
snowleopard
|
snowleopard
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Trim toute la colonne:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk '{$1=$1;print}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer la 1ere colonne:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk '{$1=""; print $0}'
|
||||||
|
|
||||||
|
# les 3 premières colonnes
|
||||||
|
$ awk '{$1=$2=$3=""; print $0}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer la dernière colonne:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk -F"/" 'BEGIN{OFS=FS} {NF--; print}'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Lignes:
|
||||||
|
|
||||||
|
Afficher la 3eme ligne:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk 'NR==3' test.txt
|
||||||
|
mint
|
||||||
|
|
||||||
|
$ awk 'FNR == 3 {print}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Afficher les ligne 2 à 4:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk 'NR>=2 && NR<=4' test.txt
|
||||||
|
ubuntu
|
||||||
|
mint
|
||||||
|
debian
|
||||||
|
```
|
||||||
|
|
||||||
|
Afficher 4e colonne de la 2e ligne:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk 'NR==2{print $4}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer les lignes vides:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk NF
|
||||||
|
```
|
||||||
|
|
||||||
|
Nombre de lignes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk 'END { print NR }' test.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Supprimer tout après la 1ere ligne vide:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ awk '/^$/{exit} 1'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Divers:
|
||||||
|
|
||||||
Passer un argument à awk:
|
Passer un argument à awk:
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,37 @@
|
|||||||
# bat
|
# bat
|
||||||
|
|
||||||
Remplaçant de cat
|
Remplaçant de *cat*
|
||||||
|
|
||||||
https://github.com/sharkdp/bat
|
https://github.com/sharkdp/bat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Installation:
|
##### Installation:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ brew install bat
|
$ brew install bat
|
||||||
$ brew install fzf
|
$ brew install fzf
|
||||||
```
|
```
|
||||||
|
|
||||||
Créer le fichier de configuration:
|
##### Créer le fichier de configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ bat --generate-config-file
|
$ bat --generate-config-file
|
||||||
```
|
```
|
||||||
|
|
||||||
Editer la configuration:
|
##### Editer la configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ nano /Users/bruno/.config/bat/config
|
$ nano /Users/bruno/.config/bat/config
|
||||||
```
|
```
|
||||||
|
|
||||||
Prévisualiser les thèmes:
|
##### Prévisualiser les thèmes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"
|
$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
Tail et bat:
|
##### Tail et bat:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
||||||
@@ -43,7 +43,7 @@ $ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
|||||||
4 [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
4 [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
||||||
```
|
```
|
||||||
|
|
||||||
Find et bat:
|
##### Find et bat:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ find /usr -name error_log -exec bat {} +
|
$ find /usr -name error_log -exec bat {} +
|
||||||
@@ -56,13 +56,64 @@ $ find /usr -name error_log -exec bat {} +
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Man pages:
|
##### Man pages:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
man 2 select
|
man 2 select
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Afficher les caractères non-imprimables:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
❯ bat -A /etc/hosts
|
||||||
|
|
||||||
|
File: /etc/hosts
|
||||||
|
1 ##␊
|
||||||
|
2 #·Host·Database␊
|
||||||
|
3 #␊
|
||||||
|
4 #·localhost·is·used·to·configure·the·loopback·interface␊
|
||||||
|
5 #·when·the·system·is·booting.··Do·not·change·this·entry.␊
|
||||||
|
6 ##␊
|
||||||
|
7 127.0.0.1├──┤localhost␊
|
||||||
|
8 255.255.255.255├──┤broadcasthost␊
|
||||||
|
9 ::1·············localhost␊
|
||||||
|
10 #·Added·by·Docker·Desktop␊
|
||||||
|
11 #·To·allow·the·same·kube·context·to·work·on·the·host·and·the·container:␊
|
||||||
|
12 127.0.0.1·kubernetes.docker.internal␊
|
||||||
|
13 #·End·of·section␊
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Voir plusieurs fichiers en même temps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ bat plugins.d/*.sh
|
||||||
|
|
||||||
|
File: plugins.d/00-kymsu.sh
|
||||||
|
1 #!/usr/bin/env bash
|
||||||
|
2 echo "🦄 KYMSU self update"
|
||||||
|
3 pushd "$(cat ~/.kymsu/path)" > /dev/null
|
||||||
|
4 git pull
|
||||||
|
5 popd > /dev/null
|
||||||
|
6 echo ""
|
||||||
|
|
||||||
|
File: plugins.d/antibody.sh
|
||||||
|
1 #!/usr/bin/env bash
|
||||||
|
2
|
||||||
|
3 # Antibody plugin for KYMSU
|
||||||
|
4 # https://github.com/welcoMattic/kymsu
|
||||||
|
5 # https://github.com/getantibody/antibody
|
||||||
|
6
|
||||||
|
|
||||||
|
File: plugins.d/conda.sh
|
||||||
|
1 #!/usr/bin/env bash
|
||||||
|
2
|
||||||
|
3 # conda plugin for KYMSU
|
||||||
|
4 # https://github.com/welcoMattic/kymsu
|
||||||
|
5
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## bat-extras
|
## bat-extras
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ $ usermod -G "" <username>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Code de sortie:
|
### Code de sortie (code de retour):
|
||||||
|
|
||||||
Chaque commande renvoie un *code de sortie* (quelque fois nommé *état de retour* ).
|
Chaque commande renvoie un *code de sortie* (quelque fois nommé *état de retour* ).
|
||||||
|
|
||||||
@@ -136,6 +136,7 @@ $ hostname
|
|||||||
silverbook.home
|
silverbook.home
|
||||||
$ echo $?
|
$ echo $?
|
||||||
0
|
0
|
||||||
|
|
||||||
$ hostnam
|
$ hostnam
|
||||||
-bash: hostnam: command not found
|
-bash: hostnam: command not found
|
||||||
$ echo $?
|
$ echo $?
|
||||||
@@ -149,3 +150,18 @@ bruno@SilverBook:~/.kymsu/plugins.d$ if [ $? -eq 0 ]; then echo "ok"; else echo
|
|||||||
ok
|
ok
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip3 install -U "pip"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
# pas d'update: ret=0
|
||||||
|
[ $ret -eq 0 ] && echo -e "No update available !"
|
||||||
|
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
echo -e "No update available !"
|
||||||
|
fi
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,25 @@ gd.jpeg_ignore_warning = 1 | session.cookie_samesite =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Comparer un fichier local et un fichier distant:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ssh bruno@212.227.191.167 "cat upgrade_nextcloud.sh" | diff - /Users/bruno/Documents/Scripts/bash/upgrade_nextcloud.sh | colordiff
|
||||||
|
35c35
|
||||||
|
< php_version=7.4
|
||||||
|
---
|
||||||
|
> php_version=8.0
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Comparer 2 fichiers distants sur 2 serveurs différents:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ diff <(ssh user@remote-host1 'cat /path/to/file1') <(ssh user@remote-host2 'cat /path/to/file2')
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Colordiff peut comparer 2 dossiers:
|
Colordiff peut comparer 2 dossiers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -113,6 +132,14 @@ Files photonix/docker-compose.yml and photoprism/docker-compose.yml differ
|
|||||||
### diffmerge (GUI):
|
### diffmerge (GUI):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
❯ diffmerge config.json config.json.bak
|
$ diffmerge config.json config.json.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Comparer 2 dossiers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ diff --brief --recursive bootstrap_darkroom/ s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,39 @@ fi
|
|||||||
|
|
||||||
### Conditions:
|
### Conditions:
|
||||||
|
|
||||||
#### -fichier
|
#### -variables:
|
||||||
|
|
||||||
|
Si la variable est déclarée (présente) : -v
|
||||||
|
|
||||||
|
```bash
|
||||||
|
API_KEY=
|
||||||
|
|
||||||
|
if [ -v API_KEY ]; then echo "La variable API_KEY existe"; fi
|
||||||
|
La variable API_KEY existe
|
||||||
|
|
||||||
|
if [ -v $API_KEY ]; then echo "La variable API_KEY existe"; fi
|
||||||
|
La variable API_KEY existe
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Déclarée => vide
|
||||||
|
if [ -n "$API_KEY" ]; then echo "La variable API_KEY n'est pas vide"; else echo "La variable API_KEY est vide"; fi
|
||||||
|
La variable API_KEY est vide
|
||||||
|
|
||||||
|
# Non déclarée => vide
|
||||||
|
if [ -n "$API_KEY2" ]; then echo "La variable API_KEY2 n'est pas vide"; else echo "La variable API_KEY2 est vide"; fi
|
||||||
|
La variable API_KEY2 est vide
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Non déclarée => vide
|
||||||
|
if [ -z "$API_KEY3" ]; then echo "La variable API_KEY est vide"; else echo "La variable API_KEY n'est pas vide"; fi
|
||||||
|
La variable API_KEY est vide
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### -dossiers:
|
||||||
|
|
||||||
Si le répertoire *<u>directory</u>* existe
|
Si le répertoire *<u>directory</u>* existe
|
||||||
|
|
||||||
@@ -100,6 +132,18 @@ if [ -d directory ]; then
|
|||||||
if [ -d ~/.kde ]; then
|
if [ -d ~/.kde ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Si le répertoire *<u>directory</u>* existe ET n'est <u>pas vide</u>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
local_path=$HOME/Sites/
|
||||||
|
|
||||||
|
if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then echo "dir not empty"; else echo "dir empty"; fi
|
||||||
|
|
||||||
|
if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then echo "dir not empty"; else echo "dir empty"; fi
|
||||||
|
```
|
||||||
|
|
||||||
|
#### -fichiers:
|
||||||
|
|
||||||
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
|
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -472,3 +516,8 @@ echo "Input is a string."
|
|||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# entier
|
||||||
|
if [ -z "${i//[0-9]}" ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
------------- Minute (0 - 59)
|
------------- Minute (0 - 59)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
https://crontab.guru
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -48,3 +48,32 @@ Le fichier crontab s'ouvre dans l'éditeur spécifié par la variable d'environn
|
|||||||
|
|
||||||
https://linuxize.com/post/scheduling-cron-jobs-with-crontab/
|
https://linuxize.com/post/scheduling-cron-jobs-with-crontab/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Voir si le cron est exécuté:
|
||||||
|
|
||||||
|
On ouvre la crontab avec `# crontab -e`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# On redirige la sortie et les erreurs du scripts vers les logs avec 2>&1 | logger -t up_pihole
|
||||||
|
# Ici le cron est exécuté toutes les 2 minutes.
|
||||||
|
|
||||||
|
*/2 * * * * bash /root/update_pihole.sh 2>&1 | logger -t up_pihole
|
||||||
|
```
|
||||||
|
|
||||||
|
On cherche les sorties du cron dans les logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# journalctl -f | grep 'up_pihole\|cron'
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Aug 25 16:40:01 PiHole1 CRON[438003]: (root) CMD (/usr/bin/env > /root/cron-env)
|
||||||
|
Aug 25 16:40:01 PiHole1 CRON[438004]: (root) CMD (bash /root/update_pihole.sh 2>&1 | logger -t up_pihole)
|
||||||
|
Aug 25 16:40:01 PiHole1 CRON[438001]: pam_unix(cron:session): session closed for user root
|
||||||
|
Aug 25 16:40:02 PiHole1 up_pihole[438007]: Find Pi-hole update on PiHole1
|
||||||
|
Aug 25 16:40:02 PiHole1 up_pihole[438007]:
|
||||||
|
Aug 25 16:40:02 PiHole1 up_pihole[438007]: Pi-hole Current Last
|
||||||
|
Aug 25 16:40:02 PiHole1 up_pihole[438007]: Pi-hole v5.18.3 v5.18.3
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
81
docs/Linux/curl.md
Normal file
81
docs/Linux/curl.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# curl
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
#### Envoyer un fichier sur un ftp (Photomanager iPad):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -T /Users/bruno/Pictures/_Canon/Export/2023/Janvier/2023-01-21_FauconPelerin_0518.jpg ftp://192.168.2.112:2121 -u anonymous:
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Envoyer plusieurs fichiers sur un ftp (funnymac):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find /Users/bruno/Pictures/_Canon/Export/2023/Janvier/ -type f | xargs -L 1 bash -c '/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -T $1 sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/${1##*/}' \;
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for file in /folder/path/*
|
||||||
|
do
|
||||||
|
curl -u username:password -T ${file} http://www.example.com/folder/${file}
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Si le dossier juin n'existe pas sur le ftp, on le crée:
|
||||||
|
|
||||||
|
find /Users/bruno/Desktop/Juin -type f | xargs -L 1 bash -c '/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo --ftp-create-dirs -T $1 sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/juin/${1##*/}' \;
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Télécharger un fichier depuis un ftp (funnymac):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -O sftp://ftp.cluster011.ovh.net:22/home/funnymac/8_2022.jpg
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Télécharger plusieurs fichiers depuis un ftp (funnymac):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/opt/homebrew/opt/curl/bin/curl --user funnymac:a3XELN4PHTYF9fFHtsY97eshXBxxFo -T '{2023-01-31_RuBlanc_0627,2023-01-31_RuBlanc_0623}.jpg' sftp://ftp.cluster011.ovh.net:22/home/funnymac/www/ftp/ \;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Rendre curl silencieux:
|
||||||
|
|
||||||
|
##### Masquer erreurs et barre de progression:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s https://google.com
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Complètement silencieux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -o /dev/null https://google.com
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Afficher juste les erreurs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -S -s -o /dev/null https://google.com
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Options:
|
||||||
|
|
||||||
|
```
|
||||||
|
-Z, --parallel
|
||||||
|
-#, --progress-bar
|
||||||
|
-Q, --quote <command>
|
||||||
|
-S, --show-error
|
||||||
|
-s, --silent
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
65
docs/Linux/cut.md
Normal file
65
docs/Linux/cut.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# cut
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- séparateur par défaut: TAB
|
||||||
|
|
||||||
|
- sinon option -d ' '
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# -d (delimiter) :
|
||||||
|
# -f (field) 1
|
||||||
|
|
||||||
|
$ cut -d':' -f1 /etc/passwd
|
||||||
|
|
||||||
|
nobody
|
||||||
|
root
|
||||||
|
daemon
|
||||||
|
_uucp
|
||||||
|
_taskgated
|
||||||
|
_networkd
|
||||||
|
|
||||||
|
cut -d':' -f1-3,5,6 /etc/passwd
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Tout sauf 7e champ
|
||||||
|
|
||||||
|
$ cut -d':' -f7 --complement /etc/passwd
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Remplace le séparateur ':' par ' '
|
||||||
|
|
||||||
|
$ cut -d':' -f7 --complement /etc/passwd --output-delimiter=' '
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 5e caractère
|
||||||
|
|
||||||
|
$ echo 'cut command' | cut -b 5
|
||||||
|
c
|
||||||
|
|
||||||
|
# 5 au 7e caractères
|
||||||
|
|
||||||
|
$ echo 'cut command' | cut -b 5-7
|
||||||
|
com
|
||||||
|
|
||||||
|
# 5 et 7e caractères
|
||||||
|
|
||||||
|
$ echo 'cut command' | cut -b 5,7
|
||||||
|
cm
|
||||||
|
|
||||||
|
# Du 5e à la fin
|
||||||
|
|
||||||
|
$ echo 'cut command' | cut -b 5-
|
||||||
|
command
|
||||||
|
|
||||||
|
# Du début au 5e
|
||||||
|
|
||||||
|
$ echo 'cut command' | cut -b -5
|
||||||
|
cut c
|
||||||
|
```
|
||||||
|
|
||||||
@@ -12,3 +12,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Origine d'un lien:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/usr/local/bin
|
||||||
|
❯ readlink -f kymsu2
|
||||||
|
/Users/bruno/Documents/Scripts/kymsu2/kymsu2.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
99
docs/Linux/du-df.md
Normal file
99
docs/Linux/du-df.md
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
# du - df
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### du
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost thumbsup]$ ls -la
|
||||||
|
|
||||||
|
total 32
|
||||||
|
drwxrwxr-x 5 sentier psacln 4096 févr. 18 16:55 .
|
||||||
|
drwxrwxr-x 22 sentier psaserv 4096 févr. 18 17:09 ..
|
||||||
|
-rw-r--r-- 1 sentier psacln 440 févr. 7 10:55 config-npm.json
|
||||||
|
drwxrwxr-x 6 sentier psacln 4096 févr. 26 18:24 Nas
|
||||||
|
drwxr-xr-x 5 sentier psacln 4096 févr. 7 10:46 theme-flow
|
||||||
|
drwxr-xr-x 5 sentier psacln 4096 févr. 7 10:46 theme-flow-bruno
|
||||||
|
-rw-r--r-- 1 sentier psacln 24 févr. 7 11:39 theme_options.json
|
||||||
|
-rwxr-xr-x 1 sentier psacln 1317 févr. 12 15:27 thumbsup-npm.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Connaitre la taille des dossiers et fichiers d'un répertoire:
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost thumbsup]$ du -ach . --max-depth 1
|
||||||
|
|
||||||
|
4,0K ./config-npm.json
|
||||||
|
4,0K ./theme_options.json
|
||||||
|
4,0K ./thumbsup-npm.sh
|
||||||
|
668M ./Nas
|
||||||
|
2,2M ./theme-flow
|
||||||
|
2,2M ./theme-flow-bruno
|
||||||
|
672M .
|
||||||
|
672M total
|
||||||
|
```
|
||||||
|
|
||||||
|
Connaitre la taille des dossiers (et sous-dossiers) d'un répertoire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost thumbsup]$ du -h
|
||||||
|
|
||||||
|
21M ./Nas/Motos/24H Mans
|
||||||
|
11M ./Nas/Motos/GP France
|
||||||
|
...
|
||||||
|
672M .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Afficher la taille totale d'un répertoire:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost thumbsup]$ du -sh Nas/
|
||||||
|
|
||||||
|
668M Nas/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost thumbsup]$ du -Sh Nas/
|
||||||
|
|
||||||
|
21M Nas/Motos/24H Mans
|
||||||
|
11M Nas/Motos/GP France
|
||||||
|
9,3M Nas/Motos/Bol Classic
|
||||||
|
...
|
||||||
|
4,0K Nas/Faune
|
||||||
|
4,0K Nas/_Archived Items
|
||||||
|
4,0K Nas/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### df (espace libre)
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- T: Type
|
||||||
|
- h: Human
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[sentier@localhost Nas]$ df -hT
|
||||||
|
Filesystem Type Size Used Avail Use% Mounted on
|
||||||
|
udev devtmpfs 1,9G 0 1,9G 0% /dev
|
||||||
|
tmpfs tmpfs 393M 1,3M 391M 1% /run
|
||||||
|
/dev/mapper/vg00-lv01 ext4 47G 38G 7,1G 85% /
|
||||||
|
tmpfs tmpfs 2,0G 0 2,0G 0% /dev/shm
|
||||||
|
tmpfs tmpfs 5,0M 24K 5,0M 1% /run/lock
|
||||||
|
tmpfs tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup
|
||||||
|
/dev/sda1 ext4 464M 115M 321M 27% /boot
|
||||||
|
tmpfs tmpfs 393M 0 393M 0% /run/user/10001
|
||||||
|
```
|
||||||
|
|
||||||
37
docs/Linux/exa.md
Normal file
37
docs/Linux/exa.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# exa
|
||||||
|
|
||||||
|
Remplaçant de *ls*
|
||||||
|
|
||||||
|
https://the.exa.website
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install exa
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exa n'est plus maintenant. Il est remplacé par eza.
|
||||||
|
|
||||||
|
# eza
|
||||||
|
|
||||||
|
https://github.com/eza-community/eza
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**exa -lbhHigUmuSa@ --time-style=long-iso --git --color-scale**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ exa -lbhHigUmuSa@ --time-style=long-iso --git --color-scale
|
||||||
|
inode Permissions Links Size Blocks User Group Date Modified Date Created Date Accessed Git Name
|
||||||
|
3426575 drwxr-xr-x 12 - - bruno staff 2021-08-05 17:33 2021-08-05 09:35 2021-08-05 17:33 -- .git
|
||||||
|
3426645 drwxr-xr-x 3 - - bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 17:32 -- img
|
||||||
|
3426641 .rw-r--r-- 1 1,1Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:35 -- LICENSE
|
||||||
|
3426642 .rw-r--r-- 1 1,4Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:35 -- Pure Dark.alfredappearance
|
||||||
|
3426643 .rw-r--r--@ 1 1,4Ki 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:36 -- Pure Light.alfredappearance
|
||||||
|
└── com.apple.lastuseddate#PS (len 16)
|
||||||
|
3426644 .rw-r--r-- 1 316 8 bruno staff 2021-08-05 09:35 2021-08-05 09:35 2021-08-05 09:36 -- README.md
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
137
docs/Linux/fd.md
137
docs/Linux/fd.md
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
(alternative à [find](find.md)) (macOS / Linux / Windows)
|
(alternative à [find](find.md)) (macOS / Linux / Windows)
|
||||||
|
|
||||||
|
https://github.com/sharkdp/fd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ brew install fd
|
$ brew install fd
|
||||||
```
|
```
|
||||||
@@ -12,7 +16,7 @@ choco install fd
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
##### Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
~ master* ⇡
|
~ master* ⇡
|
||||||
@@ -25,41 +29,44 @@ pip/pip.conf
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Recherche dans un répertoire particulier:
|
##### Recherche dans un répertoire particulier:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
~ master* ⇡
|
# Fichiers cachés (-H) dans le dossier .ssh
|
||||||
❯ fd -HI 'id_*' .ssh
|
|
||||||
|
$ fd -HI 'id_*' .ssh
|
||||||
.ssh/id_ed25519
|
.ssh/id_ed25519
|
||||||
.ssh/id_ed25519.pub
|
.ssh/id_ed25519.pub
|
||||||
.ssh/id_rsa
|
.ssh/id_rsa
|
||||||
.ssh/id_rsa.pub
|
.ssh/id_rsa.pub
|
||||||
.ssh/id_rsa.zip
|
.ssh/id_rsa.zip
|
||||||
|
|
||||||
|
❯ fd -HI 'id_*' $HOME/.ssh
|
||||||
|
/Users/bruno/.ssh/id_ed25519
|
||||||
|
/Users/bruno/.ssh/id_ed25519.pub
|
||||||
|
/Users/bruno/.ssh/id_rsa
|
||||||
|
/Users/bruno/.ssh/id_rsa.pub
|
||||||
```
|
```
|
||||||
|
|
||||||
Recherche par regex:
|
##### Recherche par regex:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
~ master* ⇡ 4m 27s
|
$ fd -I '^.*.conf$' /opt
|
||||||
❯ fd -HI '^h.*.conf$' /etc
|
/opt/homebrew/share/autoconf
|
||||||
/etc/apache2/extra/httpd-autoindex.conf
|
/opt/homebrew/share/user_map.conf
|
||||||
/etc/apache2/extra/httpd-dav.conf
|
/opt/homebrew/Cellar/mariadb/10.6.4/share/user_map.conf
|
||||||
/etc/apache2/extra/httpd-default.conf
|
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/groonga.conf
|
||||||
/etc/apache2/extra/httpd-info.conf
|
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/httpd/fastcgi.conf
|
||||||
/etc/apache2/extra/httpd-languages.conf
|
|
||||||
/etc/apache2/extra/httpd-manual.conf
|
|
||||||
/etc/apache2/extra/httpd-mpm.conf
|
|
||||||
/etc/apache2/extra/httpd-multilang-errordoc.conf
|
|
||||||
/etc/apache2/extra/httpd-ssl.conf
|
|
||||||
/etc/apache2/extra/httpd-userdir.conf
|
|
||||||
/etc/apache2/extra/httpd-vhosts.conf
|
|
||||||
/etc/apache2/httpd.conf
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
$ fd -H '^.*.conf$' /opt
|
||||||
|
|
||||||
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
https://docs.rs/regex/1.0.0/regex/#syntax
|
https://docs.rs/regex/1.0.0/regex/#syntax
|
||||||
|
|
||||||
Fichiers se terminant par *'[0-9].jpg'*:
|
##### Fichiers se terminant par *'[0-9].jpg'*:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ fd -HI '.*[0-9]\.jpg$' ~
|
$ fd -HI '.*[0-9]\.jpg$' ~
|
||||||
@@ -67,17 +74,97 @@ $ fd -HI '.*[0-9]\.jpg$' ~
|
|||||||
$ find ~ -iname '*[0-9].jpg'
|
$ find ~ -iname '*[0-9].jpg'
|
||||||
```
|
```
|
||||||
|
|
||||||
Sans arguments:
|
##### Rechercher une extension:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Rechercher les scripts bash (.sh) dans le répertoire courant
|
||||||
|
|
||||||
|
$ fd -e sh .
|
||||||
|
convert-videos-for-plex.sh
|
||||||
|
handbrake_for_plex.sh
|
||||||
|
keywords2insta.sh
|
||||||
|
macho.sh
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Sans arguments:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# afficher tous les entrées du répertoire courant
|
||||||
|
$ fd
|
||||||
|
|
||||||
|
# afficher tous les entrées d'un répertoire
|
||||||
|
$ fd . $HOME/.ssh
|
||||||
|
/Users/bruno/.ssh/config
|
||||||
|
/Users/bruno/.ssh/id_ed25519
|
||||||
|
/Users/bruno/.ssh/id_ed25519.pub
|
||||||
|
/Users/bruno/.ssh/id_rsa
|
||||||
|
/Users/bruno/.ssh/id_rsa.pub
|
||||||
|
/Users/bruno/.ssh/known_hosts
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Chercher un fichier précis:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ fd -I -g php.ini /opt
|
||||||
|
/opt/homebrew/etc/php/7.4/php.ini
|
||||||
|
/opt/homebrew/etc/php/8.0/php.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Rechercher plusieurs patterns:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ fd -H ".env|docker-compose.yml"
|
||||||
|
.env
|
||||||
|
docker-compose.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Option:
|
|
||||||
|
|
||||||
- --hidden: cherche dans les dossiers cachés
|
#### Option:
|
||||||
- --no-ignore:
|
|
||||||
- -x / --exec:
|
- **-H, --hidden**: cherche dans les fichiers et dossiers cachés
|
||||||
|
- **-I, --no-ignore**: cherche dans les fichiers et dossiers ignorés par '.gitignore', '.ignore', '.fdignore'
|
||||||
|
- **-x, --exec <cmd>**: exécute une commande pour chaque résultat
|
||||||
|
- **-X, --exec-batch <cmd>**: exécute une commande pour tous les résultats en même temps
|
||||||
|
- **-s, --case-sensitive**:
|
||||||
|
- **-i, --ignore-case**: (défaut)
|
||||||
|
- **-l, --list-details**
|
||||||
|
- **-L, --follow**: suit les liens symboliques (pas par défaut)
|
||||||
|
- **-d, --max-depth <depth>**: limite le nombre de répertoires traversés (pas de limite par défaut)
|
||||||
|
- **-t, --type <filetype>...**: filtre par type de fichiers
|
||||||
|
- 'f' or 'file': fichiers réguliers
|
||||||
|
- 'd' or 'directory': répertoires
|
||||||
|
- 'l' or 'symlink': liens symboliques
|
||||||
|
- 'x' or 'executable': executables
|
||||||
|
- 'e' or 'empty': fichiers vides ou répertoires
|
||||||
|
- 's' or 'socket': socket
|
||||||
|
- 'p' or 'pipe': named pipe (FIFO)
|
||||||
|
- **-e, --extension <ext>...**: filtre par extension (plusieurs autorisées)
|
||||||
|
- **-E, --exclude <pattern>...**: exclure des fichiers/répertoires des résultats (--exclude '*.pyc', --exclude node_modules)
|
||||||
|
- **-c, --color <when>**: colorie chaque chaine trouvée ('auto', 'never', 'always')
|
||||||
|
- **-S, --size <size>...**: filtre par la taille des fichiers (+3k, -500, +1g, 300)
|
||||||
|
- **--changed-within <date|dur>**: filtre par la date de modification
|
||||||
|
- --changed-within 2 weeks (10h, 1d, 35min)
|
||||||
|
- --change-newer-than '2018-10-27 10:00:00'
|
||||||
|
- **--changed-before <date|dur>**: filtre par la date de modification
|
||||||
|
- --changed-before '2018-10-27 10:00:00'
|
||||||
|
- --change-older-than 2weeks (10h, 1d, 35min)
|
||||||
|
- **-o, --owner <user:group>**: filtre par utilisateur/groupe (--owner bruno, --owner :staff, --owner '!john:students')
|
||||||
|
- **--max-results <count>**: limite le nombre de résultats à 'count' et quitte
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# -l, --list-details
|
||||||
|
|
||||||
|
$ fd -Il '^.*.conf$' /opt/homebrew/etc
|
||||||
|
-rw-r--r-- 1 bruno admin 696 jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-hinting-slight.conf
|
||||||
|
-rw-r--r-- 1 bruno admin 2,2K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
|
||||||
|
-rw-r--r-- 1 bruno admin 1,6K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/20-unhint-small-vera.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,19 @@ Les <u>critères de recherche</u> sont les suivants :
|
|||||||
|
|
||||||
#### Nom:
|
#### Nom:
|
||||||
|
|
||||||
Recherche par <u>nom de fichier</u>:
|
Recherche par <u>nom</u> (**-name**) (sensible à la case):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Le nom exact: toto
|
||||||
|
|
||||||
$ find /usr -name toto -print
|
$ find /usr -name toto -print
|
||||||
|
|
||||||
|
# Le nom contient: Casa
|
||||||
|
|
||||||
|
$ find /usr -name "*Casa*"
|
||||||
|
|
||||||
|
# L'extension est .c
|
||||||
|
|
||||||
$ find /usr -name " *.c " -print
|
$ find /usr -name " *.c " -print
|
||||||
|
|
||||||
# commence par un a ou A, suivi de quelque chose, et se termine par un chiffre compris entre 3 et 6
|
# commence par un a ou A, suivi de quelque chose, et se termine par un chiffre compris entre 3 et 6
|
||||||
@@ -37,13 +45,52 @@ $ find /usr -name " *.c " -print
|
|||||||
$ find . -name '[aA]*[3-6]' -print
|
$ find . -name '[aA]*[3-6]' -print
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Recherche par <u>nom</u> (**-iname**) (non sensible à la case):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Le nom exact: toto
|
||||||
|
|
||||||
|
$ find /usr -iname toto -print
|
||||||
|
```
|
||||||
|
|
||||||
|
Cela renvoie à la fois des fichiers et des dossiers. Pour avoir le choix fichiers ou dossiers (**-type**):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pour les fichiers uniquement
|
||||||
|
|
||||||
|
$ find /usr -name toto -type f
|
||||||
|
|
||||||
|
# Pour les dossiers uniquement
|
||||||
|
|
||||||
|
$ find /usr -name toto -type d
|
||||||
|
```
|
||||||
|
|
||||||
|
Ne pas afficher les fichiers ou dossiers invisibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$find -not -path '*/\.*'
|
||||||
|
|
||||||
|
$find . -type f | grep -v '/\.'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Taille:
|
#### Taille:
|
||||||
|
|
||||||
Recherche suivant la <u>taille</u>:
|
Recherche suivant la <u>taille</u> (**-size**):
|
||||||
|
|
||||||
|
- c: octet
|
||||||
|
- k: kilo
|
||||||
|
- M: méga
|
||||||
|
- G: giga
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# fichiers de 30ko
|
||||||
|
|
||||||
|
$ find / -size 30k -print
|
||||||
|
|
||||||
# fichiers dont la taille dépasse 30ko
|
# fichiers dont la taille dépasse 30ko
|
||||||
|
|
||||||
$ find / -size +30k -print
|
$ find / -size +30k -print
|
||||||
@@ -51,6 +98,24 @@ $ find / -size +30k -print
|
|||||||
# fichiers dont la taille est comprise entre 30 et 100ko
|
# fichiers dont la taille est comprise entre 30 et 100ko
|
||||||
|
|
||||||
$ find / -size +30k -size -100k
|
$ find / -size +30k -size -100k
|
||||||
|
|
||||||
|
# fichiers de moins de 30ko
|
||||||
|
|
||||||
|
$ find / -size -30k -print
|
||||||
|
|
||||||
|
|
||||||
|
# répertoire de plus de 30k
|
||||||
|
|
||||||
|
$ find / -type d -size +30k -print
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# fichier ou répertoire vide
|
||||||
|
|
||||||
|
$ find / -size 0
|
||||||
|
$ find / -empty
|
||||||
|
|
||||||
|
find / -type d -empty
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +125,7 @@ $ find / -size +30k -size -100k
|
|||||||
Recherche en utilisant les <u>opérateurs logiques</u>:
|
Recherche en utilisant les <u>opérateurs logiques</u>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# les fichiers n'appartenant pas à l'utilisateur olivierles fichiers n'appartenant pas à l'utilisateur olivier
|
# Recherche les fichiers n'appartenant pas à l'utilisateur olivier.
|
||||||
|
|
||||||
$ find . ! -user olivier -print
|
$ find . ! -user olivier -print
|
||||||
|
|
||||||
@@ -68,6 +133,10 @@ $ find . ! -user olivier -print
|
|||||||
|
|
||||||
$ find . \ ( -name a.out -o -name " *.c " \ ) -print
|
$ find . \ ( -name a.out -o -name " *.c " \ ) -print
|
||||||
|
|
||||||
|
# Recherche les fichiers dont l'extension est .pdf, .txt ou .doc
|
||||||
|
|
||||||
|
$ find . -type f ( -name "*.txt" -o -name "*.pdf" -o -name "*.doc" )
|
||||||
|
|
||||||
# Recherche des fichiers dont le nom est core et d'une taille supérieure à 1Mo (une condition ET l'autre).
|
# Recherche des fichiers dont le nom est core et d'une taille supérieure à 1Mo (une condition ET l'autre).
|
||||||
|
|
||||||
$ find . \ (-name core -a size +2000 \ ) -print
|
$ find . \ (-name core -a size +2000 \ ) -print
|
||||||
@@ -83,7 +152,7 @@ Rechercher <u>le plus vieux</u> fichier:
|
|||||||
$ find / -type f -printf '%T+ %p\n' | sort | head -n 1
|
$ find / -type f -printf '%T+ %p\n' | sort | head -n 1
|
||||||
```
|
```
|
||||||
|
|
||||||
Recherche suivant la <u>date de dernière modification</u>:
|
Recherche suivant la <u>date de dernière modification</u> (**-mtime**):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# modifiés il y a 30 jours
|
# modifiés il y a 30 jours
|
||||||
@@ -144,6 +213,20 @@ $ find /volume1/@appstore/PHP7.4/etc ! -perm 644
|
|||||||
/volume1/@appstore/PHP7.4/etc/php/conf.d
|
/volume1/@appstore/PHP7.4/etc/php/conf.d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Rechercher les fichiers avec permission 644 et les afficher avec ls:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ find -maxdepth 1 -type f -perm -644 -ls
|
||||||
|
920871 148 -rw-r--r-- 1 sentier psacln 148546 Nov 14 16:37 ./12_2008.jpg
|
||||||
|
920718 276 -rw-r--r-- 1 sentier psacln 278540 Nov 14 16:37 ./7_2017.jpg
|
||||||
|
920675 120 -rw-r--r-- 1 sentier psacln 120837 Nov 14 16:37 ./5_2020.jpg
|
||||||
|
|
||||||
|
$ find -maxdepth 1 -type f -perm -644 -exec ls -la {} \;
|
||||||
|
-rw-r--r-- 1 sentier psacln 89608 Nov 14 16:37 ./11_2018.jpg
|
||||||
|
-rw-r--r-- 1 sentier psacln 258835 Nov 14 16:37 ./9_2007.jpg
|
||||||
|
-rw-r--r-- 1 sentier psacln 343441 Nov 14 16:37 ./7_2005.jpg
|
||||||
|
```
|
||||||
|
|
||||||
Rechercher les fichiers avec permission 777 et les modifiés en 644:
|
Rechercher les fichiers avec permission 777 et les modifiés en 644:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -318,6 +401,9 @@ find: ‘/volume1/@appstore/Gitea/gitea/.ssh’: Permission denied
|
|||||||
```
|
```
|
||||||
Tous les messages d'erreurs sont redirigés avec `2>/dev/null` vers la poubelle.
|
Tous les messages d'erreurs sont redirigés avec `2>/dev/null` vers la poubelle.
|
||||||
```bash
|
```bash
|
||||||
|
$ find / -name site-packages -type d -print 2>/dev/null
|
||||||
|
|
||||||
|
|
||||||
$ find /volume1/@appstore/ -name "*php*.ini" 2>/dev/null
|
$ find /volume1/@appstore/ -name "*php*.ini" 2>/dev/null
|
||||||
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
|
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
|
||||||
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
|
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
|
||||||
|
|||||||
@@ -27,14 +27,85 @@ Parcourir les arguments passés au script:
|
|||||||
```bash
|
```bash
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
echo "$i"
|
echo "Hi $i"
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Parcourrir une liste:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for i in {1..5}
|
||||||
|
do
|
||||||
|
echo "Hi $i"
|
||||||
|
done
|
||||||
|
|
||||||
|
Hi 1
|
||||||
|
Hi 2
|
||||||
|
Hi 3
|
||||||
|
Hi 4
|
||||||
|
Hi 5
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# bash 4.0+
|
||||||
|
for i in {0. .8. .2} # debut. .fin. .increment
|
||||||
|
do
|
||||||
|
echo "Hi $i"
|
||||||
|
done
|
||||||
|
|
||||||
|
Hi 0
|
||||||
|
Hi 2
|
||||||
|
Hi 4
|
||||||
|
Hi 6
|
||||||
|
Hi 8
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
for ((i=0 ; 10 - $i ; i++))
|
for ((i=0 ; 10 - $i ; i++))
|
||||||
do echo $i
|
do
|
||||||
|
echo "Hi $i"
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for (( c=1; c<=5; c++ ))
|
||||||
|
do
|
||||||
|
echo "Hi $c"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Continue
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for i in {1..5}
|
||||||
|
do
|
||||||
|
[[ "$i" == '4' ]] && continue;
|
||||||
|
echo "Hi $i"
|
||||||
|
done
|
||||||
|
|
||||||
|
Hi 1
|
||||||
|
Hi 2
|
||||||
|
Hi 3
|
||||||
|
Hi 5
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Break
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for i in {1..5}
|
||||||
|
do
|
||||||
|
[[ "$i" == '4' ]] && break;
|
||||||
|
echo "Hi $i"
|
||||||
|
done
|
||||||
|
|
||||||
|
Hi 1
|
||||||
|
Hi 2
|
||||||
|
Hi 3
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
426
docs/Linux/fzf.md
Normal file
426
docs/Linux/fzf.md
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
# fzf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf/wiki
|
||||||
|
|
||||||
|
https://sim590.github.io/fr/outils/fzf/#extension-de-la-complétion
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf/wiki/examples
|
||||||
|
|
||||||
|
https://github.com/junegunn/fzf/blob/master/ADVANCED.md
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew install fzf
|
||||||
|
|
||||||
|
# To install useful key bindings and fuzzy completion:
|
||||||
|
$ $(brew --prefix)/opt/fzf/install
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Syntaxe:
|
||||||
|
|
||||||
|
| Token | Match type | Description |
|
||||||
|
| --------- | -------------------------- | ------------------------------------ |
|
||||||
|
| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |
|
||||||
|
| `'wild` | exact-match (quoted) | Items that include `wild` |
|
||||||
|
| `^music` | prefix-exact-match | Items that start with `music` |
|
||||||
|
| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |
|
||||||
|
| `!fire` | inverse-exact-match | Items that do not include `fire` |
|
||||||
|
| `!^music` | inverse-prefix-exact-match | Items that do not start with `music` |
|
||||||
|
| `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |
|
||||||
|
|
||||||
|
Options
|
||||||
|
|
||||||
|
Search mode
|
||||||
|
-e, --exact
|
||||||
|
Enable exact-match
|
||||||
|
|
||||||
|
-i Case-insensitive match (default: smart-case match)
|
||||||
|
|
||||||
|
+i Case-sensitive match
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation 1:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master* 19s 17:46:16
|
||||||
|
$ find . | fzf
|
||||||
|
```
|
||||||
|
|
||||||
|
puis on entre des mots-clé pour affiner la recherche.
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf2.png" alt="fzf2" style="zoom:50%;" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation 2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ nano $(fzf)
|
||||||
|
```
|
||||||
|
|
||||||
|
On filtre: 'led
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf.png" alt="fzf" style="zoom:50%;" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Return** ouvre le fichier dans nano.
|
||||||
|
|
||||||
|
On peut ouvrir plusieurs fichiers dans nano:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ nano $(fzf -m)
|
||||||
|
```
|
||||||
|
|
||||||
|
puis **Tab** pour sélectionner plusieurs fichiers et **Return** pour les ouvrir.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Fuzzy completion
|
||||||
|
|
||||||
|
Déclencheur: ** puis <Tab>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Utilisation 3 (complétion de cd):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master* 18:00:32
|
||||||
|
$ cd **
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis **Tab**
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf3.png" alt="fzf3" style="zoom:50%;" />
|
||||||
|
|
||||||
|
Puis **Return**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ cd SiriControl/
|
||||||
|
|
||||||
|
~/Documents/Scripts_Raspberry/SiriControl master*
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
La complétion marche aussi avec la <u>commande ssh</u>: les serveurs sont tirés de /etc/hosts et de ssh/config.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation 4 (kill):
|
||||||
|
|
||||||
|
Taper **kill** puis **Espace** puis **Tab**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ kill<espace>
|
||||||
|
```
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf4.png" alt="fzf4" style="zoom:50%;" />
|
||||||
|
|
||||||
|
**Tab** pour sélectionner les process à tuer puis **Return**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry/SiriControl master*
|
||||||
|
$ kill 266 311
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation 5 (complétion de cat):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ cat **
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis **Tab**
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf5.png" alt="fzf5" style="zoom:100%;" />
|
||||||
|
|
||||||
|
Puis **Return**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ cat pir/pir2.py
|
||||||
|
```
|
||||||
|
|
||||||
|
La complétion marche aussi avec les variables d'environnement.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ unset **<Tab>
|
||||||
|
$ unalias **<Tab>
|
||||||
|
$ export **<Tab>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Utilisation 6 (complétion de nano):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ nano /opt/**
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis **Tab**
|
||||||
|
|
||||||
|
<img src="/Users/bruno/Documents/docs/docs/Linux/fzf6.png" alt="fzf6" style="zoom:100%;" />
|
||||||
|
|
||||||
|
Puis **Return**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ nano /opt/homebrew/etc/httpd/httpd.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Lancer la fuzzy recherche dans le répertoire parent:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/Documents/Scripts_Raspberry master*
|
||||||
|
$ nano ../**
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Options:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fzf --height 40% --layout reverse --info inline --border \
|
||||||
|
--preview 'bat --style=numbers --color=always --line-range :500 {}' --preview-window right \
|
||||||
|
--color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# .zshrc
|
||||||
|
|
||||||
|
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
||||||
|
#export FZF_DEFAULT_COMMAND="find ."
|
||||||
|
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow'
|
||||||
|
# --preview "bat --style=numbers --color=always --line-range :500 {}" --preview="head -$LINES {}"
|
||||||
|
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://bluz71.github.io/2018/11/26/fuzzy-finding-in-bash-with-fzf.html
|
||||||
|
|
||||||
|
https://curatedgo.com/r/fzf-is-a-junegunnfzf/index.html
|
||||||
|
|
||||||
|
https://thevaluable.dev/practical-guide-fzf-example/
|
||||||
|
|
||||||
|
https://pragmaticpineapple.com/four-useful-fzf-tricks-for-your-terminal/
|
||||||
|
|
||||||
|
https://reposhub.com/linux/shell-applications/lincheney-fzf-tab-completion.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Python
|
||||||
|
|
||||||
|
#### Activer un venv:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
function activate-venv() {
|
||||||
|
local selected_env
|
||||||
|
selected_env=$(ls ~/.venv/ | fzf)
|
||||||
|
|
||||||
|
if [ -n "$selected_env" ]; then
|
||||||
|
source "$HOME/.venv/$selected_env/bin/activate"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Git
|
||||||
|
|
||||||
|
#### Git commit history
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git log --oneline | fzf --preview 'git show --name-only {1}'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Navigateurs
|
||||||
|
|
||||||
|
#### Recherche dans l'historique de Firefox:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/Library/Application\ Support/Firefox/Profiles/*.default-release
|
||||||
|
sqlite3 places.sqlite "SELECT url FROM moz_places" | fzf
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Recherche dans les bookmarks de chrome:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
b() {
|
||||||
|
bookmarks_path=~/Library/Application\ Support/Google/Chrome/Default/Bookmarks
|
||||||
|
|
||||||
|
jq_script='
|
||||||
|
def ancestors: while(. | length >= 2; del(.[-1,-2]));
|
||||||
|
. as $in | paths(.url?) as $key | $in | getpath($key) | {name,url, path: [$key[0:-2] | ancestors as $a | $in | getpath($a) | .name?] | reverse | join("/") } | .path + "/" + .name + "\t" + .url'
|
||||||
|
|
||||||
|
jq -r "$jq_script" < "$bookmarks_path" \
|
||||||
|
| sed -E $'s/(.*)\t(.*)/\\1\t\x1b[36m\\2\x1b[m/g' \
|
||||||
|
| fzf --ansi \
|
||||||
|
| cut -d$'\t' -f2 \
|
||||||
|
| xargs open
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Recherche dans l'historique de Safari:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
function sbh() {
|
||||||
|
local cols sep
|
||||||
|
cols=$(( COLUMNS / 3 ))
|
||||||
|
sep='{::}'
|
||||||
|
|
||||||
|
cp -f ~/Library/Safari/History.db /tmp/h
|
||||||
|
|
||||||
|
sqlite3 -separator $sep /tmp/h \
|
||||||
|
"select substr(id, 1, $cols), url
|
||||||
|
from history_items order by visit_count_score desc" |
|
||||||
|
awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' |
|
||||||
|
fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
|
||||||
|
}
|
||||||
|
|
||||||
|
fzf-safari-browser-history()
|
||||||
|
{
|
||||||
|
local cols sep
|
||||||
|
columns=$(( COLUMNS / 3 ))
|
||||||
|
separator='{::}'
|
||||||
|
sqlite3 -separator $separator $HOME/Library/Safari/History.db \
|
||||||
|
"select distinct substr(title, 1, $columns), url from history_items
|
||||||
|
inner join history_visits on history_items.id = history_visits.history_item
|
||||||
|
order by history_visits.visit_time desc;" |
|
||||||
|
awk -F $separator '{printf "%-'$columns's \x1b[36m%s\x1b[m\n", $1, $2}' |
|
||||||
|
fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open -a safari
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Terminal
|
||||||
|
|
||||||
|
#### Kill process:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kill -9 $(ps aux | fzf | awk '{print $2}')
|
||||||
|
```
|
||||||
|
|
||||||
|
#### File preview
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fd . '/opt/homebrew' | fzf --height=90% --reverse --preview 'cat {}' --query '_log'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Select a docker container to start and attach to
|
||||||
|
function da() {
|
||||||
|
local cid
|
||||||
|
cid=$(docker ps -a | sed 1d | fzf -1 -q "$1" | awk '{print $1}')
|
||||||
|
|
||||||
|
[ -n "$cid" ] && docker start "$cid" && docker attach "$cid"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Select a running docker container to stop
|
||||||
|
function ds() {
|
||||||
|
local cid
|
||||||
|
cid=$(docker ps | sed 1d | fzf -q "$1" | awk '{print $1}')
|
||||||
|
|
||||||
|
[ -n "$cid" ] && docker stop "$cid"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Select a docker container to remove
|
||||||
|
function drm() {
|
||||||
|
local cid
|
||||||
|
cid=$(docker ps -a | sed 1d | fzf -q "$1" | awk '{print $1}')
|
||||||
|
|
||||||
|
[ -n "$cid" ] && docker rm "$cid"
|
||||||
|
}
|
||||||
|
# Same as above, but allows multi selection:
|
||||||
|
function drm() {
|
||||||
|
docker ps -a | sed 1d | fzf -q "$1" --no-sort -m --tac | awk '{ print $1 }' | xargs -r docker rm
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Select a docker image or images to remove
|
||||||
|
function drmi() {
|
||||||
|
docker images | sed 1d | fzf -q "$1" --no-sort -m --tac | awk '{ print $3 }' | xargs -r docker rmi
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Homebrew Cask
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install or open the webpage for the selected application
|
||||||
|
# using brew cask search as input source
|
||||||
|
# and display a info quickview window for the currently marked application
|
||||||
|
install() {
|
||||||
|
local token
|
||||||
|
token=$(brew search --casks "$1" | fzf-tmux --query="$1" +m --preview 'brew info {}')
|
||||||
|
|
||||||
|
if [ "x$token" != "x" ]
|
||||||
|
then
|
||||||
|
echo "(I)nstall or open the (h)omepage of $token"
|
||||||
|
read input
|
||||||
|
if [ $input = "i" ] || [ $input = "I" ]; then
|
||||||
|
brew install --cask $token
|
||||||
|
fi
|
||||||
|
if [ $input = "h" ] || [ $input = "H" ]; then
|
||||||
|
brew home $token
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### fzf-brew
|
||||||
|
|
||||||
|
```bash
|
||||||
|
antigen bundle thirteen37/fzf-brew
|
||||||
|
|
||||||
|
fbi: Fuzzy brew install
|
||||||
|
fbui: Fuzzy brew uninstall
|
||||||
|
fci: Fuzzy cask install
|
||||||
|
fcui: Fuzzy cask uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
https://github.com/thirteen37/fzf-brew?tab=readme-ov-file
|
||||||
BIN
docs/Linux/fzf.png
Normal file
BIN
docs/Linux/fzf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/Linux/fzf2.png
Normal file
BIN
docs/Linux/fzf2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 315 KiB |
BIN
docs/Linux/fzf3.png
Normal file
BIN
docs/Linux/fzf3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
BIN
docs/Linux/fzf4.png
Normal file
BIN
docs/Linux/fzf4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 472 KiB |
BIN
docs/Linux/fzf5.png
Normal file
BIN
docs/Linux/fzf5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
docs/Linux/fzf6.png
Normal file
BIN
docs/Linux/fzf6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
63
docs/Linux/grep-options-fr.md
Normal file
63
docs/Linux/grep-options-fr.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# grep --options
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| **grep (BSD)** | **grep (GNU)** |
|
||||||
|
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
|
| **-A** num, -**-after-context**=num<br />Affiche les lignes numériques du contexte de fin après chaque correspondance. Voir aussi les options **-B** et**-C**. | **-A** NUM, **--after-context**=NUM<br/>Affiche les lignes NUM du contexte de fin après avoir fait correspondre les lignes. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances. Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||||
|
| **-a**, **--text**<br />Traitez tous les fichiers comme du texte ASCII. | **-a**, **--text**<br/>Traiter un fichier binaire comme s'il s'agissait de texte ; c'est équivalent à l'option **--binary-files**=text. |
|
||||||
|
| **-B** num, **--before-context**=num<br />Affiche le nombre de lignes de contexte principal avant chaque correspondance. Voir aussi les options **-A** et **-C**. | **-B** NUM, **--before-context**=NUM<br/>Affiche les lignes NUM du contexte principal avant de faire correspondre les lignes. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances. Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||||
|
| **-b**, **--byte-offset**<br />Le décalage en octets d'un motif correspondant est affiché devant la ligne correspondante respective. | **-b**, **--byte-offset**<br/>Affche le décalage d'octets basé sur 0 dans le fichier d'entrée avant chaque ligne de sortie. Si **-o** (**--only-matching**) est spécifié, imprimez le décalage de la pièce correspondante elle-même. |
|
||||||
|
| **-C**[num, **--context**=num]<br />Imprimez des lignes numériques de contexte de début et de fin entourant chaque correspondance. La valeur par défaut est 2 et équivaut à **-A** 2 **-B** 2. | Affiche les lignes NUM du contexte de sortie. Place une ligne contenant un séparateur de groupe (--) entre des groupes contigus de correspondances.<br/>Avec l'option **-o** ou **--only-matching**, cela n'a aucun effet et un avertissement est donné. |
|
||||||
|
| **-c**, **--count**<br />Seul un nombre de lignes sélectionnées est écrit sur la sortie standard. | **-c**, **--count**<br/>Supprimez la sortie normale ; imprimez plutôt un nombre de lignes correspondantes pour chaque fichier d'entrée. Avec l'option **-v**, **--invert-match** (voir ci-dessous), comptez les lignes non correspondantes. |
|
||||||
|
| **--colour**=[when, **--color**=[when]]<br />Marquez le texte correspondant avec l'expression stockée dans la variable d'environnement GREP_COLOR. Les valeurs possibles de when peuvent être *never*, *always*, ou *auto*. | **--color**[=WHEN], **--colour**[=WHEN]<br/>Entourez les chaînes (non vides) correspondantes, les lignes de contexte, les noms de fichiers, les numéros de ligne, les décalages d'octets et les séparateurs correspondants (pour les champs et les groupes de lignes de contexte) de séquences d'échappement pour les a-cher en couleur sur le terminal. Les couleurs sont définies par la variable d'environnement GREP_COLORS. La variable d'environnement obsolète GREP_COLOR est toujours prise en charge, mais son paramètre n'a pas la priorité. WHEN est *never*, *always*, ou *auto*. |
|
||||||
|
| **-D** action, **--devices**=action<br />Spécifiez l'action demandée pour les périphériques, les FIFO et les sockets. L'action par défaut est *'read',* ce qui signifie qu'ils sont lus comme s'il s'agissait de fichiers normaux. Si l'action est définie sur *'skip'*, les périphériques seront ignorés silencieusement. | **-D** ACTION, **--devices**=ACTION<br/>Si un fichier d'entrée est un périphérique, une FIFO ou un socket, utilisez ACTION pour le traiter. Par défaut, ACTION est *read*, ce qui signifie que les périphériques sont lus comme s'il s'agissait de fichiers ordinaires. Si ACTION est *skip*, les périphériques sont ignorés en silence. |
|
||||||
|
| **-d** action, **--directories**=action<br />Spécifiez l'action demandée pour les répertoires. Il est *"read"* par défaut, ce qui signifie que les répertoires sont lus de la même manière que les fichiers normaux. Les autres valeurs possibles sont *'skip'* pour ignorer silencieusement les répertoires, et *'récurse'* pour les lire récursivement, ce qui a le même effet que l'option **-R** et **-r**. | **-d** ACTION, **--directories**=ACTION<br/>Si un fichier d'entrée est un répertoire, utilisez ACTION pour le traiter. Par défaut, ACTION est *read*, c'est-à-dire lire les répertoires comme s'il s'agissait de fichiers ordinaires. Si ACTION est *skip*, ignorez silencieusement les répertoires. Si ACTION est *récurse*, lisez tous les fichiers sous chaque répertoire, récursivement, en suivant des liens symboliques uniquement s'ils se trouvent sur la ligne de commande. C'est l'équivalent de l'option **-r**. |
|
||||||
|
| **-E**, **--extended-regexp**<br />Interpréter le motif comme une expression régulière étendue | **-E**, **--extended-regexp**<br/>Interpréter les MODÈLES en tant qu'expressions régulières étendues (ERE, voir ci- dessous). |
|
||||||
|
| **-e** pattern, **--regexp**=pattern<br />Spécifiez un motif utilisé lors de la recherche de l'entrée : une ligne d'entrée est sélectionnée si elle correspond à l'un des motifs spécifiés. Cette option est plus utile lorsque plusieurs options **-e** sont utilisées pour spécifier plusieurs motifs, ou lorsqu'un motif commence par un tiret (-'). | **-e** PATTERNS, **--regexp**=PATTERNS<br/>Utilisez des PATTERNS comme motifs. Si cette option est utilisée plusieurs fois ou est combinée avec l'option **-f** (**--file**), recherchez tous les modèles donnés. Cette option peut être utilisée pour protéger un motif commençant par "-". |
|
||||||
|
| **--exclude**<br />Si spécifié, il exclut les fichiers correspondant au modèle de nom de fichier donné de la recherche. Notez que les modèles **--exclude** ont priorité sur les modèles **--include**, et si aucun motif **--include n'est** spécifié, tous les fichiers qui ne sont pas exclus sont recherchés. Les motifs correspondent au chemin d'accès complet spécifié, pas seulement au composant nom de fichier. | **--exclude**=GLOB<br/>Ignorez tout fichier en ligne de commande avec un suffixe de nom qui correspond au motif GLOB, en utilisant la correspondance de caractères génériques ; un suffixe de nom est soit le nom entier, soit une partie arrière qui commence par un caractère non-slash immédiatement après une barre oblique (/) dans le nom. Lors de la recherche récursive, sautez tout sous-fichier dont le nom de base correspond à GLOB ; le nom de base est la partie après la dernière barre oblique. Un motif peut utiliser *, ? et [...] comme caractères génériques, et \ pour citer littéralement un caractère générique ou antislash. |
|
||||||
|
| | **--exclude-from**=FILE<br/>Skip files whose base name matches any of the file-name globs read from FILE (using wildcard matching as described under --exclude).<br />Ignorer les fichiers dont le nom de base correspond à l'un des globes de nom de fichier lus à partir de FILE (en utilisant la correspondance de caractères génériques comme décrit sous --exclude). |
|
||||||
|
| **--exclude-dir**<br />Si -R est spécifié, il exclut les répertoires correspondants au modèle de nom de fichier donné de la recherche. Notez que les modèles **--exclude- dir** ont priorité sur les modèles **--include-dir**, et si aucun modèle **--include-dir n'est** spécifié, tous les répertoires qui ne sont pas exclus sont recherchés. | **--exclude-dir**=GLOB<br/>Ignorez tout répertoire en ligne de commande avec un suffixe de nom qui correspond au motif GLOB. Lors de la recherche récursive, sautez tout sous-répertoire dont le nom de base correspond à GLOB. Ignorez toute barre oblique redondante dans GLOB. |
|
||||||
|
| **-F**, **--fixed-strings**<br />Interpréter le motif comme un ensemble de chaînes fixes | **I-F**, **--fixed-strings**<br/>Interprétez les PATTERNS comme des chaînes fixes, pas comme des expressions régulières. |
|
||||||
|
| **-f** file, **--file**=file<br />Lisez un ou plusieurs modèles séparés de saut de ligne du fichier. Les lignes de motif vides correspondent à chaque ligne d'entrée. Les sauts de ligne ne sont pas considérés comme faisant partie d'un modèle. Si le fichier est vide, rien n'est trouvé. | **-f** FILE, **--file**=FILE<br/>Obtenez des modèles à partir de FILE, un par ligne. Si cette option est utilisée plusieurs fois ou est combinée avec l'option **-e** (**--regexp**), recherchez tous les modèles donnés. Le fichier vide ne contient aucun motif et ne correspond donc à rien. |
|
||||||
|
| **-G**, **--basic-regexp**<br />Interpréter le motif comme une expression régulière de base. | **-G**, **--basic-regexp**<br/>Interpréter les MODÈLES comme des expressions régulières de base (BRE, voir ci- dessous). C'est la valeur par défaut. |
|
||||||
|
| **-H**<br />Affchez toujours les en-têtes de nom de fichier avec des lignes de sortie. | **-H**, **--with-filename**<br/>Affchez le nom du fichier pour chaque correspondance. C'est la valeur par défaut lorsqu'il y a plus d'un fichier à rechercher. |
|
||||||
|
| **-h**, **--no-filename**<br/>N'affichez jamais d'en-têtes de nom de fichier (c'est-à-dire des noms de fichier) avec des lignes de sortie. | **-h**, **--no-filename**<br/>Supprimez le préfixe des noms de fichiers sur la sortie. C'est la valeur par défaut lorsqu'il n'y a qu'un seul fichier (ou une seule entrée standard) à rechercher. |
|
||||||
|
| **--help**<br />Imprimez un bref message d'aide. | **--help**<br />Affchez un message d'utilisation et quittez. |
|
||||||
|
| **-I**<br />Ignorez les fichiers binaires. Cette option est équivalente à l'option **--binary-file=without-match**. | **-I**<br />Traiter un fichier binaire comme s'il ne contenait pas de données correspondantes ; c'est équivalent à l'option **--binary-files=without-match**. |
|
||||||
|
| **--include**<br />Si spécifié, seuls les fichiers correspondant au modèle de nom de fichier donné sont recherchés. Notez que les modèles **--exclude** ont priorité sur **-- include** patterns. Les motifs correspondent au chemin d'accès complet spécifié, pas seulement au composant nom de fichier. | **--include**=GLOB<br/>Recherchez uniquement les fichiers dont le nom de base correspond à GLOB (en utilisant la correspondance de caractères génériques comme décrit sous **-- exclude**).<br/> Si des options contradictoires **--include** et **--exclude** sont données, la dernière correspondante gagne.<br/> Si aucune option **--include** ou **--exclude ne** correspond, un fichier est inclus à moins que la première de ces options ne soit **--include**. |
|
||||||
|
| **--include-dir**<br/>Si -R est spécifié, seuls les répertoires correspondant au modèle de nom de fichier donné sont recherchés. Notez que les modèles **--exclude- dir** ont priorité sur les modèles **--include-dir**. | |
|
||||||
|
| **-J**, **--bz2decompress**<br/>Décompressez le fichier compressé bzip2(1) avant de rechercher le texte. | |
|
||||||
|
| **-L**, **--files-without-match**<br/>Seuls les noms des fichiers ne contenant pas de lignes sélectionnées sont écrits sur la sortie standard. Les chemins d'accès sont répertoriés une fois par fichier recherché. Si l'entrée standard est recherchée, la chaîne "(entrée standard)'' est écrite. | **-L**, **--files-without-match**<br/>Supprimez la sortie normale ; imprimez plutôt le nom de chaque fichier d'entrée à partir duquel aucune sortie n'aurait normalement été imprimée. Le balayage s'arrêtera lors de la première correspondance. |
|
||||||
|
| **-l**, **--files-with-matches**<br/>Seuls les noms des fichiers contenant des lignes sélectionnées sont écrits en sortie standard. grep ne recherchera un fichier que jusqu'à ce qu'une correspondance ait été trouvée, ce qui rend les recherches potentiellement moins coûteuses. Les chemins d'accès sont répertoriés une fois par fichier recherché. Si l'entrée standard est recherchée, la chaîne "(entrée standard)'' est écrite. | **-l**, **--files-with-matches**<br/>Supprimez la sortie normale ; imprimez plutôt le nom de chaque fichier d'entrée à partir duquel la sortie aurait normalement été imprimée. Le balayage s'arrêtera lors de la première correspondance. |
|
||||||
|
| **--mmap**<br />Utilisez mmap(2) au lieu de read(2) pour lire l'entrée, ce qui peut entraîner de meilleures performances dans certaines circonstances, mais peut entraîner un comportement indéfini. | |
|
||||||
|
| **-m** num, **--max-count**=num<br/>Arrêtez de lire le fichier après *num* correspondances. | **-m** NUM, **--max-count**=NUM<br/>Arrêtez de lire un fichier après NUM lignes correspondantes . Si l'entrée est une entrée standard d'un fichier régulier et que NUM lignes de correspondance sont sorties, grep s'assure que l'entrée standard est positionnée juste après la dernière ligne correspondante avant de quitter, indépendamment de la présence de lignes de contexte. Cela permet à un processus d'appel de reprendre une recherche. <br />Lorsque grep s'arrête après NUM lignes de correspondance, il affiche toutes les lignes de contexte.<br/> Lorsque l'option **-c** ou **--count** est également utilisée, grep n'affiche pas un compte supérieur à NUM.<br/> Lorsque l'option **-v** ou **--invert-match** est également utilisée, grep s'arrête après avoir affiché NUM lignes non correspondantes. |
|
||||||
|
| **-n**, **--line-number**<br/>Chaque ligne de sortie est précédée de son numéro de ligne relatif dans le fichier, à partir de la ligne 1. Le compteur de numéros de ligne est réinitialisé pour chaque fichier traité. Cette option est ignorée si **-c**, **-L**, **-l** ou **-q** est spécifié. | **-n**, **--line-number**<br/>Préfixez chaque ligne de sortie avec le numéro de ligne basé sur 1 dans son fichier d'entrée. |
|
||||||
|
| **--null**<br />Affiche un octet zéro après le nom du fichier. | **-Z**, **--null**<br/>Affiche un octet zéro (le caractère ASCII NUL) au lieu du caractère qui suit normalement un nom de fichier. Par exemple, grep -lZ affiche un octet zéro après chaque nom de fichier au lieu du saut de ligne habituel. Cette option rend la sortie sans ambiguïté, même en présence de noms de fichiers contenant des caractères inhabituels comme les sauts de ligne. Cette option peut être utilisée avec des commandes comme find -print0, perl -0, sort -z et xargs -0 pour traiter les noms de fichiers arbitraires, même ceux qui contiennent des caractères de saut de ligne. |
|
||||||
|
| **-O**<br />Si **-R** est spécifié, suivez les liens symboliques uniquement s'ils ont été explicitement répertoriés sur la ligne de commande. La valeur par défaut est de ne pas suivre les liens symboliques. | |
|
||||||
|
| **-o**, **--only-matching**<br />Imprime uniquement la partie correspondante des lignes. | **-o**, **--only-matching**<br />Imprimez uniquement les parties correspondantes (non vides) d'une ligne correspondante, chacune de ces parties sur une ligne de sortie distincte. |
|
||||||
|
| **-p**<br />Si **-R** est spécifié, aucun lien symbolique n'est suivi. C'est la valeur par défaut. | |
|
||||||
|
| **-q**, **--quiet**, **--silent**<br/>Mode silencieux : supprimez la sortie normale. grep ne recherchera un fichier que jusqu'à ce qu'une correspondance ait été trouvée, ce qui rend les recherches potentiellement moins coûteuses. | **-q**, **--quiet**, **--silent**<br/>Silence ; n'écrivez rien sur la sortie standard. Quittez immédiatement avec un statut zéro si une correspondance est trouvée, même si une erreur a été détectée. Voir également l'option **-s** ou **--no-messages**. |
|
||||||
|
| **-R**, **-r**, **--recursive**<br/>Recherchez récursivement les sous-répertoires répertoriés. | **-r**, **--recursive**<br/>Read all files under each directory, recursively, following symbolic links only if they are on the command line. Note that if no file operand is given, grep searches the working directory. This is equivalent to the **-d** recurse option.<br />Lisez tous les fichiers sous chaque répertoire, récursivement, en suivant des liens symboliques uniquement s'ils sont sur la ligne de commande. Notez que si aucun opérande de fichier n'est donné, grep recherche dans le répertoire de travail. C'est l'équivalent de l'option récurse **-d** . |
|
||||||
|
| | **-R**, **--dereference-recursive**<br/>Lisez tous les fichiers sous chaque répertoire, récursivement. Suivez tous les liens symboliques, contrairement à **-r**. |
|
||||||
|
| **-S**<br />Si **-R** est spécifié, tous les liens symboliques sont suivis. La valeur par défaut est de ne pas suivre les liens symboliques. | |
|
||||||
|
| **-s**, **--no-messages**<br/>Mode silencieux. Les fichiers inexistants et illisibles sont ignorés (c'est-à-dire que leurs messages d'erreur sont supprimés). | **-s**, **--no-messages**<br/>Supprimez les messages d'erreur concernant les fichiers inexistants ou illisibles. |
|
||||||
|
| **-U**, **--binary**<br/>Recherchez des fichiers binaires, mais n'essayez pas de les imprimer. | **-U**, **--binary**<br/>Traitez le(s) fichier(s) comme binaire(s). Par défaut, sous MS-DOS et MS-Windows, grep devine si un fichier est texte ou binaire comme décrit pour l'option **--binary-files**. Si grep décide que le fichier est un fichier texte, il supprime les caractères CR du contenu du fichier d'origine (pour que les expressions régulières avec ^ et $ fonctionnent correctement).<br/> Spécifier **-U** annule cette conjecture, ce qui fait que tous les fichiers sont lus et transmis mot pour mot au mécanisme de correspondance ; si le fichier est un fichier texte avec des paires CR/LF à la fin de chaque ligne, cela entraînera l'échec de certaines expressions régulières. Cette option n'a aucun effet sur les plates- formes autres que MS-DOS et MS-Windows. |
|
||||||
|
| **-V**, **--version**<br/>Afficher les informations de version et quitter. | **-V**, **--version**<br/> Affiche le numéro de version de grep et quitte. |
|
||||||
|
| **-v**, **--invert-match**<br/>Les lignes sélectionnées sont celles qui ne correspondent à aucun des motifs spécifiés. | **-v**, **--invert-match**<br/>Inverser le sens de correspondance, pour sélectionner des lignes non correspondantes. |
|
||||||
|
| **-w**, **--word-regexp**<br/>The expression is searched for as a word (as if surrounded by `[[:<:]]` and `[[:>:]]`; voir re_format(7)). | **-w**, **--word-regexp**<br/>Sélectionnez uniquement les lignes contenant des correspondances qui forment des mots entiers. Le test est que la sous-chaîne correspondante doit être soit au début de la ligne, soit précédée d'un caractère constitutif non-mot. De même, il doit être soit à la fin de la ligne, soit suivi d'un caractère constitutif non-mot. Les caractères constitutifs du mot sont les lettres, les chiffres et le soulignement. Cette option n'a aucun effet si **-x** est également spécifié. |
|
||||||
|
| **-x**, **--line-regexp**<br/>Seules les lignes d'entrée sélectionnées par rapport à une chaîne fixe entière ou à une expression régulière sont considérées comme des lignes correspondantes. | **-x**, **--line-regexp**<br/>Sélectionnez uniquement les correspondances qui correspondent exactement à l'ensemble de la ligne. Pour un motif d'expression régulière, c'est comme mettre entre parenthèses le motif puis l'entourer de ^ et $.<br /> |
|
||||||
|
| **-y**<br />Équivalent à **-i**. Obsolète. | **-y**<br />Synonyme obsolète de **-i.** |
|
||||||
|
| **-Z**, **-z**, **--decompress**<br/>Forcer grep à se comporter comme zgrep. | |
|
||||||
|
| | **-z**, **--null-data**<br/>Traitez les données d'entrée et de sortie comme des séquences de lignes, chacune terminée par un octet zéro (le caractère ASCII NUL) au lieu d'un saut de ligne. Comme l'option **-Z** ou -**-null**, cette option peut être utilisée avec des commandes comme sort **-z** pour traiter des noms de fichiers arbitraires. |
|
||||||
|
| **--binary-files**=value<br/>Contrôle la recherche et l'impression de fichiers binaires. Les options sont *binary*, la valeur par défaut : rechercher des fichiers binaires mais ne par les imprimer ; *without-match* : ne recherchez pas de fichiers binaires ; et *text* : traitez tous les fichiers comme du texte. | **--binary-files**=TYPE<br/>If a file's data or metadata indicate that the file contains binary data, assume that the file is of type TYPE. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale, or null input bytes when the **-z** option is not given.<br/><br/>By default, TYPE is *binary*, and grep suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, grep follows any output with a one-line message saying that a binary file matches.<br/><br/>If TYPE is *without-match*, when grep discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the -I option.<br/><br/>If TYPE is *text*, grep processes a binary file as if it were text; this is equivalent to the **-a** option.<br/><br/>When type is *binary*, grep may treat non-text bytes as line terminators even without the **-z** option. This means choosing binary versus text can affect whether a pattern matches a file. For example, when type is *binary* the pattern q$ might match q immediately followed by a null byte, even though this is not matched when type is *text*. Conversely, when type is *binary* the pattern . (period) might not match a null byte.<br/><br/><u>Warning:</u> The **-a** option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use **-a** or to set **LC_ALL='C'** in the environment, in order to find more matches even if the matches are unsafe for direct display. |
|
||||||
|
| **--binary-files**=value<br/>Contrôle la recherche et l'impression de fichiers binaires. Les options sont *binary*, la valeur par défaut : rechercher des fichiers binaires mais ne par les imprimer ; *without-match* : ne recherchez pas de fichiers binaires ; et *text* : traitez tous les fichiers comme du texte. | Si les données ou métadonnées d'un fichier indiquent que le fichier contient des données binaires, considère que le fichier est de type TYPE. Les octets non textuels indiquent des données binaires ; il s'agit soit d'octets de sortie mal encodés pour la locale actuelle, soit d'octets d'entrée NULL lorsque l'option **-z** n'est pas donnée.<br /><br />Par défaut, TYPE est *binar*y, et grep supprime la sortie après la découverte de données binaires d'entrée nulles, et supprime les lignes de sortie qui contiennent des données mal encodées. Lorsqu'une sortie est supprimée, grep suit n'importe quelle sortie avec un message d'une ligne indiquant qu'un fichier binaire correspond.<br />Si TYPE est *without-match*, lorsque grep découvre des données binaires d'entrée nulles, il suppose que le reste du fichier ne correspond pas ; c'est équivalent à l'option **-I**.<br />Si TYPE est *text*, grep traite un fichier binaire comme s'il s'agissait de texte ; c'est l'équivalent de l'option **-a**.<br />Lorsque type est *binary*, grep peut traiter les octets non textuels comme des terminaisons de ligne, même sans l'option **-z**. Cela signifie que le choix du binaire par rapport au texte peut influer sur la correspondance d'un modèle avec un fichier. Par exemple, lorsque type est *binary*, le motif q$ peut correspondre à q immédiatement suivi d'un octet nul, même si cela n'est pas égalé lorsque type is *text*. Inversement, lorsque type est *binary*, le motif . (point) peut ne pas correspondre à un octet nul.<br /><u>Avertissement :</u> L'option **-a** peut a-cher des ordures binaires, qui peuvent avoir des effets secondaires désagréables si la sortie est un terminal et si le pilote de terminal en interprète une partie comme des commandes. D'autre part, lors de la lecture de fichiers dont les encodages de texte sont inconnus, il peut être utile d'utiliser **-a** ou de définir **LC_ALL='C'** dans l'environnement, afin de trouver plus de correspondances même si les correspondances ne sont pas sûres pour l'affichage direct. |
|
||||||
|
| **--context**[=num]<br/>Imprimez les lignes numériques du contexte de début et de fin. La valeur par défaut est 2. | |
|
||||||
|
| **--line-buffered**<br/>Force la sortie à mettre en mémoire tampon par ligne. Par défaut, la sortie est mise en mémoire tampon en ligne lorsque la sortie standard est un terminal et le bloc est mis en mémoire tampon dans le cas contraire. | **--line-buffered**<br/>Utilisez la mise en mémoire tampon de ligne sur la sortie. Cela peut entraîner une pénalité de performance. |
|
||||||
|
| | **-i**, **--ignore-case**<br/>Ignorez les distinctions de casse dans les modèles et les données d'entrée, de sorte que les caractères qui ne diffèrent que dans la casse correspondent les uns aux autres. |
|
||||||
|
| | **--no-ignore-case**<br/>N'ignorez pas les distinctions de cas dans les modèles et les données d'entrée. C'est la valeur par défaut. Cette option est utile pour passer aux scripts shell qui utilisent déjà **-i**, pour annuler ses effets car les deux options se remplacent. |
|
||||||
|
| | **--label=LABEL**<br />Afficher l'entrée provenant réellement de l'entrée standard comme l'entrée provenant du fichier LABEL. Cela peut être utile pour les commandes qui transforment le contenu d'un fichier avant la recherche, par exemple, gzip -cd foo.gz \|grep --label=foo -H 'some pattern'. Voir aussi le **-H** |
|
||||||
|
| | **--perl-regexp**<br/>Interpréter les MODÈLES en tant qu'expressions régulières compatibles Perl (PCRE). Cette option est expérimentale lorsqu'elle est combinée avec l'option **-z** (**-- null-data**), et grep **-P** peut avertir des fonctionnalités non implémentées. |
|
||||||
|
| | **-T**, **--initial-tab**<br/>Assurez-vous que le premier caractère du contenu réel de la ligne se trouve sur un arrêt d'onglet, de sorte que l'alignement des onglets semble normal.<br/> C'est utile avec les options qui préfixent leur sortie au contenu réel : **-H**,**-n** et **-b**. Afin d'améliorer la probabilité que les lignes d'un seul fichier commencent toutes à la même colonne, cela entraîne également l'impression du numéro de ligne et du décalage d'octet (le cas échéant) dans une largeur de champ de taille minimale. |
|
||||||
|
| | **-u**, **--unix-byte-offsets**<br/>Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were a Unix-style text file, i.e., with CR characters stripped off. This will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS and MS-Windows.<br />Signaler les décalages d'octets de style Unix. Ce commutateur fait que grep signale les décalages d'octets comme si le fichier était un fichier texte de style Unix, c'est-à-dire avec des caractères CR supprimés. Cela produira des résultats identiques à ceux de l'exécution de grep sur une machine Unix. Cette option n'a aucun effet à moins que l'option **-b** ne soit également utilisée ; elle n'a aucun effet sur les plates-formes autres que MS-DOS et MS-Windows. |
|
||||||
|
|
||||||
62
docs/Linux/grep-options.md
Normal file
62
docs/Linux/grep-options.md
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# grep --options
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| **grep (BSD)** | **grep (GNU)** |
|
||||||
|
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
|
| **-A** num, -**-after-context**=num<br />Print num lines of trailing context after each match. See also the **-B** and **-C** options. | **-A** NUM, **--after-context**=NUM<br/>Print NUM lines of trailing context after matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||||
|
| **-a**, **--text**<br />Treat all files as ASCII text. | **-a**, **--text**<br/>Process a binary file as if it were text; this is equivalent to the **--binary-files**=text option. |
|
||||||
|
| **-B** num, **--before-context**=num<br />Print num lines of leading context before each match. See also the **-A** and **-C** options. | **-B** NUM, **--before-context**=NUM<br/>Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||||
|
| **-b**, **--byte-offset**<br />The offset in bytes of a matched pattern is displayed in front of the respective matched line. | **-b**, **--byte-offset**<br/>Print the 0-based byte offset within the input file before each line of output. If **-o** (**--only-matching**) is specified, print the offset of the matching part itself. |
|
||||||
|
| **-C**[num, **--context**=num]<br />Print num lines of leading and trailing context surrounding each match. The default is 2 and is equivalent to **-A** 2 **-B** 2. | **-C** NUM, -NUM, **--context**=NUM<br/>Print NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches.<br/>With the **-o** or **--only-matching** option, this has no effect and a warning is given. |
|
||||||
|
| **-c**, **--count**<br />Only a count of selected lines is written to standard output. | **-c**, **--count**<br/>Suppress normal output; instead print a count of matching lines for each input file. With the **-v**, **--invert-match** option (see below), count non-matching lines. |
|
||||||
|
| **--colour**=[when, **--color**=[when]]<br />Mark up the matching text with the expression stored in GREP_COLOR environment variable. The possible values of when can be *'never'*, *'always'* or *'auto'*. | **--color**[=WHEN], **--colour**[=WHEN]<br/>Surround the matched (non-empty) strings, matching lines, context lines, file names, line numbers, byte offsets, and separators (for fields and groups of context lines) with escape sequences to display them in color on the terminal. The colors are defined by the environment variable GREP_COLORS. The deprecated environment variable GREP_COLOR is still supported, but its setting does not have priority. WHEN is *never*, *always*, or *auto*. |
|
||||||
|
| **-D** action, **--devices**=action<br />Specify the demanded action for devices, FIFOs and sockets. The default action is *'read',* which means, that they are read as if they were normal files. If the action is set to *'skip'*, devices will be silently skipped. | **-D** ACTION, **--devices**=ACTION<br/>If an input file is a device, FIFO or socket, use ACTION to process it. By default, ACTION is *read*, which means that devices are read just as if they were ordinary files. If ACTION is *skip*, devices are silently skipped. |
|
||||||
|
| **-d** action, **--directories**=action<br />Specify the demanded action for directories. It is *'read'* by default, which means that the directories are read in the same manner as normal files. Other possible values are *'skip'* to silently ignore the directories, and *'recurse'* to read them recursively, which has the same effect as the **-R** and **-r** option. | **-d** ACTION, **--directories**=ACTION<br/>If an input file is a directory, use ACTION to process it. By default, ACTION is *read*, i.e., read directories just as if they were ordinary files. If ACTION is *skip*, silently skip directories. If ACTION is *recurse*, read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the **-r** option. |
|
||||||
|
| **-E**, **--extended-regexp**<br />Interpret pattern as an extended regular expression | **-E**, **--extended-regexp**<br/>Interpret PATTERNS as extended regular expressions (EREs, see below). |
|
||||||
|
| **-e** pattern, **--regexp**=pattern<br />Specify a pattern used during the search of the input: an input line is selected if it matches any of the specified patterns. This option is most useful when multiple **-e** options are used to specify multiple patterns, or when a pattern begins with a dash (`-'). | **-e** PATTERNS, **--regexp**=PATTERNS<br/>Use PATTERNS as the patterns. If this option is used multiple times or is combined with the **-f** (**--file**) option, search for all patterns given. This option can be used to protect a pattern beginning with "-". |
|
||||||
|
| **--exclude**<br />If specified, it excludes files matching the given filename pattern from the search. Note that **--exclude** patterns take priority over **--include** patterns, and if no **--include** pattern is specified, all files are searched that are not excluded. Patterns are matched to the full path specified, not only to the filename component. | **--exclude**=GLOB<br/>Skip any command-line file with a name suffix that matches the pattern GLOB, using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash (/) in the name. When searching recursively, skip any subfile whose base name matches GLOB; the base name is the part after the last slash. A pattern can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. |
|
||||||
|
| | **--exclude-from**=FILE<br/>Skip files whose base name matches any of the file-name globs read from FILE (using wildcard matching as described under --exclude). |
|
||||||
|
| **--exclude-dir**<br />If -R is specified, it excludes directories matching the given filename pattern from the search. Note that **--exclude-dir** patterns take priority over **--include-dir** patterns, and if no **--include-dir** pattern is specified, all directories are searched that are not excluded. | **--exclude-dir**=GLOB<br/>Skip any command-line directory with a name suffix that matches the pattern GLOB. When searching recursively, skip any subdirectory whose base name matches GLOB. Ignore any redundant trailing slashes in GLOB. |
|
||||||
|
| **-F**, **--fixed-strings**<br />Interpret pattern as a set of fixed strings | **-F**, **--fixed-strings**<br/>Interpret PATTERNS as fixed strings, not regular expressions. |
|
||||||
|
| **-f** file, **--file**=file<br />Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If file is empty, nothing is matched. | **-f** FILE, **--file**=FILE<br/>Obtain patterns from FILE, one per line. If this option is used multiple times or is combined with the **-e** (**--regexp**) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. |
|
||||||
|
| **-G**, **--basic-regexp**<br /> Interpret pattern as a basic regular expression. | **-G**, **--basic-regexp**<br/>Interpret PATTERNS as basic regular expressions (BREs, see below). This is the default. |
|
||||||
|
| **-H**<br />Always print filename headers with output lines. | **-H**, **--with-filename**<br/>Print the file name for each match. This is the default when there is more than one file to search. |
|
||||||
|
| **-h**, **--no-filename**<br/>Never print filename headers (i.e. filenames) with output lines. | **-h**, **--no-filename**<br/>Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. |
|
||||||
|
| **--help**<br />Print a brief help message. | **--help**<br />Output a usage message and exit. |
|
||||||
|
| **-I**<br />Ignore binary files. This option is equivalent to **--binary-file=without-match option**. | **-I**<br />Process a binary file as if it did not contain matching data; this is equivalent to the **--binary-files=without-match option**. |
|
||||||
|
| **--include**<br />If specified, only files matching the given filename pattern are searched. Note that **--exclude** patterns take priority over **--include** patterns. Patterns are matched to the full path specified, not only to the filename component. | **--include**=GLOB<br/> Search only files whose base name matches GLOB (using wildcard matching as described under **--exclude**). <br />If contradictory **--include** and **--exclude** options are given, the last matching one wins. <br />If no **--include** or **--exclude** options match, a file is included unless the first such option is **--include**. |
|
||||||
|
| **--include-dir**<br/>If -R is specified, only directories matching the given filename pattern are searched. Note that **--exclude-dir** patterns take priority over **--include-dir** patterns. | |
|
||||||
|
| **-J**, **--bz2decompress**<br/>Decompress the bzip2(1) compressed file before looking for the text. | |
|
||||||
|
| **-L**, **--files-without-match**<br/>Only the names of files not containing selected lines are written to standard output. Pathnames are listed once per file searched. If the standard input is searched, the string "(standard input)'' is written. | -L, --files-without-match<br/>Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match. |
|
||||||
|
| **-l**, **--files-with-matches**<br/>Only the names of files containing selected lines are written to standard output. grep will only search a file until a match has been found, making searches potentially less expensive. Pathnames are listed once per file searched. If the standard input is searched, the string "(standard input)'' is written. | -l, --files-with-matches<br/>Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. |
|
||||||
|
| **--mmap**<br />Use mmap(2) instead of read(2) to read input, which can result in better performance under some circumstances but can cause undefined behaviour. | |
|
||||||
|
| **-m** num, **--max-count**=num<br/>Stop reading the file after num matches. | **-m** NUM, **--max-count**=NUM<br/>Stop reading a file after NUM matching lines. If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the standard input is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. <br />When grep stops after NUM matching lines, it outputs any trailing context lines. <br />When the **-c** or **--count** option is also used, grep does not output a count greater than NUM. <br />When the **-v** or **--invert-match** option is also used, grep stops after outputting NUM non-matching lines. |
|
||||||
|
| **-n**, **--line-number**<br/>Each output line is preceded by its relative line number in the file, starting at line 1. The line number counter is reset for each file processed. This option is ignored if **-c**, **-L**, **-l**, or **-q** is specified. | **-n**, **--line-number**<br/>Prefix each line of output with the 1-based line number within its input file. |
|
||||||
|
| **--null**<br />Prints a zero-byte after the file name. | **-Z**, **--null**<br/>Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, grep -lZ outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like find -print0, perl -0, sort -z, and xargs -0 to process arbitrary file names, even those that contain newline characters. |
|
||||||
|
| **-O**<br />If -R is specified, follow symbolic links only if they were explicitly listed on the command line. The default is not to follow symbolic links. | |
|
||||||
|
| **-o**, **--only-matching**<br />Prints only the matching part of the lines. | **-o**, **--only-matching**<br />Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. |
|
||||||
|
| **-p**<br />If **-R** is specified, no symbolic links are followed. This is the default. | |
|
||||||
|
| **-q**, **--quiet**, **--silent**<br/>Quiet mode: suppress normal output. grep will only search a file until a match has been found, making searches potentially less expensive. | **-q**, **--quiet**, **--silent**<br/>Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the **-s** or **--no-messages** option. |
|
||||||
|
| **-R**, **-r**, **--recursive**<br/>Recursively search subdirectories listed. | **-r**, **--recursive**<br/>Read all files under each directory, recursively, following symbolic links only if they are on the command line. Note that if no file operand is given, grep searches the working directory. This is equivalent to the **-d** recurse option. |
|
||||||
|
| | **-R**, **--dereference-recursive**<br/>Read all files under each directory, recursively. Follow all symbolic links, unlike **-r**. |
|
||||||
|
| **-S**<br />If **-R** is specified, all symbolic links are followed. The default is not to follow symbolic links. | |
|
||||||
|
| **-s**, **--no-messages**<br/>Silent mode. Nonexistent and unreadable files are ignored (i.e. their error messages are suppressed). | **-s**, **--no-messages**<br/>Suppress error messages about nonexistent or unreadable files. |
|
||||||
|
| **-U**, **--binary**<br/>Search binary files, but do not attempt to print them. | **-U**, **--binary**<br/>Treat the file(s) as binary. By default, under MS-DOS and MS-Windows, grep guesses whether a file is text or binary as described for the **--binary-files** option. If grep decides the file is a text file, it strips the CR characters from the original file contents (to make regular expressions with ^ and $ work correctly). <br />Specifying **-U** overrules this guesswork, causing all files to be read and passed to the matching mechanism verbatim; if the file is a text file with CR/LF pairs at the end of each line, this will cause some regular expressions to fail. This option has no effect on platforms other than MS-DOS and MS-Windows. |
|
||||||
|
| **-V**, **--version**<br/>Display version information and exit. | **-V**, **--version**<br/> Output the version number of grep and exit. |
|
||||||
|
| **-v**, **--invert-match**<br/>Selected lines are those not matching any of the specified patterns. | **-v**, **--invert-match**<br/>Invert the sense of matching, to select non-matching lines. |
|
||||||
|
| **-w**, **--word-regexp**<br/>The expression is searched for as a word (as if surrounded by `[[:<:]]` and `[[:>:]]`; see re_format(7)). | **-w**, **--word-regexp**<br/>Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.This option has no effect if -x is also specified. |
|
||||||
|
| **-x**, **--line-regexp**<br/>Only input lines selected against an entire fixed string or regular expression are considered to be matching lines. | **-x**, **--line-regexp**<br/>Select only those matches that exactly match the whole line. For a regular expression pattern, this is like parenthesizing the pattern and then surrounding it with ^ and $. |
|
||||||
|
| **-y**<br />Equivalent to **-i**. Obsoleted. | **-y**<br />Obsolete synonym for **-i.** |
|
||||||
|
| **-Z**, **-z**, **--decompress**<br/>Force grep to behave as zgrep. | |
|
||||||
|
| | **-z**, **--null-data**<br/>Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL character) instead of a newline. Like the **-Z** or --null option, this option can be used with commands like sort **-z** to process arbitrary file names. |
|
||||||
|
| **--binary-files**=value<br/>Controls searching and printing of binary files. Options are *binary*, the default: search binary files but do not print them; *without-match*: do not search binary files; and *text*: treat all files as text. | **--binary-files**=TYPE<br/>If a file's data or metadata indicate that the file contains binary data, assume that the file is of type TYPE. Non-text bytes indicate binary data; these are either output bytes that are improperly encoded for the current locale, or null input bytes when the **-z** option is not given.<br/><br/>By default, TYPE is *binary*, and grep suppresses output after null input binary data is discovered, and suppresses output lines that contain improperly encoded data. When some output is suppressed, grep follows any output with a one-line message saying that a binary file matches.<br/><br/>If TYPE is *without-match*, when grep discovers null input binary data it assumes that the rest of the file does not match; this is equivalent to the -I option.<br/><br/>If TYPE is *text*, grep processes a binary file as if it were text; this is equivalent to the **-a** option.<br/><br/>When type is *binary*, grep may treat non-text bytes as line terminators even without the **-z** option. This means choosing binary versus text can affect whether a pattern matches a file. For example, when type is *binary* the pattern q$ might match q immediately followed by a null byte, even though this is not matched when type is *text*. Conversely, when type is *binary* the pattern . (period) might not match a null byte.<br/><br/><u>Warning:</u> The **-a** option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. On the other hand, when reading files whose text encodings are unknown, it can be helpful to use **-a** or to set **LC_ALL='C'** in the environment, in order to find more matches even if the matches are unsafe for direct display. |
|
||||||
|
| **--context**[=num]<br/>Print num lines of leading and trailing context. The default is 2. | |
|
||||||
|
| **--line-buffered**<br/>Force output to be line buffered. By default, output is line buffered when standard output is a terminal and block buffered otherwise. | **--line-buffered**<br/>Use line buffering on output. This can cause a performance penalty. |
|
||||||
|
| | **-i**, **--ignore-case**<br/>Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. |
|
||||||
|
| | **--no-ignore-case**<br/>Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use **-i**, to cancel its effects because the two options override each other. |
|
||||||
|
| | **--label=LABEL**<br />Display input actually coming from standard input as input coming from file LABEL. This can be useful for commands that transform a file's contents before searching, e.g., gzip -cd foo.gz \|grep --label=foo -H 'some pattern'. See also the **-H** |
|
||||||
|
| | **--perl-regexp**<br/>Interpret PATTERNS as Perl-compatible regular expressions (PCREs). This option is experimental when combined with the **-z** (**--null-data**) option, and grep **-P** may warn of unimplemented features. |
|
||||||
|
| | **-T**, **--initial-tab**<br/>Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs looks normal.<br/>This is useful with options that prefix their output to the actual content: **-H**,**-n**, and **-b**. In order to improve the probability that lines from a single file will all start at the same column, this also causes the line number and byte offset (if present) to be printed in a minimum size field width. |
|
||||||
|
| | **-u**, **--unix-byte-offsets**<br/>Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were a Unix-style text file, i.e., with CR characters stripped off. This will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS and MS-Windows. |
|
||||||
|
|
||||||
@@ -1,10 +1,25 @@
|
|||||||
# interpègrep
|
# grep
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
La commande **grep** permet de rechercher une chaîne de caractères dans un fichier.
|
La commande **grep** permet de rechercher une chaîne de caractères dans un fichier.
|
||||||
|
|
||||||
Options:
|
macOS intègre la version BSD de grep
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ grep -V
|
||||||
|
grep (BSD grep) 2.5.1-FreeBSD
|
||||||
|
```
|
||||||
|
mais peut aussi utiliser la version GNU grâce à Homebrew (rebaptiser ggrep)
|
||||||
|
```bash
|
||||||
|
$ ggrep -V
|
||||||
|
ggrep (GNU grep) 3.6
|
||||||
|
Packaged by Homebrew
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Options ([toutes les options](grep-options-fr.md))([US](grep-options.md)):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
-E, --extended-regexp interprète la PATTERN comme Expression Régulière Etendue
|
-E, --extended-regexp interprète la PATTERN comme Expression Régulière Etendue
|
||||||
@@ -106,12 +121,22 @@ Lignes commençant par les caractères compris entre a et d:
|
|||||||
grep ^[a-d] fichier.txt
|
grep ^[a-d] fichier.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Lignes ne commençant pas # ou ;
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep "^[^#;]" smb.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rechercher plusieurs chaines:
|
Rechercher plusieurs chaines:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
grep -E 'tata|toto' fichier.txt
|
grep -E 'alias|function' ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep -e alias -e function ~/.zshrc
|
||||||
```
|
```
|
||||||
|
|
||||||
ou passer un fichier de motifs à grep:
|
ou passer un fichier de motifs à grep:
|
||||||
@@ -130,3 +155,9 @@ Afficher les 5 lignes qui suivent le motif recherché:
|
|||||||
grep 'toto' -A5 fichier.txt
|
grep 'toto' -A5 fichier.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Afficher les 5 lignes qui précèdent le motif recherché:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
grep 'toto' -B5 fichier.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Linux
|
# Linux
|
||||||
|
|
||||||
[Authentification automatique par SSH sans mot de passe](../macos/ssh/ssh-passwordless.md)
|
[Authentification automatique par SSH sans mot de passe](../macOS/ssh/ssh-passwordless.md)
|
||||||
|
|
||||||
[Archiver / compresser](archiver.md)
|
[Archiver / compresser](archiver.md)
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user