diff --git a/docs/Divers/diraction.md b/docs/Divers/diraction.md new file mode 100644 index 0000000..c9a248f --- /dev/null +++ b/docs/Divers/diraction.md @@ -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 +``` + +ou sauver le répertoire courant: + +```bash +$ diraction save +``` + + + +#### 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 ` + +```bash +$ 74ini ed php.ini + +# ouvre /opt/homebrew/etc/php/7.4/php.ini dans $EDITOR +``` + +`o | open ` + +```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 ` + +```bash +$ canon e "mv 2021.jpg 2021.png" +``` + +`c | cd ` + +```bash +~ +$ canon c 2021 + +~/Pictures/Raw/2021 + +``` + +`/ | /` + +```bash +~ +$ canon / 2021 + +~/Pictures/Raw/2021 + +``` + + + +#### Commandes globales: + +`diraction disable `: désactive l'alias + +`diraction enable `: active l'alias + +`diraction destroy `: 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 + diff --git a/docs/Divers/dotbare.md b/docs/Divers/dotbare.md new file mode 100644 index 0000000..86416ff --- /dev/null +++ b/docs/Divers/dotbare.md @@ -0,0 +1,242 @@ +# 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 + +# -m : uniquement les fichiers modifiés +# -c: affiche les commits +``` + +##### fgrep: + +- Grep words within tracked files and select to edit matches. + +```bash +$ dotbare fgrep + +# -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 + +# -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 + +# -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 + +# -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 + + + +##### fstat + + + +##### funtrack + + + +##### fupgrade + diff --git a/docs/Divers/zsh/zinit.md b/docs/Divers/zsh/zinit.md index 4023ee0..d9c91b5 100644 --- a/docs/Divers/zsh/zinit.md +++ b/docs/Divers/zsh/zinit.md @@ -16,6 +16,14 @@ For more information see: +Installation: + +```bash +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)" +``` + +a + ```bash diff --git a/docs/Linux/Editeurs/nano.md b/docs/Linux/Editeurs/nano.md index 3a1c491..063ace7 100644 --- a/docs/Linux/Editeurs/nano.md +++ b/docs/Linux/Editeurs/nano.md @@ -217,3 +217,4 @@ Ajouter ce fichier au fichier de configuration `.nanorc` include "~/.nanosyntax/yml.nanorc" ``` +https://github.com/scopatz/nanorc diff --git a/docs/Linux/alternatives.md b/docs/Linux/alternatives.md new file mode 100644 index 0000000..2e1c6d6 --- /dev/null +++ b/docs/Linux/alternatives.md @@ -0,0 +1,205 @@ +# alternatives + + + +- [bat](bat.md) +- [exa](exa.md) +- [fd](fd.md) +- [fzf](fzf.md) +- ripgrep +- zoxide + + + + + +### bat + +https://github.com/sharkdp/bat + +### exa + +https://the.exa.website + +### fd + +https://github.com/sharkdp/fd + +### fzf + +https://github.com/junegunn/fzf + +### ripgrep (rg) + +https://github.com/BurntSushi/ripgrep + +##### Installation: + +```bash +$ brew install ripgrep +``` + +##### Utilisation: + +```bash +$ rg PATH ~/.zshrc +``` + +![rg](/Users/bruno/Documents/docs/docs/Linux/rg.png) + +```bash +# regex ('core' plus 1 ou plusiers lettres) +$ rg 'core\w+' ~/.zshrc +22:PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH +25:coreutils=false + +# regex ('core' plus 0 ou plusiers lettres) +$ rg 'core\w*' ~/.zshrc +22:PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH +25:coreutils=false + +# string +$ rg -F 'eval "$(' ~/.zshrc +83:eval "$(zoxide init --cmd j zsh)" +107:eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" +``` + +[https://docs.rs/regex/*/regex/#syntax](https://docs.rs/regex/*/regex/#syntax) + +rg dans tout un répertoire: + +```bash +$ rg '#!' +handbrake-batchconvert.sh +1:#!/bin/sh + +composer.sh +1:#!/bin/bash + +tmutil.sh +1:#!/bin/bash +``` + +```bash +$ rg '#!' Scripts +Scripts/kymsu2/kymsu2.sh +1:#!/usr/bin/env bash + +Scripts/sonos/test.sh +1:#!/usr/bin/env bash +``` + +En l'absence de chemin, rg cherche dans le répertoire courant. + +##### Filtre manuel: + +```bash +# Rechercher uniquement dans les fichiers .sh +rg echo -g '*.sh' + +# Rechercher partout sauf dans les fichiers .sh +rg echo -g '!*.sh' +``` + +##### File types + +```bash +$ rg --type-list +... +config: *.cfg, *.conf, *.config, *.ini +md: *.markdown, *.md, *.mdown, *.mkdn +php: *.php, *.php3, *.php4, *.php5, *.phtml +sh: *.bash, *.bashrc, *.csh, *.cshrc, *.ksh, *.kshrc, *.sh, *.tcsh, *.zsh, .bash_login, .bash_logout, .bash_profile, .bashrc, .cshrc, .kshrc, .login, .logout, .profile, .tcshrc, .zlogin, .zlogout, .zprofile, .zshenv, .zshrc, bash_login, bash_logout, bash_profile, bashrc, profile, zlogin, zlogout, zprofile, zshenv, zshrc +... +``` + + + +```bash +# Recherche dans les fichiers shell .bashrc, .zshrc... + +$ rg 'eval' --type sh ~/ +# ou +$ rg 'eval' -tsh ~/ +/Users/bruno/.bash_profile +72:eval "$(thefuck --alias)" +/Users/bruno/.zprofile +1:eval "$(/opt/homebrew/bin/brew shellenv)" +... + +# Recherche partout sauf dans les fichiers shell .bashrc, .zshrc... + +$ rg 'eval' --type-not sh ~/ +# ou +$ rg 'eval' -Tsh ~/ +``` + +##### Remplacement: + +```bash +# recherche / remplacement mot pour mot +$ rg fast README.md --replace FAST +$ rg fast README.md -r FAST + +# remplacer toute une ligne +$ rg '^.*fast.*$' README.md -r FAST +``` + +##### Fichier de configuration: + +```bash +$ cat $HOME/.ripgreprc +``` + + + +### zoxide (z-zi)(j-ji) + +https://github.com/ajeetdsouza/zoxide + +##### Installation: + +```bash +$ brew install zoxide +``` + +##### Ajout au shell: + +```bash +# zsh +eval "$(zoxide init zsh)" + +# bash +eval "$(zoxide init bash)" +``` + +##### Installer fzf: + +```bash +$ brew install fzf +# To install useful key bindings and fuzzy completion: +$(brew --prefix)/opt/fzf/install +``` + +##### Configuration: + +```bash +# changer les alias prédéfinis (j au lieu de z): +eval "$(zoxide init --cmd j zsh)" + +``` + +##### Utilisation: + +```bash +z foo # cd into highest ranked directory matching foo +z foo bar # cd into highest ranked directory matching foo and bar + +z ~/foo # z also works like a regular cd command +z foo/ # cd into relative path +z .. # cd one level up +z - # cd into previous directory + +zi foo # cd with interactive selection (using fzf) +``` + diff --git a/docs/Linux/bat.md b/docs/Linux/bat.md index 8200e28..c41a56b 100644 --- a/docs/Linux/bat.md +++ b/docs/Linux/bat.md @@ -6,32 +6,32 @@ https://github.com/sharkdp/bat -Installation: +##### Installation: ```bash $ brew install bat $ brew install fzf ``` -Créer le fichier de configuration: +##### Créer le fichier de configuration: ```bash $ bat --generate-config-file ``` -Editer la configuration: +##### Editer la configuration: ```bash $ nano /Users/bruno/.config/bat/config ``` -Prévisualiser les thèmes: +##### Prévisualiser les thèmes: ```bash $ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh" ``` -Tail et bat: +##### Tail et bat: ```bash $ 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' ``` -Find et bat: +##### Find et bat: ```bash $ find /usr -name error_log -exec bat {} + @@ -56,13 +56,64 @@ $ find /usr -name error_log -exec bat {} + ``` -Man pages: +##### Man pages: ```bash $ export MANPAGER="sh -c 'col -bx | bat -l man -p'" 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 diff --git a/docs/Linux/fd.md b/docs/Linux/fd.md index 36e8fc3..8a1c21f 100644 --- a/docs/Linux/fd.md +++ b/docs/Linux/fd.md @@ -12,7 +12,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 ~ master* ⇡ @@ -25,41 +25,42 @@ pip/pip.conf ``` -Recherche dans un répertoire particulier: +##### Recherche dans un répertoire particulier: ```bash -~ master* ⇡ -❯ fd -HI 'id_*' .ssh +$ fd -HI 'id_*' .ssh .ssh/id_ed25519 .ssh/id_ed25519.pub .ssh/id_rsa .ssh/id_rsa.pub .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 -~ master* ⇡ 4m 27s -❯ fd -HI '^h.*.conf$' /etc -/etc/apache2/extra/httpd-autoindex.conf -/etc/apache2/extra/httpd-dav.conf -/etc/apache2/extra/httpd-default.conf -/etc/apache2/extra/httpd-info.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 -I '^.*.conf$' /opt +/opt/homebrew/share/autoconf +/opt/homebrew/share/user_map.conf +/opt/homebrew/Cellar/mariadb/10.6.4/share/user_map.conf +/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/groonga.conf +/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/httpd/fastcgi.conf ... + +$ fd -H '^.*.conf$' /opt + +$ ``` https://docs.rs/regex/1.0.0/regex/#syntax -Fichiers se terminant par *'[0-9].jpg'*: +##### Fichiers se terminant par *'[0-9].jpg'*: ```bash $ fd -HI '.*[0-9]\.jpg$' ~ @@ -67,17 +68,74 @@ $ fd -HI '.*[0-9]\.jpg$' ~ $ find ~ -iname '*[0-9].jpg' ``` -Sans arguments: +##### 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 +``` +#### Option: + +- **-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 **: exécute une commande pour chaque résultat +- **-X, --exec-batch **: 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 **: limite le nombre de répertoires traversés (pas de limite par défaut) +- **-t, --type ...**: 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 ...**: filtre par extension (plusieurs autorisées) +- **-E, --exclude ...**: exclure des fichiers/répertoires des résultats (--exclude '*.pyc', --exclude node_modules) +- **-c, --color **: colorie chaque chaine trouvée ('auto', 'never', 'always') +- **-S, --size ...**: filtre par la taille des fichiers (+3k, -500, +1g, 300) +- **--changed-within **: filtre par la date de modification + - --changed-within 2 weeks (10h, 1d, 35min) + - --change-newer-than '2018-10-27 10:00:00' +- **--changed-before **: filtre par la date de modification + - --changed-before '2018-10-27 10:00:00' + - --change-older-than 2weeks (10h, 1d, 35min) +- **-o, --owner **: filtre par utilisateur/groupe (--owner bruno, --owner :staff, --owner '!john:students') +- **--max-results **: limite le nombre de résultats à 'count' et quitte -Option: -- --hidden: cherche dans les dossiers cachés -- --no-ignore: -- -x / --exec: +```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 +``` diff --git a/docs/Linux/fzf.md b/docs/Linux/fzf.md new file mode 100644 index 0000000..47cecb6 --- /dev/null +++ b/docs/Linux/fzf.md @@ -0,0 +1,213 @@ +# 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. + +fzf2 + +##### Utilisation 2: + +```bash +~/Documents/Scripts_Raspberry master* +$ nano $(fzf) +``` + +On filtre: 'led + +fzf + + + +**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 + + + +##### Utilisation 3 (complétion de cd): + +```bash +~/Documents/Scripts_Raspberry master* 18:00:32 +$ cd ** +``` + +Puis **Tab** + +fzf3 + +Puis **Return** + +```bash +~/Documents/Scripts_Raspberry master* +$ cd SiriControl/ + +~/Documents/Scripts_Raspberry/SiriControl master* +$ +``` + +La complétion marche aussi avec la commande ssh: les serveurs sont tirés de /etc/hosts et de ssh/config. + +##### Utilisation 4 (kill): + +Taper **kill** puis **Espace** puis **Tab** + +```bash +$ kill +``` + +fzf4 + +**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** + +![fzf5](/Users/bruno/Documents/docs/docs/Linux/fzf5.png) + +Puis **Return** + +```bash +~/Documents/Scripts_Raspberry master* +$ cat pir/pir2.py +``` + +La complétion marche aussi avec les variables d'environnement. + +```bash +$ unset ** +$ unalias ** +$ export ** +``` + + + +##### Utilisation 6 (complétion de nano): + +```bash +~/Documents/Scripts_Raspberry master* +$ nano /opt/** +``` + +Puis **Tab** + +![fzf6](/Users/bruno/Documents/docs/docs/Linux/fzf6.png) + +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' + +``` + + + +### \ No newline at end of file diff --git a/docs/Linux/fzf.png b/docs/Linux/fzf.png new file mode 100644 index 0000000..919f71a Binary files /dev/null and b/docs/Linux/fzf.png differ diff --git a/docs/Linux/fzf2.png b/docs/Linux/fzf2.png new file mode 100644 index 0000000..6861459 Binary files /dev/null and b/docs/Linux/fzf2.png differ diff --git a/docs/Linux/fzf3.png b/docs/Linux/fzf3.png new file mode 100644 index 0000000..5b452a9 Binary files /dev/null and b/docs/Linux/fzf3.png differ diff --git a/docs/Linux/fzf4.png b/docs/Linux/fzf4.png new file mode 100644 index 0000000..a10f1b8 Binary files /dev/null and b/docs/Linux/fzf4.png differ diff --git a/docs/Linux/fzf5.png b/docs/Linux/fzf5.png new file mode 100644 index 0000000..26541d8 Binary files /dev/null and b/docs/Linux/fzf5.png differ diff --git a/docs/Linux/fzf6.png b/docs/Linux/fzf6.png new file mode 100644 index 0000000..35214d1 Binary files /dev/null and b/docs/Linux/fzf6.png differ diff --git a/docs/Linux/rg.png b/docs/Linux/rg.png new file mode 100644 index 0000000..b795830 Binary files /dev/null and b/docs/Linux/rg.png differ diff --git a/docs/Plesk/joplin.md b/docs/Plesk/joplin.md new file mode 100644 index 0000000..9d914de --- /dev/null +++ b/docs/Plesk/joplin.md @@ -0,0 +1,155 @@ +# Joplin + + + +### Serveur Joplin: + +https://github.com/laurent22/joplin/blob/dev/packages/server/README.md + +#### Créer les dossiers: + +```bash +$ mkdir /var/www/vhosts/maboiteverte.fr/docker/joplin +$ mkdir /var/www/vhosts/maboiteverte.fr/docker/joplin/data +``` + +#### Créer le fichier `docker-compose.yml` dans `/var/www/vhosts/maboiteverte.fr/docker/joplin`: + +```bash +$ nano docker-compose.yml +``` + +```yaml +version: '3' + +services: + db: + image: postgres:13.1 + ports: + - "5432:5432" + restart: unless-stopped + volumes: + - /var/www/vhosts/maboiteverte.fr/docker/joplin/data:/var/lib/postgresql/data + environment: + - APP_PORT=22300 + - POSTGRES_PASSWORD=joplin + - POSTGRES_USER=joplin + - POSTGRES_DB=joplin + app: + image: joplin/server:2.4.1-beta + depends_on: + - db + ports: + - "22300:22300" + restart: unless-stopped + environment: + - APP_BASE_URL=https://joplin.maboiteverte.fr + - DB_CLIENT=pg + - POSTGRES_PASSWORD=joplin + - POSTGRES_DATABASE=joplin + - POSTGRES_USER=joplin + - POSTGRES_PORT=5432 + - POSTGRES_HOST=db + +``` + +#### Créer le container: + +```bash +$ sudo docker-compose up -d +Creating network "joplin_default" with the default driver +Pulling app (joplin/server:latest)... +latest: Pulling from joplin/server +... +Digest: sha256:5c4cd651d4dae4ce85e252efc9262856d07dd8e0cf9a9a2c077a36c9631883cb +Status: Downloaded newer image for joplin/server:latest +Creating joplin_db_1 ... done +Creating joplin_app_1 ... done +``` + +Le serveur est disponible en local sur: http://localhost:22300 + +#### Créer une règle de proxy-inverse: + +Créer un sous-domaine **joplin.maboiteverte.fr** + +Créer une règle de proxy Docker: + +- URL: Joplin.maboiteverte.fr/ +- Conteneur: Joplin_app_1 +- Port: 22300 -> 22300 + + + +#### Voir les logs: + +```bash +$ sudo docker-compose --file docker-compose.yml logs +Password: +Attaching to joplin_app_1, joplin_db_1 +app_1 | WARNING: no logs are available with the 'db' log driver +db_1 | WARNING: no logs are available with the 'db' log driver +``` + + + +#### Mise-à-jour: + +```bash +bruno@localhost:~/docker/joplin$ sudo docker-compose stop +[sudo] password for bruno: +Stopping joplin_app_1 ... done +Stopping joplin_db_1 ... done + +bruno@localhost:~/docker/joplin$ sudo docker-compose pull +Pulling db (postgres:13.1)... +13.1: Pulling from library/postgres +Digest: sha256:26180996f7d804993f9c90398615d1269709a799b5eb79109292843a1c7cd851 +Status: Image is up to date for postgres:13.1 +Pulling app (joplin/server:2.4.1-beta)... +2.4.1-beta: Pulling from joplin/server +Digest: sha256:525ef4d9ecffe638c1e1eb9b85bdb7dc85a3dad51223206e60a3e588ab3bde52 +Status: Image is up to date for joplin/server:2.4.1-beta + +bruno@localhost:~/docker/joplin$ sudo docker-compose up -d +Starting joplin_db_1 ... +Starting joplin_db_1 ... done +Recreating joplin_app_1 ... +Recreating joplin_app_1 ... done + +``` + + + +```bash +COMPOSE_HTTP_TIMEOUT=200 sudo docker-compose up -d +``` + +ou + +```bash +nano .env +``` + +```bash +#.env +COMPOSE_HTTP_TIMEOUT=200 +``` + + + +### Application Joplin + +Préférences -> Synchronisation: + +Cible de la synchronisation: Joplin Server + +Serveur Joplin: + +- URL: https://joplin.maboiteverte.fr:22301 +- Dossier: home +- Utilisateur: bruno@xxx.info +- Mot de passe: xxxxx + + + diff --git a/docs/Raspberry/apt-get.md b/docs/Raspberry/apt-get.md index fab2ebc..75d3df4 100644 --- a/docs/Raspberry/apt-get.md +++ b/docs/Raspberry/apt-get.md @@ -1,5 +1,7 @@ # apt-get & apt-cache + + #### Mettre à jour met à jour la liste des fichiers disponibles dans les dépôts APT: ```bash diff --git a/docs/Raspberry/aptitude.md b/docs/Raspberry/aptitude.md index 7603f08..163b8be 100644 --- a/docs/Raspberry/aptitude.md +++ b/docs/Raspberry/aptitude.md @@ -22,7 +22,7 @@ $ sudo aptitude full-upgrade # idem à $ sudo aptitude dist-upgrade ``` -#### **Installer un paquet :** +#### Installer un paquet : ```bash $ sudo aptitude install @@ -44,7 +44,7 @@ $ sudo aptitude remove $ sudo aptitude purge ``` -#### **Supprimer un paquet en le mettant "automatique"** +#### Supprimer un paquet en le mettant "automatique" (celui-ci sera soit désinstallé tout de suite, soit automatiquement désinstallé dès que plus aucun autre paquet n'aura besoin de lui) : @@ -72,25 +72,25 @@ B le paquet a des dépendances cassées A le paquet a été automatiquement installé -#### **Vérifier si un paquet est installé** : +#### Vérifier si un paquet est installé : ```bash $ sudo aptitude show wget ``` -#### **Liste des packages non à jour:** +#### Liste des packages non à jour: ```bash $ sudo aptitude search '~U' ``` -#### **Dépendances du paquet** : +#### Dépendances du paquet : ```bash $ sudo aptitude search ~R wget ``` -#### **Dépendances inverses du paquet** : +#### Dépendances inverses du paquet : ```bash $ sudo aptitude search ~D wget diff --git a/docs/Synology/dsm7/apache.md b/docs/Synology/dsm7/apache.md new file mode 100644 index 0000000..fc0a724 --- /dev/null +++ b/docs/Synology/dsm7/apache.md @@ -0,0 +1,21 @@ +# httpd + + + +Version: + +```bash +$ httpd24 -v +Server version: Apache/2.4.46 (Unix) +Server built: Apr 19 2021 14:41:36 +``` + +Log: + +```bash +cd /var/log/httpd/ + +-rw-rw---- 1 system log 383317 Aug 25 14:21 apache24-error_log +bruno@DS916:/var/log/httpd $ +``` + diff --git a/docs/Synology/dsm7/node.md b/docs/Synology/dsm7/node.md index f4d1b80..0de5fd9 100644 --- a/docs/Synology/dsm7/node.md +++ b/docs/Synology/dsm7/node.md @@ -2,7 +2,7 @@ -Installer nvm +#### Installer nvm ```bash $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash @@ -29,7 +29,7 @@ $ nvm reinstall-packages 14.17.0 -Installer thumbsup +#### Installer thumbsup ```bash $ npm -g install thumbsup @@ -38,3 +38,54 @@ $ which thumbsup /var/services/homes/bruno/.nvm/versions/node/v14.17.3/bin/thumbsup ``` +```bash +$ cd /volume1/photo/thumbsup +total 32 +drwxrwxrwx+ 1 bruno 138862 286 Mar 15 10:56 . +drwxrwxrwx+ 1 138862 138862 588 Aug 9 08:35 .. +-rwxrwxrwx+ 1 bruno users 487 Mar 14 18:19 config.json +-rwxrwxrwx+ 1 bruno users 487 Mar 15 10:37 config.json.bak +-rwxrwxrwx+ 1 bruno users 440 Mar 12 06:51 config-npm.json +drwxrwxrwx+ 1 root root 126 Dec 5 2020 @eaDir +drwxrwxrwx+ 1 bruno users 144 Mar 15 11:39 .git +-rwxrwxrwx+ 1 bruno users 9 Mar 15 10:56 .gitignore +-rwxrwxrwx+ 1 bruno users 155 Mar 15 10:44 readme.md +drwxrwxrwx+ 1 bruno users 124 Mar 14 12:48 theme-flow +drwxrwxrwx+ 1 bruno users 122 Nov 29 2020 theme-flow-bruno +-rwxrwxrwx 1 bruno users 24 Nov 15 2020 theme_options.json +-rwxrwxrwx+ 1 bruno users 428 Mar 14 11:58 thumbsup.sh +-rwxrwxrwx+ 1 bruno users 365 Mar 15 10:11 thumbsup_update.sh +``` + +```bash +$ nano config.json +``` + +```json +{ + "input": "/input/Flore", + "output": "/output/gallery", + "exclude": ["_Archived Items/","thumbsup"], + "include-raw-photos": true, + "thumb-size": 250, + "large-size": 1600, + "photo-download": "symlink", + "cleanup": true, + "sort-albums-by": "title", + "sort-media-by": "date", + "sort-media-direction": "desc", + "home-album-name": "Accueil", + "theme-path": "/input/thumbsup/theme-flow/theme", + "title": "Photos...", + "embed-exif": true, + "locale": "fr", + "footer": "bruno@clicclac.info" +} +``` + + + +```bash +$ thumbsup --config config.json +``` + diff --git a/docs/Windows/PowerShell/env.md b/docs/Windows/PowerShell/env.md index f05ee30..dc08ce5 100644 --- a/docs/Windows/PowerShell/env.md +++ b/docs/Windows/PowerShell/env.md @@ -66,3 +66,73 @@ PUBLIC C:\Users\Public CommonProgramFiles C:\Program Files\Common Files ``` + + +Afficher le PATH + +```powershell +> $env:Path +C:\Program Files\Parallels\Parallels Tools\Applications;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\PowerShell\7\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Users\bruno\AppData\Local\Microsoft\WindowsApps;C:\Users\bruno\AppData\Local\Programs\Microsoft VS Code\bin +``` + +Ajouter au PATH + +``` +$addPath = 'C:\Folder\bin' +``` + + + +##### which: + +`Get-Command ` + +```powershell +Get-Command wsl + +CommandType Name Version Source +----------- ---- ------- ------ +Application wsl.exe 10.0.22... C:\WINDOWS\system32\wsl.exe +``` + + + +##### Version de Powershell: + +`Get-Host` + +```powershell +PS C:\Users\bruno> Get-Host + +Name : ConsoleHost +Version : 7.1.4 +InstanceId : c47454ef-ce56-4af8-b3e0-6b10825d6f8f +UI : System.Management.Automation.Internal.Host.InternalHostUserInterface +CurrentCulture : fr-FR +CurrentUICulture : fr-FR +PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy +DebuggerEnabled : True +IsRunspacePushed : False +Runspace : System.Management.Automation.Runspaces.LocalRunspace +``` + +`(Get-Host).Version` + +```powershell +PS C:\Users\bruno> (Get-Host).Version + +Major Minor Build Revision +----- ----- ----- -------- +7 1 4 -1 +``` + +`$PSVersionTable.PSVersion` + +```powershell +PS C:\Users\bruno> $PSVersionTable.PSVersion + +Major Minor Patch PreReleaseLabel BuildLabel +----- ----- ----- --------------- ---------- +7 1 4 +``` + diff --git a/docs/Windows/PowerShell/trucs.md b/docs/Windows/PowerShell/trucs.md index 955a59c..1a690c0 100644 --- a/docs/Windows/PowerShell/trucs.md +++ b/docs/Windows/PowerShell/trucs.md @@ -1,5 +1,71 @@ # Trucs +Ouvrir Windows Terminal en 3 panneaux: + +```powershell +wt -p "Debian" `; split-pane -p "PowerShell 7" `; split-pane -p "Invite de commandes" +``` + +Ouvrir en 3 onglets dans Windows Terminal: + +```powershell +wt -p "Debian" `; new-tab -p "PowerShell 7" `; new-tab -p "Invite de commandes" +``` + +Palette de commande: + +`Ctrl + Shift + P` + +Thèmes: + +https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup + +https://ohmyposh.dev/docs/ + + + +#### Ouvrir une nouvelle fenêtre Powershell en administrateur: + +1. + +```powershell +Start-Process powershell -Verb runAs +``` + +https://stackoverflow.com/questions/7690994/running-a-command-as-administrator-using-powershell + +2. + +`Win + Ctrl + Maj + 8` + +Si Powershell est en 8e position dans la barre des taches (le 1er étant l'Explorateur). + +3. + +```powershell +# ouvre une nouvelle fenêtre de Windows Terminal en mode admin. + +powershell "Start-Process -Verb RunAs cmd.exe '/c start wt.exe'" +``` + +4. + +[gsudo](https://github.com/gerardog/gsudo) + +Installation: + +```powershell +choco install gsudo +winget install gsudo +``` + +```powershell +# Dans PowerShell ou l'invite de commande: + +# donne les droits admin à la console courante +gsudo +``` + ```powershell @@ -177,3 +243,28 @@ Bash <-> PowerShell: | | | | | | | | + + +#### Réinitialiser Windows Store + +1ere solution: + +```powershell +PS> PowerShell -ExecutionPolicy Unrestricted $manifest = (Get-AppxPackage Microsoft.WindowsStore).InstallLocation + ‘\AppxManifest.xml’ ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest +``` + +2eme solution: + +```powershell +PS> sfc /scannow +``` + +puis reboot (fonctionne W11) + +3eme solution: + +```powershell +DISM /Online /Cleanup-Image /ScanHealth +``` + +puis reboot diff --git a/docs/Windows/Terminal.md b/docs/Windows/Terminal.md index 5ffe154..224e745 100644 --- a/docs/Windows/Terminal.md +++ b/docs/Windows/Terminal.md @@ -2,6 +2,8 @@ [Docs](https://github.com/microsoft/terminal/tree/master/doc/user-docs) +https://docs.microsoft.com/en-us/windows/terminal/get-started + ### Installation: diff --git a/docs/Windows/winget.md b/docs/Windows/winget.md new file mode 100644 index 0000000..304c1fc --- /dev/null +++ b/docs/Windows/winget.md @@ -0,0 +1,77 @@ +# winget + +https://github.com/microsoft/winget-cli + +https://docs.microsoft.com/en-us/windows/package-manager/?WT.mc_id=thomasmaurer-blog-thmaure + + + +#### Installation: + +Nécessite un compte Windows Insider. + +Sur le Microsoft Store, installer **App Installer** (Programme d'installation d'application) + +La commande **winget** est dispo dans l'Invite de commande ou dans Powershell. + + + +#### Utilisation: + +##### Rechercher un paquet: + +`winget shearch ` + +```powershell +PS> winget search etcher +Nom ID Version +---------------------------------------------- +balenaEtcher Balena.Etcher 1.5.121 +UCF Ahlyab.UdemyCouponFetcher 1 +``` + +##### Information sur un paquet: + +`winget show ` + +```powershell +PS> winget show etcher +Trouvé balenaEtcher [Balena.Etcher] +Version: 1.5.121 +Publisher: Balena Inc. +Author: Balena Inc. +Moniker: etcher +Description: Etcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more. +Homepage: https://www.balena.io/etcher +License: Apache License 2.0 +License Url: https://raw.githubusercontent.com/balena-io/etcher/v1.5.121/LICENSE +``` + +##### Installer un paquet: + +`winget install ` + +```powershell +PS> winget install balenaEtcher +Trouvé balenaEtcher [Balena.Etcher] +La licence d’utilisation de cette application vous est octroyée par son propriétaire. +Microsoft n’est pas responsable des paquets tiers et n’accorde pas de licences à ceux-ci. +Downloading https://github.com/balena-io/etcher/releases/download/v1.5.121/balenaEtcher-Setup-1.5.121.exe + ██████████████████████████████ 140 MB / 140 MB +Le code de hachage de l’installation a été vérifié avec succès +Démarrage du package d’installation... Merci de patienter. +Installé correctement +``` + +##### Mettre-à-jour un paquet: + +`winget upgrade ` + +`winget upgrade --all` + +`winget list ` + +##### Désinstaller un paquet: + +`winget uninstall ` + diff --git a/docs/Windows/wsl.md b/docs/Windows/wsl.md index afb7272..ba95941 100644 --- a/docs/Windows/wsl.md +++ b/docs/Windows/wsl.md @@ -2,7 +2,7 @@ -### WSL 2 (installation) +### WSL (installation) Nécessite au minimum la build 2004 (une insider build au 31/03/2020) Aller à Fonctionnalités de Windows: @@ -19,11 +19,23 @@ Pour voir, si elle est active, aller dans le Gestionnaire de taches -> onglet Pe Pour Parallels Desktop, aller dans Configuration -> Matériel -> CPU et mémoire -> Paramètres avancés, et cocher Activer la virtualisation imbriquée. -Aller sur le Microsoft Store et installer une distrib Linux. +Mettre-à-jour le [composant noyau](https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package): + +https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi + +https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi + +Dans PowerShell: + +```powershell +wsl --set-default-version 1 +``` + +Aller sur le Microsoft Store et installer une distrib Linux (Debian). ```bash $ cat /etc/debian_version -10.3 +11.0 # bullseye ``` Dans l'invite de commande: @@ -41,7 +53,7 @@ Distributions du sous-système Windows pour Linux : Debian (par défaut) ``` -Les distros sont visibles en tapant `\\wsl$` dans la barre de l'explorer. +Les distros sont visibles en tapant \\wsl$ dans la barre de l'explorer. Même en quittant la distro (`$ exit`), elle y reste dispo. #### Quitter une distro: @@ -80,7 +92,7 @@ wsl --set-default-version 2 #### Pour démarrer la distro: -```bash +```powershell wsl --distribution Debian @@ -93,6 +105,61 @@ NAME STATE VERSION +#### Liste des distributions: + +```powershell +# Prêtes à l'utilisation: + +wsl -l +wsl --list +Distributions du sous-système Windows pour Linux : +Debian (par défaut) +Ubuntu + +# Toutes les distributions: + +wsl --list --all +Distributions du sous-système Windows pour Linux : +Debian (par défaut) +Ubuntu + +# En cours d'utilisation: + +wsl --list --running +Distributions du sous-système Windows pour Linux : +Debian (par défaut) +``` + + + +#### Distribution par défaut: + +Celle qui répond aux commandes `wsl` + +```powershell +wsl -s Debian +wsl --setdefault Debian +``` + +Pour utiliser une distribution spécifique, sans la mettre par défaut: + +```powershell +wsl -d Ubuntu +wsl --distribution Ubuntu +``` + + + +#### Désactiver une distribution: + +Elle n'apparait plus dans `wsl --list`: + +``` +wsl --unregister Debian +``` + +Retourner dans le Microsoft Store pour la réinstaller. + @@ -124,8 +191,26 @@ https://docs.microsoft.com/en-us/windows/wsl/wsl-config#set-wsl-launch-settings +#### Fichier de config `/etc/wsl.conf`: + +Il est lu au chargement de la distro. + + + +#### Fichier de configuration globale `C:\Users\\.wslconfig`: + +Les options s'appliquent à toutes les distros (WSL2) + +https://docs.microsoft.com/en-us/windows/wsl/wsl-config + + + #### Installer une GUI: +``` +sudo apt-get update +``` + Installer xfce4: ```bash @@ -153,10 +238,16 @@ Trouver l'adresse IP de la distrib WSL ```bash ifconfig | grep inet (ip addr | grep inet) -Les IP de ipconfig.exe ne sont pas les bonnes. +#Les IP de ipconfig.exe ne sont pas les bonnes. +``` + +```bash +hostname -i +127.0.1.1 ``` Ouvrir une session xRDP + > mstsc.exe > puis fournir l'adresse IP @@ -164,6 +255,12 @@ Ouvrir une session xRDP mstsc.exe 127.0.0.1:3390 ``` +Si erreur *failed to execute child process "dbus-launch"*: + +```bash +sudo apt-get install dbus-x11 +``` + Ajouter un alias au .zshrc ```bash @@ -178,6 +275,12 @@ https://korben.info/linux-wsl-gui-interface-graphique-windows-10.html +```bash +sudo apt install python3 python3-pip ipython3 +``` + + + #### Navigation dans les dossiers/fichiers: Dans WSL: diff --git a/docs/Windows/wsl_2.md b/docs/Windows/wsl_2.md index 5a759b4..1782f5f 100644 --- a/docs/Windows/wsl_2.md +++ b/docs/Windows/wsl_2.md @@ -158,12 +158,55 @@ $ chmod 600 ~/.ssh/* -#### Installer keychain dans wsl: +#### Créer le ssh-agent: + +```bash +$ eval $(ssh-agent -s) +Agent pid 3551 +``` + +#### Ajouter la clé ssh au ssh-agent: + +```bash +$ ssh-add +Enter passphrase for /home/bruno/.ssh/id_rsa: +Identity added: /home/bruno/.ssh/id_rsa +``` + +#### + +#### ~~Installer keychain dans wsl:~~ ```bash $ sudo apt install keychain ``` +et ajouter au `.zshrc`: + +```bash +# on peut mettre toutes les clés que l'on veut attacher à la keychain +eval `keychain --eval --agents ssh ~/.ssh/id_rsa` +``` + +A la première ouverture du terminal, keychain demande la passphrase. + +Pour les sessions suivantes, keychain indique que des clés sont chargées. + +Liste des clés: + +```bash +$ keychain --list +3072 SHA256:V/qyypJ2NVwfvQ8l8P/JBZcNC515j66MKG9HTAuDnX0 bruno@BRUNOPESENT79AA (RSA) +``` + +Décharger les clés en mémoire: + +```bash +$ keychain --clear +``` + + + #### Copier la clé sur le serveur: @@ -184,6 +227,25 @@ scp -P42666 C:\Users\bruno\.ssh\id_rsa.pub bruno@clicclac.synology.me:~/.ssh/aut #### Ne plus demander la passphrase ssh: +#### 1. + +```powershell +# By default the ssh-agent service is disabled. Allow it to be manually started for the next step to work. +# Make sure you're running as an Administrator. +Get-Service ssh-agent | Set-Service -StartupType Manual + +# Start the service +Start-Service ssh-agent + +# This should return a status of Running +Get-Service ssh-agent + +# Now load your key files into ssh-agent +ssh-add ~\.ssh\id_rsa +``` + +#### 2. + https://medium.com/@glsorre/windows-subsystem-for-linux-never-prompt-your-ssh-passphrase-again-353db7c931ab Installer CredentialManager: @@ -285,6 +347,24 @@ compinit +#### Pipe vers le presse-passier Windows: + +Ajouter dans le .zshrc: + +```bash +alias clip="clip.exe" +``` + +puis dans le shell: + +```bash +grep alias .zshrc | clip +``` + +et coller (Ctrl+V) dans Notepad. + + + ### Fin ```bash @@ -296,5 +376,11 @@ $ uname --release +https://opticos.github.io/openinwsl/ + +https://opticos.github.io/gwsl/ + +https://github.com/sirredbeard/Awesome-WSL + https://devblogs.microsoft.com/commandline/access-linux-filesystems-in-windows-and-wsl-2/ diff --git a/docs/macos/python/pipx.md b/docs/macos/python/pipx.md new file mode 100644 index 0000000..f8fea6e --- /dev/null +++ b/docs/macos/python/pipx.md @@ -0,0 +1,172 @@ +# pipx + + + +#### Installation: + +```bash +$ brew install pipx +$ pipx ensurepath +``` + + + +#### Complétions: + +Ajouter à `.zshrc`: + +```bash +autoload -U bashcompinit && bashcompinit +eval "$(register-python-argcomplete pipx)" +``` + + + +#### Installer un paquet: + +```bash +$ pipx install soco-cli +``` + +Le paquet est installé dans un environnement virtuel sous `~/.local/pipx/venvs` + +```bash +~/.local/pipx/venvs/soco-cli/bin +$ ls -la +Permissions Size User Group Date Modified Date Created Name +.rw-r--r-- 1,9Ki bruno staff 17 aoû 10:47 17 aoû 10:47  activate +.rw-r--r-- 867 bruno staff 17 aoû 10:47 17 aoû 10:47  activate.csh +.rw-r--r-- 2,0Ki bruno staff 17 aoû 10:47 17 aoû 10:47  activate.fish +.rw-r--r-- 8,6Ki bruno staff 17 aoû 10:47 17 aoû 10:47  Activate.ps1 +.rwxr-xr-x 278 bruno staff 17 aoû 10:47 17 aoû 10:47  normalizer* +lrwxr-xr-x 9 bruno staff 17 aoû 10:47 17 aoû 10:47  python@ +lrwxr-xr-x 9 bruno staff 17 aoû 10:47 17 aoû 10:47  python3@ +lrwxr-xr-x 42 bruno staff 17 aoû 10:47 17 aoû 10:47  python3.9@ +.rwxr-xr-x 247 bruno staff 17 aoû 10:47 17 aoû 10:47  soco* +.rwxr-xr-x 256 bruno staff 17 aoû 10:47 17 aoû 10:47  soco-discover* +.rwxr-xr-x 250 bruno staff 17 aoû 10:47 17 aoû 10:47  soco-http-api-server* +.rwxr-xr-x 247 bruno staff 17 aoû 10:47 17 aoû 10:47  sonos* +.rwxr-xr-x 256 bruno staff 17 aoû 10:47 17 aoû 10:47  sonos-discover* +.rwxr-xr-x 250 bruno staff 17 aoû 10:47 17 aoû 10:47  sonos-http-api-server* +.rwxr-xr-x 243 bruno staff 17 aoû 10:47 17 aoû 10:47  tabulate* +.rwxr-xr-x 245 bruno staff 17 aoû 10:47 17 aoû 10:47  uvicorn* +``` + +```bash +$ which soco +/Users/bruno/.local/bin/soco +``` + + + +#### Exécuter un paquet sans l'installer: + +```bash +$ pipx run pycowsay Meuuuhh ! +⚠️ pycowsay is already on your PATH and installed at /Users/bruno/.local/bin/pycowsay. Downloading and running anyway. + + --------- +< Meuuuhh ! > + --------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || + +``` + + + +#### Liste des paquets installés: + +```bash +$ pipx list +venvs are in /Users/bruno/.local/pipx/venvs +apps are exposed on your $PATH at /Users/bruno/.local/bin + package pycowsay 0.0.0.1, Python 3.9.6 + - pycowsay + package soco-cli 0.4.15, Python 3.9.6 + - soco + - soco-discover + - soco-http-api-server + - sonos + - sonos-discover + - sonos-http-api-server +``` + +Avec les paquets additionnels: + +```bash +$ pipx list --include-injected +venvs are in /Users/bruno/.local/pipx/venvs +apps are exposed on your $PATH at /Users/bruno/.local/bin + package mkdocs 1.2.2, Python 3.9.6 + - mkdocs + Injected Packages: + - fontawesome-markdown 0.2.6 + - mkdocs-git-revision-date-localized-plugin 0.9.2 + - mkdocs-material 7.2.4 + - mkdocs-material-extensions 1.0.1 + - mkdocs-minify-plugin 0.4.0 + - mkdocs-pdf-export-plugin 0.5.8 + package pycowsay 0.0.0.1, Python 3.9.6 + - pycowsay +``` + + + +#### Installer un paquet dans un environnement virtuel: + +```bash +$ pipx inject mkdocs mkdocs-material mkdocs-material-extensions mkdocs-minify-plugin mkdocs-git-revision-date-localized-plugin mkdocs-pdf-export-plugin fontawesome_markdown + injected package mkdocs-material into venv mkdocs +done! ✨ 🌟 ✨ + injected package mkdocs-material-extensions into venv mkdocs +done! ✨ 🌟 ✨ + injected package mkdocs-minify-plugin into venv mkdocs +done! ✨ 🌟 ✨ + injected package mkdocs-git-revision-date-localized-plugin into venv mkdocs +done! ✨ 🌟 ✨ + injected package mkdocs-pdf-export-plugin into venv mkdocs +done! ✨ 🌟 ✨ + injected package fontawesome-markdown into venv mkdocs +done! ✨ 🌟 ✨ +``` + + + +#### Mise-à-jour: + +```bash +$ pipx upgrade soco-cli +soco-cli is already at latest version 0.4.15 (location: /Users/bruno/.local/pipx/venvs/soco-cli) +``` + +Mettre également à jour les paquets additionnels: + +```bash +$ pipx upgrade mkdocs --include-injected +mkdocs is already at latest version 1.2.2 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +fontawesome-markdown is already at latest version 0.2.6 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +mkdocs-git-revision-date-localized-plugin is already at latest version 0.9.2 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +mkdocs-material is already at latest version 7.2.4 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +mkdocs-material-extensions is already at latest version 1.0.1 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +mkdocs-minify-plugin is already at latest version 0.4.0 (location: /Users/bruno/.local/pipx/venvs/mkdocs) +mkdocs-pdf-export-plugin is already at latest version 0.5.8 (location: /Users/bruno/.local/pipx/venvs/mkdocs)p +``` + +```bash +$ pipx upgrade-all +Versions did not change after running 'pip upgrade' for each package 😴 +``` + + + +#### Aide: + +```bash +$ pipx --help +$ pipx --help +``` + diff --git a/docs/macos/python/poetry.md b/docs/macos/python/poetry.md new file mode 100644 index 0000000..7df732c --- /dev/null +++ b/docs/macos/python/poetry.md @@ -0,0 +1,49 @@ +# Poetry + + + +#### Installation: + +```bash +$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 - +``` + +Ajouter Poetry au $PATH dans `.zshrc`: + +```bash +export PATH="/Users/bruno/Library/Python/3.9/bin:$PATH" +``` + +Complétions: + +```bash +# Zsh +$ poetry completions zsh > ~/.zfunc/_poetry + +# For poetry: https://github.com/python-poetry/poetry#enable-tab-completion-for-bash-fish-or-zsh +fpath+=~/.zfunc + +# additional completions +autoload -U +X compinit && compinit + + +# Bash (Homebrew) +$ poetry completions bash > $(brew --prefix)/etc/bash_completion.d/poetry.bash-completion +``` + + + +#### Désinstallation: + +```bash +$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 - --uninstall +``` + + + +#### Mise-à-jour: + +```bash +$ poetry self update +``` +