Update 23-01-2020

This commit is contained in:
2020-01-25 06:47:22 +01:00
parent 1f6b5d13d8
commit f760227ba1
28 changed files with 1864 additions and 57 deletions

View File

@@ -84,6 +84,16 @@ $ echo ${tableau_asso["erable"]}
Ajouter un élément:
```bash
ARRAY=()
ARRAY+=('foo')
ARRAY+=('bar')
```
#### Modification d'un élément:
Si le tableau nexiste pas, il sera créé comme un tableau indicé :

View File

@@ -1,4 +1,4 @@
# Installer Nextcloud en logne de commande
# Installer Nextcloud en ligne de commande

View File

@@ -15,7 +15,131 @@
Globbing
##### Ordre de chargement:
/etc/zshenv ➔ ~/.zshenv
/etc/zprofile ➔ ~/.zprofile (login shell)
/etc/zshrc ➔ ~/.zshrc (interactive shell)
/etc/zlogin ➔ ~/.zlogin
~/.zlogout ➔ /etc/zlogout
La variable ZDOTDIR définit l'endroit où se trouve les fichiers de configuration (`~/` par défaut). Elle se définit dans `~/.zshenv`
#### Options:
http://zsh.sourceforge.net/Doc/Release/Options.html#Options
Voir les options:
```bash
$ setopt
alwaystoend
autocd
combiningchars
correctall
extendedhistory
histignorealldups
histreduceblanks
incappendhistory
interactive
login
monitor
nopromptcr
promptsubst
sharehistory
shinstdin
zle
```
Toutes les options par défaut:
```bash
$ emulate -lLR zsh
```
```
setopt NO_CASE_GLOB
setopt AUTO_CD
# add a timestamp
setopt EXTENDED_HISTORY
# size
SAVEHIST=5000
HISTSIZE=2000
# share history across multiple zsh sessions
setopt SHARE_HISTORY
# append to history
setopt APPEND_HISTORY
# adds commands as they are typed, not at shell exit
setopt INC_APPEND_HISTORY
# expire duplicates first
setopt HIST_EXPIRE_DUPS_FIRST
# do not store duplications
setopt HIST_IGNORE_DUPS
#ignore duplicates when searching
setopt HIST_FIND_NO_DUPS
# removes blank lines from history
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt CORRECT
setopt CORRECT_ALL
```
Remettre les options par défaut:
```bash
$ emulate -LR zsh
```
#### Ré-entrer la dernière commande:
```bash
$ du -schx * | sort -nr
924K Regular-Expressions.pdf
...
$ !!
du -schx * | sort -nr
924K Regular-Expressions.pdf
$ cd ; !!
cd ; du -schx * | sort -nr
```
Très utile quand on a oublié le sudo:
```bash
$ apachectl -k restart
httpd not running, trying to start
(13)Permission denied: AH00091: httpd: could not open error log file /usr/local/var/log/httpd/error_log.
AH00015: Unable to open logs
$ sudo !!
sudo apachectl -k restart
Password:
httpd not running, trying to start
# L'option HIST_VERIFY permet de vérifier la commande avant de l'exécuter
```
#### Globbing
```bash
@@ -99,7 +223,9 @@ print -l zsh_demo/data/europe/poland/*.txt([1]:h)
# Remember you can combine qualifiers and modifiers.
```
### ZLE
#### ZLE
ZLE désigne la zone dans laquelle vous tapez vos commandes. Vous pouvez utiliser les raccourcis claviers de vi ou d'emacs, au choix, et définir très facilement vos propres raccourcis. En vrac, quelques raccourcis par défaut :
@@ -108,6 +234,37 @@ ZLE désigne la zone dans laquelle vous tapez vos commandes. Vous pouvez utilise
#### Fonctions autoload
Au lieu de déclarer la fonction directement le fichier de configuration, vous pouvez placer la fonction dans un fichier séparé. zsh a une variable intégrée appelée fpath qui est un tableau de chemins où zsh recherchera les fichiers définissant une fonction. Vous pouvez ajouter votre propre répertoire à ce chemin de recherche:
```bash
fpath+=~/Documents/zshfunctions
```
Il faut aussi dire à zsh que vous souhaitez utilisez cette fonction:
```bash
autoload my_ps
```
```bash
~/Documents/zshfunctions master*
l
total 4
-rw-r--r-- 1 bruno staff 61 déc 10 17:48 my_ps
```
```bash
# my_ps file
ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ;
```
https://scriptingosx.com/2019/07/moving-to-zsh-part-4-aliases-and-functions/
#### Alias suffixes
```
@@ -187,6 +344,18 @@ alias -g T='| tail'
alias -g X='| xargs'
```
#### which:
**which** fonctionne aussi pour les alias:
```bash
$ which l
l: aliased to gls -lA --color
$ which 'NUL'
NUL: globally aliased to > /dev/null 2>&1
```
#### Raccourcis:

110
docs/Divers/zsh/zsh2.md Normal file
View File

@@ -0,0 +1,110 @@
# zsh
[F.A.Q.](http://zsh.sourceforge.net/FAQ/)
[Manuel](http://zsh.sourceforge.net/Doc/Release/zsh_toc.html)
[Guide](http://zsh.sourceforge.net/Guide/zshguide.html)
[Moving to zsh](https://scriptingosx.com/2019/06/moving-to-zsh/)
[Mastering-zsh](https://github.com/rothgar/mastering-zsh)
##### cd automatique:
```
~ master
Docu <tab><enter>
~/Documents master
```
**Recursive path expansion:**
```
~ master
/u/lo/b <tab><enter>
/usr/local/bin
```
```
~ master
/U/b/doc <tab><enter>
~/Documents master
```
##### Auto correction:
```
ce Documents
zsh: correct 'ce' to 'cd' [nyae]?
```
##### [nyae]?
`n`: **n**o. Ne corrige pas et exécute la commande entrée.
```bash
[bruno@silverbook/~] $ lx
zsh: correct 'lx' to 'ls' [nyae]? n
zsh: command not found: lx
```
`y`: **y**es. Corrige et exécute la modification suggérée par zsh.
```bash
[bruno@silverbook/~] $ lx
zsh: correct 'lx' to 'ls' [nyae]? y
Applications Movies Sites
Applications (Parallels) Music SynologyDrive
Brewfile Nextcloud backup_list.conf
Cloud OneDrive pCloud Drive
Desktop Parallels path
Documents Pictures plugins.d
Downloads Public project
Dropbox PycharmProjects
Library Shared with me
```
`a`: **a**bort. Ne fait rien et affiche un nouveau prompt.
```bash
$ setfile
zsh: correct 'setfile' to 'SetFile' [nyae]? a
$
```
`e`: **e**dit. Editer la ligne.
```bash
$ setfile
zsh: correct 'setfile' to 'SetFile' [nyae]? e
$ setfile|
```
##### shebang:
```bash
#!/bin/zsh
```
##### Emuler sh:
```bash
#!/bin/zsh --emulate sh
```

View File

@@ -2,6 +2,10 @@
https://www.grymoire.com/Unix/Awk.html
```bash
$ cat test.txt
ubuntu Linux

View File

@@ -95,6 +95,18 @@ Recherche <u>combinée</u>:
find / -type f -user bruno -perm 755 -print
```
Recherche avec <u>regex</u>:
```bash
# les images avec extentions jpg|gif|png|jpeg dans le dossier Users
# -E => macOS only ??
find -E /Users/bruno -regex ".*\.(jpg|gif|png|jpeg)"
# non case-sensitive
find -E /Users/bruno -iregex ".*\.(jpg|gif|png|jpeg)"
```
Commandes en option:

View File

@@ -30,8 +30,28 @@ $ tail -f /var/log/messages
### Head
#### Afficher les 5 premières lignes du fichier.
```bash
$ head -5 /var/log/messages
$ head -n5 /var/log/messages
$ head -n 5 /var/log/messages
```
### MultiTail
[Multitail](https://vanheusden.com/multitail/manual.php)
#### Installation:
```bash
$ brew install multitail
```
Permet d'afficher plusieurs fichiers en meme temps:
```bash
@@ -42,50 +62,94 @@ Permet d'afficher 2 fichiers côte à côte:
```bash
$ multitail -s 2 error_log access_log
# sur 3 colonnes
$ multitail -s 3
```
ou 'v' en cours d'exécution
ou **'v'** en cours d'exécution
Faire défiler (sur 100 lignes): 'b' ('q' pour quitter le mode défilement')
Faire défiler (sur 100 lignes): **'b'**
Puis aller au début / à la fin: **gg** / **G**
Quitter le mode défilement: **'q'**
Pour changer le nb de lignes:
-m <valeur> pour le prochain fichier
-M <valeur> pour tous les fichiers
Pour changer le nb de lignes:
**-m <valeur>** pour le prochain fichier
**-M <valeur>** pour tous les fichiers
Fusionner 2 fichiers (ils s'affichent ensemble dans une seul fenêtre):
Quitter MultiTail: **'q'** ou **'ctrl-q'**
#### Fusionner 2 fichiers (ils s'affichent ensemble dans une seul fenêtre):
```bash
$ multitail error_log -I access_log
```
Visualiser la sortie de programmes externes:
Fusionner 2 fichiers et afficher chacun d'une couleur différente:
```bash
$ multitail -ci green httpd/error_log -ci yellow -I php-fpm.log
```
Afficher le fichier en couleur:
```bash
$ multitail -F /usr/local/etc/multitail.conf -cS apache /usr/local/var/log/httpd/error_log
```
Les colors schemes sont tirés du fichier multitail.conf. Multitail recherche son fichier de config dans le répertoire courante, dans /etc. Sinon on peut spécifier le fichier avec l'option -F (`-F /usr/local/etc/multitail.conf`)
#### Visualiser la sortie de programmes externes:
```bash
$ multitail -l "ping localhost"
```
Filtrer à l'aide de regexp (grep):
Visualiser un fichier log et un programme externe:
```bash
$ multitail -e '200' access_log
$ multitail error_log -l "ping localhost"
```
```bash
$ multitail -v -e "ssh" -v -e "gnu-pop3d" -e "localhost" /var/log/messages
$ multitail error_log -s 2 -sn 1,3 -l "ping localhost" -l "ping localhost" -l "ping localhost"
```
-e 'test': n'affiche que les lignes qui contiennent 'test'
-v -e 'test': n'affiche que les autres lignes
### Head
#### Afficher les 5 premères lignes du fichier.
#### Filtrer à l'aide de regexp (grep):
```bash
$ head -5 /var/log/messages
$ head -n5 /var/log/messages
$ head -n 5 /var/log/messages
$ multitail -e '200' /usr/local/var/log/httpd/access_log
::1 - - [21/Dec/2019:11:39:17 +0100] "GET /info.php HTTP/1.1" 200 111908
::1 - - [21/Dec/2019:11:47:48 +0100] "GET /info.php HTTP/1.1" 200 111908
$ multitail -e '404' /usr/local/var/log/httpd/access_log
192.168.1.24 - - [02/Dec/2019:10:27:58 +0100] "GET /apple-touch-icon.png HTTP/1.1" 404 196
::1 - - [18/Dec/2019:06:17:28 +0100] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 196
```
`-e 'test'`: n'affiche que les lignes qui contiennent 'test'
```bash
$ multitail -ev "200" /usr/local/var/log/httpd/access_log
192.168.1.24 - - [30/Nov/2019:08:47:26 +0100] "GET /wordpress/wp-admin/plugins.php HTTP/1.1" 302 -
192.168.1.24 - - [30/Nov/2019:08:47:28 +0100] "GET /favicon.ico HTTP/1.1" 404 196
```
`-ev 'test'`: n'affiche que les autres lignes
### lnav
[lnav](http://lnav.org/) ([doc](https://lnav.readthedocs.io/en/latest/))
Installation:
```bash
$ brew install lnav
```

View File

@@ -139,6 +139,14 @@ $ dpkg --purge dpkg-verify
### Installer manuellement un paquet .spk
```bash
$ sudo synopkg install <package.spk>
```
### Apache:
#### Configuration:
@@ -382,6 +390,10 @@ Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoSta
### php7.3
### Composer:
<u>Installation:</u>
@@ -442,6 +454,90 @@ You are already using composer version 1.7.1 (stable channel).
### Gitea:
##### Créer le paquet:
[Gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk)
##### Installer le paquet:
```bash
cd ~/git/gitea-spk/
sudo synopkg install gitea-1.10.3-linux-amd64.spk
```
Créer un dossier partagé `gitea`, puis éditer les permissions du dossier:
Permissions -> Utilisateurs du système interne -> gitea lecture /écriture
##### Accéder au site:
http://localhost:3000 . Si Safari ne peut y accéder parce que la connexion n'est pas sécurisée (*HSTS Policy*):
1. `command + ,`
2. **Confidentialité** -> **Gérer les données de sites web**...
3. Chercher *localhost*
4. Clic **Supprimer**
DSM -> Portail des applications -> Proxy inversé
| | Source | Destination |
| ---------- | -------------------- | ----------- |
| Protocole | HTTPS | HTTP |
| Nom d'hôte | clicclac.synology.me | localhost |
| Port | 3001 | 3000 |
Apache:
```bash
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
```
Nginx:
```bash
server {
listen 80;
server_name git.example.com;
location / {
proxy_pass http://localhost:3000;
}
}
```
Le fichier de config: `/usr/local/gitea/gitea/custom/conf/app.ini`
`/etc/gitea/app.ini` sur le vps mbv
##### Créer un repo sur sur le serveur gitea:
Il est placé ici: `/volume1/gitea/gitea/gitea-repositories/bruno/test.git`
Sur le client, on clone le repo:
```bash
$ ~/Documents/Git git clone bruno@dsm916e:/volume1/gitea/gitea/gitea-repositories/bruno/test.git
```
git remote add origin bruno@dsm916e:/volume1/Repositories/wp2012.git
### Erreurs:
/bin/nano

View File

@@ -0,0 +1,72 @@
# DeezloaderRemix
[DeezloaderRemix](https://notabug.org/RemixDevs/DeezloaderRemix)
#### Installation:
```bash
$ git clone https://notabug.org/RemixDevs/DeezloaderRemix.git
$ cd ~/Documents/Git/DeezloaderRemix
$ npm install
$ npm start
```
#### Création de l'exécutable:
```bash
~/Documents/GitLab/DeezloaderRemix $ npm run dist:macOS
```
Une image .dmg et in fichier .zip sont crée dans `~/Documents/GitLab/DeezloaderRemix/dist`
```bash
~/Documents/GitLab/DeezloaderRemix $ open dist
```
Pour Linux et Windows:
```bash
~/Documents/GitLab/DeezloaderRemix $ npm npm run dist:linux
# dist/Deezloader_Remix_4.3.0-x86_64.AppImage
~/Documents/GitLab/DeezloaderRemix $ npm run dist:win64
# Parallels Desktop Windows doit être lancé et avoir fini de booter, avec Parallels Tools installés.
# W10 Configuration -> Options -> Sharing -> Share Mac -> Share folders -> All disks !!!
# Installeur
# dist/Deezloader Remix 4.3.0 Setup.exe
# Portable
# dist/Deezloader Remix 4.3.0.exe
```
Si erreur:
```bash
Error: Exit code: 2. Command failed: /usr/bin/perl /private/var/folders/35/tdnmp_0n43nfmr32h7m2b8kw0000gn/T/t-ImOBtT/1-dmgProperties.pl
Can't locate Mac/Memory.pm in @INC (you may need to install the Mac::Memory module) (@INC contains: /Users/bruno/perl5/lib/perl5/darwin-thread-multi-2lev
```
il faut mettre à jour electron-builder en version 21.2.0 mini
```
macos@10.15 needs electron-builder@21.2.0
electron-builder@21.2.0 needs node>=8.12
```
```bash
$ npm i electron-builder@latest -S
```

View File

@@ -28,6 +28,9 @@ $ brew cask uninstall qlvideo
```bash
$ brew search
# Avec descriptions
$ brew search --casks --desc ''
```
@@ -35,13 +38,19 @@ $ brew search
### Liste de tous les Casks disponibles à propos de Chrome:
```bash
$ brew cask search chrome
==> Partial Matches
chrome-devtools dmm-player-for-chrome google-chrome
chrome-remote-desktop-host epichrome mkchromecast
==> Remote Matches
caskroom/versions/google-chrome-canary caskroom/versions/google-chrome-dev
caskroom/versions/google-chrome-beta
$ brew search chrome
==> Formulae
chrome-cli chrome-export
==> Casks
chrome-devtools chromedriver dmm-player-for-chrome google-chrome google-chrome-canary mkchromecast
chrome-remote-desktop-host chromedriver-beta epichrome google-chrome-beta google-chrome-dev
$ brew search chromium
==> Casks
chromium eloston-chromium ✔ freesmug-chromium
```

View File

@@ -30,7 +30,7 @@
[Sécurité (Gatekeeper...)](securite.md)
[Calcul d'un checksum, md5, sha256…](md5.md)
[Calcul d'un checksum, md5, sha256…](terminal/md5.md)
[Touch ID](TouchID.md)

View File

@@ -88,7 +88,14 @@ jquery MISSING 3.2.1 3.2.1
livephotoskit 1.4.11 1.5.2 1.5.2
```
`npm outdated` montre plusieurs choses:
1. Current: la version actuelle du module.
2. Wanted: la dernière version qui satisfait le semver ranges decrit dans le package.json
3. Latest: la toutedernière version du module disponible sur npm.
<u>Mettre-à-jour:</u>
```bash
$ npm outdated | awk '{print $1}' | xargs npm update
```
@@ -105,6 +112,30 @@ Installer npm packages globalement => `/usr/local/lib/node_modules/`
#### npm verb outdated not updating @angular/cli because it's currently at the maximum version that matches its specified semver range:
[Stackoverflow](https://stackoverflow.com/questions/39758042/npm-update-does-not-do-anything) [semver range](https://docs.npmjs.com/misc/semver#advanced-range-syntax)
```bash
$ npm update -g --verbose @angular/cli
npm verb outdated not updating rxjs because it's currently at the maximum version that matches its specified semver range
```
#### Plus info sur une commande:
```bash
# Mode verbose:
$ npm update -g --verbose
# Exécute la commande sans rien installer:
$ npm install -g --dry-run
```
#### Aller dans node_modules:

View File

@@ -94,10 +94,12 @@ Mettre à jour NodeJS et réinstaller les paquets.
```bash
Latest version:
nvm install node --reinstall-packages-from=node
# nvm install node && nvm reinstall-packages $(nvm current)
Stable (LTS) version:
nvm install lts/* --reinstall-packages-from=node
# nvm install node --reinstall-packages-from=$(nvm current)
# nvm install --lts=erbium && nvm reinstall-packages $(nvm current)
# nvm install --lts=erbium && nvm reinstall-packages 12.13.1
```
Liste des versions de Node installées:

View File

@@ -0,0 +1,540 @@
# Installer Perl
macOS Catalina est livré avec Perl:
```bash
$ which perl
/usr/bin/perl
$ perl -v
This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
```
### Homebrew:
On peut installer une version plus récente de Perl avec Homebrew:
```bash
$ brew install perl
```
```bash
$ brew info perl
zsh: correct 'perl' to 'perl5' [nyae]? n
perl: stable 5.30.0 (bottled), HEAD
Highly capable, feature-rich programming language
https://www.perl.org/
/usr/local/Cellar/perl/5.30.0 (2,440 files, 61.8MB) *
Poured from bottle on 2019-08-04 at 13:32:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/perl.rb
==> Options
--HEAD
Install HEAD version
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.
You can set that up like this:
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.zshrc
```
```bash
$ which perl
/usr/local/bin/perl
$ perl -v
This is perl 5, version 30, subversion 0 (v5.30.0) built for darwin-thread-multi-2level
Copyright 1987-2019, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
```
#### cpan:
**cpan** gère les modules Perl.
```bash
$ cpan
Loading internal logger. Log::Log4perl recommended for better logging
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes] yes
Autoconfiguration complete.
commit: wrote '/Users/bruno/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.
To fix enter> install Term::ReadLine::Perl
cpan shell -- CPAN exploration and modules installation (v2.22)
Enter 'h' for help.
```
Sans argument, la commande **cpan** ouvre un shell:
```bash
$ cpan
Loading internal logger. Log::Log4perl recommended for better logging
cpan shell -- CPAN exploration and modules installation (v2.27)
Enter 'h' for help.
cpan[1]> h
```
```bash
cpan[1]> h
Display Information (ver 2.27)
command argument description
a,b,d,m WORD or /REGEXP/ about authors, bundles, distributions, modules
i WORD or /REGEXP/ about any of the above
ls AUTHOR or GLOB about files in the author's directory
(with WORD being a module, bundle or author name or a distribution
name of the form AUTHOR/DISTRIBUTION)
Download, Test, Make, Install...
get download clean make clean
make make (implies get) look open subshell in dist directory
test make test (implies make) readme display these README files
install make install (implies test) perldoc display POD documentation
Upgrade installed modules
r WORDs or /REGEXP/ or NONE report updates for some/matching/all
upgrade WORDs or /REGEXP/ or NONE upgrade some/matching/all modules
Pragmas
force CMD try hard to do command fforce CMD try harder
notest CMD skip testing
Other
h,? display this menu ! perl-code eval a perl command
o conf [opt] set and query options q quit the cpan shell
reload cpan load CPAN.pm again reload index load newer indices
autobundle Snapshot recent latest CPAN uploads
```
La commande **cpan** peut aussi s'utiliser avec arguments:
Avec <u>Perl installé via homebrew</u>, les modules sont installés dans Cellar (`Installing /usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0/CPAN/DistnameInfo.pm`). Ils sont donc perdu à chaque mise-à-jour de Perl.
Il est donc conseillé d'utiliser `local::lib`
```bash
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.zshrc
# les dossiers suivants sont crées:
# $HOME/perl5/bin/
# $HOME/perl5/lib/
#
# à côté de $HOME/perl5/perlbrew/
```
Les modules sont alors installés ici `Installing /Users/bruno/perl5/lib/perl5/Log/Log4perl.pm`
##### Info sur un module: `cpan -D <module>`
```bash
$ cpan -D CPAN::DistnameInfo
Reading '/Users/bruno/.cpan/Metadata'
Database was generated on Tue, 17 Dec 2019 07:29:02 GMT
CPAN::DistnameInfo
-------------------------------------------------------------------------
CPAN: Module::CoreList loaded ok (v5.20190522)
(no description)
G/GB/GBARR/CPAN-DistnameInfo-0.12.tar.gz
/usr/local/Cellar/perl/5.30.0/lib/perl5/site_perl/5.30.0/CPAN/DistnameInfo.pm
Installed: 0.12
CPAN: 0.12 up to date
Graham Barr (GBARR)
gbarr@pobox.com
```
##### Liste des modules installés: `cpan -l`
```bash
$ cpan -l
Spiffy 0.46
YAML 1.29
CPAN::DistnameInfo 0.12
App::pmuninstall 0.30
Test::YAML 1.07
```
##### Désintaller un module:
Il n'y a pas de commande prévue pour ça.
On peut installer [pmuninstall](https://github.com/xaicron/pm-uninstall).
```bash
$ cpan -i App::pmuninstall
```
Puis pour désinstaller:
```bash
$ pm-uninstall -v App::cpnaminus
```
##### Modules mis-à-jour:
On peut installer [cpanoutdated](https://github.com/tokuhirom/cpan-outdated)
```bash
$ cpan -i App::cpanoutdated
```
et voir les modules 'outdated'
```bash
$ cpan-outdated -p
Compress::Raw::Bzip2
Compress::Raw::Zlib
Compress::Zlib
DB_File
$ cpan-outdated
P/PM/PMQS/Compress-Raw-Bzip2-2.093.tar.gz
P/PM/PMQS/Compress-Raw-Zlib-2.093.tar.gz
P/PM/PMQS/IO-Compress-2.093.tar.gz
P/PM/PMQS/DB_File-1.852.tar.gz
```
Il est recommandé d'installer les modules suivants:
- Term::ReadLine::Perl (réclamé par le shell cpan)
- CPAN::DistnameInfo (réclamé par l'installeur de module)
- Log::Log4perl
### PerlBrew:
On peut installer d'autres versions de Perl avec [PerlBrew](https://perlbrew.pl).
Il faut au préalable installer **berkeley-db**, sans quoi il y aura une erreur à l'installer de Perl avec perlbrew.
```bash
$ brew install berkeley-db
```
#### Installation de perlbrew:
```bash
$ curl -L https://install.perlbrew.pl | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 170 100 170 0 0 245 0 --:--:-- --:--:-- --:--:-- 245
100 1554 100 1554 0 0 1935 0 --:--:-- --:--:-- --:--:-- 1935
## Download the latest perlbrew
## Installing perlbrew
Using Perl </usr/bin/perl>
perlbrew is installed: ~/perl5/perlbrew/bin/perlbrew
perlbrew root (~/perl5/perlbrew) is initialized.
Append the following piece of code to the end of your ~/.bash_profile and start a
new shell, perlbrew should be up and fully functional from there:
source ~/perl5/perlbrew/etc/bashrc
Simply run `perlbrew` for usage details.
Happy brewing!
## Installing patchperl
## Done.
```
Pour zsh, on ajoute la ligne suivant à `.zshenv`
```bash
source /Users/bruno/perl5/perlbrew/etc/bashrc
```
##### Puis on installe la version de Perl que l'on veux:
```bash
# Installer la dernière version de Perl:
$ perlbrew install [options] stable
# Installer une version précise de Perl:
$ perlbrew install [options] 5.x.xx
```
##### Liste des versions de Perl installées (dans $PERLBREW_ROOT):
```bash
$ perlbrew list
perl-5.30.1
```
##### On choisit la version que l'on veut utiliser:
```bash
$ perlbrew use 5.30.1
--------------------------------------------------------------------------------
WARNING: zsh perlbrew sub-shell is not working on Mac OSX Lion.
It is known that on MacOS Lion, zsh always resets the value of PATH on launching
a sub-shell. Effectively nullify the changes required by perlbrew sub-shell. You
may `echo $PATH` to examine it and if you see perlbrew related paths are in the
end, instead of in the beginning, you are unfortunate.
You are advised to include the following line to your ~/.zshenv as a better
way to work with perlbrew:
source /Users/bruno/perl5/perlbrew/etc/bashrc
--------------------------------------------------------------------------------
A sub-shell is launched with 5.30.1 as the activated perl. Run 'exit' to finish it.
silverbook%
```
Pour bash, on ajoute `source ~/perl5/perlbrew/etc/bashrc` au *~/.bash_profile*.
Pour zsh, on ajoute `source /Users/bruno/perl5/perlbrew/etc/bashrc` au *~/.zshenv*.
##### Choisir la version de Perl dans le shell courant:
```bash
# perlbrew use [perl-<version> | <version> | <name>]
$ perlbrew use 5.30.1
$ which perl
/Users/bruno/perl5/perlbrew/perls/perl-5.30.1/bin/perl
$ perl -v
This is perl 5, version 30, subversion 1 (v5.30.1) built for darwin-2level
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2019, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
```
##### Afficher la version courante de Perl:
```bash
$ perlbrew use
Currently using perl-5.30.1
```
##### Changer de version de Perl pour le shell courant et les futures sessions:
```bash
# perlbrew switch [ <name> ]
$ perlbrew switch perl-5.30.1
# sans paramètre, affiche la version courante
$ perlbrew switch
Currently switched to perl-5.30.1
```
##### Désactiver temporairement perlbrew (dans le shell courant):
```bash
# et reactiver le Perl par défaut
$ perlbrew off
```
##### Désactiver perlbrew:
```bash
# et reactiver le Perl par défaut
$ perlbrew switch-off
# pour réactiver perlbrew
$ perlbrew switch
```
##### Créer un alias:
```bash
$ perlbrew alias [-f] create <name> <alias>
$ perlbrew alias [-f] rename <old_alias> <new_alias>
$ perlbrew alias delete <alias>
```
##### Exécuter une commande pour chaque version de Perl installée:
```bash
$ perlbrew exec perl -e 'print "Hello from $]\n"'
$ perlbrew exec --with perl-5.12,perl-5.12-debug,perl-5.14.2
```
##### Variables d'environnement:
```bash
$ perlbrew env
unset PERLBREW_MANPATH
export PERLBREW_PATH="/Users/bruno/perl5/perlbrew/bin"
unset PERLBREW_PERL
export PERLBREW_ROOT="/Users/bruno/perl5/perlbrew"
export PERLBREW_VERSION="0.87"
```
##### Installer cpanm:
```bash
$ perlbrew install-cpanm
```
##### Mettre à jour perlbrew:
```bash
$ perlbrew self-upgrade
```
##### Nettoyer les dossier d'installation et les archives:
```bash
$ perlbrew clean
Removing /Users/bruno/perl5/perlbrew/build/perl-5.30.1
Removing /Users/bruno/perl5/perlbrew/dists/perl-5.30.1.tar.gz
Done
```
##### Afficher la version de perlbrew:
```bash
$ perlbrew version
/Users/bruno/perl5/perlbrew/bin/perlbrew - App::perlbrew/0.87
```
##### Mettre à jour Perl:
```bash
# met à jour les versions mineurs (5.14.0 -> 5.14.2)
$ perlbrew upgrade-perl
```
##### Télécharger Perl:
```bash
# télécharger l'archive Perl
$ perlbrew download perl-5.17.3
```
##### Liste des modules:
```bash
$ perlbrew list-modules
Modern::Perl
```
##### Cloner les modules entre 2 versions de Perl:
```bash
# perlbrew clone-modules <src_version> <dst_version>
$ perlbrew clone-modules 5.26.1 5.27.7
```
#### Installer des modules:
Avec perlbrew, on utilise **cpanm**:
```bash
$ cpanm Modern::Perl
--> Working on Modern::Perl
Fetching http://www.cpan.org/authors/id/C/CH/CHROMATIC/Modern-Perl-1.20190727.tar.gz ... OK
Configuring Modern-Perl-1.20190727 ... OK
Building and testing Modern-Perl-1.20190727 ... OK
Successfully installed Modern-Perl-1.20190727
1 distribution installed
```
Les modules sont installés ici:
```
/System/Volumes/Data/Users/bruno/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/.meta/Modern-Perl-1.20190727
/System/Volumes/Data/Users/bruno/.cpanm/work/1576489302.28593/Modern-Perl-1.20190727
```
##### Mise-à-jour de cpanm:
```bash
$ cpanm --self-upgrade
It appears your cpanm executable was installed via `perlbrew install-cpanm`.
cpanm --self-upgrade won't upgrade the version of cpanm you're running.
Run the following command to get it upgraded.
perlbrew install-cpanm
```
##### N° de version:
```bash
$ cpanm --V
cpanm (App::cpanminus) 1.7044 on perl 5.030000 built for darwin-thread-multi-2level
Work directory is /Users/bruno/.cpanm/work/1576565969.69495
You have make /usr/bin/make
You have /usr/local/bin/wget
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
```

4
docs/macos/perl/perl.md Normal file
View File

@@ -0,0 +1,4 @@
# Perl

287
docs/macos/python/conda.md Normal file
View File

@@ -0,0 +1,287 @@
# conda
**conda** est le gestionnaire de paquet et d'environnement fourni avec Anaconda.
**miniconda** est l'installateur de conda. Il installe conda, Python et les paquets de base.
### Installer conda:
2 façons (miniconda ou anaconda):
1. Télécharger [miniconda](https://docs.conda.io/en/latest/miniconda.html) puis
```bash
$ bash Miniconda3-latest-MacOSX-x86_64.sh
```
2. Télécharger [anaconda](https://www.anaconda.com/distribution/) puis double-cliquer sur le .pkg
##### conda init
Initialize conda for shell interaction. (nécessaire pour les commandes `conda activate` et `conda deactivate` )
Shell bash:
```bash
$ conda init
```
Ajoute au .bash_profile:
```bash
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/bruno/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/bruno/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/bruno/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/bruno/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
```
Shell zsh:
```bash
$ conda init zsh
```
Ajoute au .zshrc
```bash
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/bruno/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/bruno/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/bruno/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/bruno/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
```
##### conda init --reverse
Dé-initialise conda
```bash
$ conda init --reverse # bash
```
```bash
$ conda init zsh --reverse # zsh
```
Ajouter miniconda3 au $PATH
```bash
export PATH="$HOME/miniconda3/bin:$PATH"
$ which python
/Users/bruno/miniconda3/bin/python
# export PATH="$HOME/miniconda3/bin:$PATH"
$ which python
/usr/local/bin/python
```
### Mettre à jour conda:
```bash
$ conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /Users/bruno/miniconda3
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
cffi-1.13.2 | py37hb5b8e2f_0 218 KB
setuptools-41.6.0 | py37_0 641 KB
six-1.13.0 | py37_0 26 KB
sqlite-3.30.1 | ha441bb4_0 2.4 MB
tqdm-4.38.0 | py_0 51 KB
------------------------------------------------------------
Total: 3.3 MB
The following packages will be UPDATED:
cffi 1.13.0-py37hb5b8e2f_0 --> 1.13.2-py37hb5b8e2f_0
setuptools 41.4.0-py37_0 --> 41.6.0-py37_0
six 1.12.0-py37_0 --> 1.13.0-py37_0
sqlite 3.30.0-ha441bb4_0 --> 3.30.1-ha441bb4_0
tqdm 4.36.1-py_0 --> 4.38.0-py_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
six-1.13.0 | 26 KB | ##################################################################################################### | 100%
sqlite-3.30.1 | 2.4 MB | ##################################################################################################### | 100%
cffi-1.13.2 | 218 KB | ##################################################################################################### | 100%
tqdm-4.38.0 | 51 KB | ##################################################################################################### | 100%
setuptools-41.6.0 | 641 KB | ##################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
```
### Installer une application:
Par exemple, [Spleeter](https://github.com/deezer/spleeter)
```bash
$ git clone https://github.com/Deezer/spleeter
$ conda env create -f spleeter/conda/spleeter-cpu.yaml
$ conda activate spleeter-cpu
$ spleeter separate -i spleeter/audio_example.mp3 -p spleeter:2stems -o output
$ conda deactivate
```
##### Lister les paquets installés:
```bash
$ conda list
# packages in environment at /Users/bruno/miniconda3:
#
# Name Version Build Channel
asn1crypto 1.2.0 py37_0
ca-certificates 2019.10.16 0
certifi 2019.9.11 py37_0
cffi 1.13.2 py37hb5b8e2f_0
chardet 3.0.4 py37_1003
conda 4.7.12 py37_0
...
six 1.13.0 py37_0
sqlite 3.30.1 ha441bb4_0
```
Dans l'environnement spleeter-cpu:
```bash
$ conda list -n spleeter-cpu
# packages in environment at /Users/bruno/miniconda3/envs/spleeter-cpu:
#
# Name Version Build Channel
_tflow_select 2.3.0 mkl anaconda
absl-py 0.8.1 py37_0 conda-forge
...
setuptools 41.6.0 py37_1 conda-forge
simplejson 3.17.0 pypi_0 pypi
six 1.13.0 py37_0 conda-forge
soundfile 0.10.2 pypi_0 pypi
spleeter 1.4.3 pypi_0 pypi
sqlite 3.30.1 h93121df_0 conda-forge
```
##### Mettre à jour un paquet:
```bash
$ conda update six
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
```
```bash
$ conda update -n spleeter-cpu spleeter
```
##### Mettre à jour tous les paquets:
```bash
$ conda update --all
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.12
latest version: 4.8.0rc0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /Users/bruno/miniconda3
The following packages will be downloaded:
package | build
---------------------------|-----------------
python-3.7.5 | h359304d_0 18.1 MB
------------------------------------------------------------
Total: 18.1 MB
The following packages will be UPDATED:
python 3.7.4-h359304d_1 --> 3.7.5-h359304d_0
Proceed ([y]/n)? n
```

View File

@@ -91,30 +91,31 @@ $ jupyter notebook
#### Mkdocs
Mkdocs si'installe dans `/usr/local/bin` :
Il faut installer Mkdocs avec pip dans --user
```bash
bruno@silverbook:/usr/local/bin$ ./mkdocs --version
mkdocs, version 0.17.2
$ pip3 install --user mkdocs
```
Par défaut, c'est **mkdocs** installé avec Python 2 (macOS) qui se lance.
Pour utiliser **mkdocs** installé pour Python 3 (Homebrew):
Mkdocs s'installe dans `'/Users/bruno/Library/Python/3.7/bin'` :
```bash
bruno@silverbook:~/project$ /usr/local/bin/mkdocs serve
~/Library/Python/3.7/bin$ ./mkdocs --version
mkdocs, version 1.0.4 from /Users/bruno/Library/Python/3.7/lib/python/site-packages/mkdocs (Python 3.7)
```
On peut ajouter le chemin au $PATH, en ajoutant la ligne suivante au .zshrc ou .bash_profile:
```bash
export PATH=/Users/bruno/Library/Python/3.7/bin:$PATH
```
Par comparaison, les extensions Python 2 s'installent dans `/Library/Python/2.7/site-packages/`
**Mkdocs** si'installe dans `~/Library/Python/2.7/bin` :
On installe de la même manière le thème [Material](https://squidfunk.github.io/mkdocs-material/getting-started/):
```bash
bruno@silverbook:~/Library/Python/2.7/bin$ ./mkdocs --version
mkdocs, version 0.17.2
$ pip3 install --user mkdocs-material
```

242
docs/macos/ruby.md Normal file
View File

@@ -0,0 +1,242 @@
# Ruby
### Installation de ruby
#### Mettre à jour Ruby (avec homebrew):
```bash
$ which ruby
/usr/bin/ruby
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ brew install ruby
$ echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
$ which ruby
/usr/local/opt/ruby/bin/ruby
$ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
```
#### Ajouter au $PATH (.zshrc):
```bash
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH=/Users/bruno/.gem/ruby/2.6.0/bin:$PATH
```
#### Aide:
```bash
$ gem help examples
Some examples of 'gem' usage.
```
```bash
$ gem help commands
GEM commands are:
build Build a gem from a gemspec
cert Manage RubyGems certificates and signing settings
check Check a gem repository for added or missing files
cleanup Clean up old versions of installed gems
contents Display the contents of the installed gems
dependency Show the dependencies of an installed gem
environment Display information about the RubyGems environment
fetch Download a gem and place it in the current directory
generate_index Generates the index files for a gem server directory
help Provide help on the 'gem' command
info Show information for the given gem
install Install a gem into the local repository
list Display local gems whose name matches REGEXP
lock Generate a lockdown list of gems
manpages Handling manpages in gems
mirror Mirror all gem files (requires rubygems-mirror)
open Open gem sources in editor
outdated Display all gems that need updates
owner Manage gem owners of a gem on the push server
pristine Restores installed gems to pristine condition from files
located in the gem cache
push Push a gem up to the gem server
query Query gem information in local or remote repositories
rdoc Generates RDoc for pre-installed gems
search Display remote gems whose name matches REGEXP
server Documentation and gem repository HTTP server
signin Sign in to any gemcutter-compatible host. It defaults to
https://rubygems.org
signout Sign out from all the current sessions.
sources Manage the sources and cache file RubyGems uses to search
for gems
specification Display gem specification (in yaml)
stale List gems along with access times
uninstall Uninstall gems from the local repository
unpack Unpack an installed gem to the current directory
update Update installed gems to the latest version
which Find the location of a library file you can require
yank Remove a pushed gem from the index
For help on a particular command, use 'gem help COMMAND'.
```
#### Environnment:
```bash
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.6
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin19]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/bruno/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/bruno/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-19
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/bruno/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/bruno/.nvm/versions/node/v12.13.0/bin
- /Users/bruno/Documents/Scripts
- /Users/bruno/.gem/ruby/2.6.0/bin
- /usr/local/opt/ruby/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/TeX/texbin
- /usr/local/MacGPG2/bin
- /opt/X11/bin
$ gem environment gemdir
/usr/local/lib/ruby/gems/2.6.0
$ gem environment gempath
/Users/bruno/.gem/ruby/2.6.0:/usr/local/lib/ruby/gems/2.6.0:/usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
```
### Gem
#### Installer un gem:
```bash
$ gem install color_echo
Fetching color_echo-3.1.1.gem
Thank you for installing! =(^x^=
See also http://colorecho.github.io
Successfully installed color_echo-3.1.1
Parsing documentation for color_echo-3.1.1
Installing ri documentation for color_echo-3.1.1
Done installing documentation for color_echo after 0 seconds
1 gem installed
# Installer une version spécifique:
$ gem install color_echo -v 3.1.0
```
#### Installer un gem en local:
```bash
$ gem install colorls --user-install
```
#### Mettre à jour un gem:
```bash
$ gem update colorls
Updating installed gems
```
#### Mettre à jour tous les gems:
```bash
$ gem update
Updating installed gems
```
La mise-à-jour ne supprime pas les anciennes versions. Utiliser la commande *cleanup* .
#### Liste des gems installés:
```bash
$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.4.1)
bundler (default: 1.17.3)
clocale (0.0.4)
...
```
#### Où un gem est installé:
```bash
# installé avec gem install colorls --user-install
$ gem list -d colorls
*** LOCAL GEMS ***
colorls (1.2.0)
Author: Athitya Kumar
Homepage: https://github.com/athityakumar/colorls
License: MIT
Installed at: /Users/bruno/.gem/ruby/2.6.0
A Ruby CLI gem that beautifies the terminal's ls command, with color
and font-awesome icons.
```
```bash
# installé avec gem install martilla
$ gem list -d martilla
*** LOCAL GEMS ***
martilla (0.4.0)
Author: Fernando Valverde
Homepage: https://github.com/fdoxyz/martilla
License: MIT
Installed at: /usr/local/lib/ruby/gems/2.6.0
Easy to configure backup tool for simple everyday use
```
```bash
$ gem which martilla
/usr/local/lib/ruby/gems/2.6.0/gems/martilla-0.4.0/lib/martilla.rb
```

View File

@@ -2,7 +2,7 @@
Il faut installer **md5deep** (Recursively compute digests on files/directories) avec [homebrew](homebrew/brew.md).
Il faut installer **md5deep** (Recursively compute digests on files/directories) avec [homebrew](../homebrew/brew.md).
Le paquet contient hash deep, md5deep, sha1deep, sha256deep, tigerdeep, whirlpooldeep.

View File

@@ -0,0 +1,51 @@
# open
Montrer les fichiers dans le Finder:
```bash
$ open -R chrono.sh
```
Ouvrir un dossier dans le Finder:
```bash
$ open /etc
```
Ouvrir le dossier courrant dans le Finder:
```bash
~/Documents/Scripts/kymsu2 master*
$ open .
```
Ouvrir README.md avec TextEdit:
```bash
$ open -e README.md
$ open -e *.md
```
Spécifier l'application (Typora) pour ouvrir README.md:
```bash
$ open -a Typora README.md
```
```bash
```

View File

@@ -0,0 +1,16 @@
# shebang
Le shebang `#!/usr/bin/perl` indique à Bash (ou zsh...) que le script est en Perl et que l'exécutable se trouve à /usr/bin/perl
On pourrait avoir un autre shebang comme `#!/opt/perl-5.18.2/bin/perl` pour une autre version de Perl.
Avec un shebang et le bit exécutable, le script lancé par `./myscript.pl` ou `myscript.pl` est exécuté avec la
version de Perl indiquée dans le shebang.
Si il est lancé par `perl myscript.pl`, il est exécuté par la 1ere version de Perl trouvée dans $PATH (qui peut être différent de celle du shebang)
On peut aussi utiliser un shebang comme `#!/usr/bin/env perl`
Dans ce cas, Bash commence par exécuter la commande `env` avec l'argument env pour trouver la 1ere version de Perl dans le PATH. C'est cette version qui sera dans tous les cas (`./myscript.pl` ou `perl myscript.pl`) utilisée.

View File

@@ -0,0 +1,66 @@
# Terminal
##### Ouvrir une page man dans un fenêtre spécifique:
```bash
$ open x-man-page://ls
# fonction:
function xmanpage() { open x-man-page://$@ ; }
```
##### Ouvrir une page man dans Aperçu:
```bash
$ man -t ls | open -f -a "Preview"
# fonction:
function preman() { man -t "$@" | open -f -a "Preview" ;}
```
##### Obtenir le chemin de la fenêtre courante du Finder:
```bash
$ osascript -e 'tell app "Finder" to get posix path of ((target of window 1) as alias)'
/Users/bruno/.kymsu/plugins.d/
```
```bash
# fonction:
# prints the path of the front Finder window. Desktop if no window open
function pwdf () {
osascript <<EOS
tell application "Finder"
if (count of Finder windows) is 0 then
set dir to (desktop as alias)
else
set dir to ((target of Finder window 1) as alias)
end if
return POSIX path of dir
end tell
EOS
}
# changes directory to frontmost Finder window
alias cdf='pwdf; cd "$(pwdf)"'
```
#### Raccourcis:
Aller en début de ligne: `CTRL+A`
Aller en fin de ligne: `CTRL+E`
Déplacer le curseur: `OPTION+clic`
Supprimer du curseur jusqu'à la fin de ligne: `CTRL+K`
Coller les texte supprimer: `CTRL+Y`
Supprimer le mot précédent: `CTRL+W`
Rechercher dans l'historique: `CTRL+R`

View File

@@ -65,11 +65,11 @@ Not installed
$ brew search php73
```
#### Installer des extensions:
#### Installer des extensions (avec [PECL](https://pecl.php.net)):
Elles s'installent via [PECL](https://pecl.php.net) (requiert autoconf, `brew install autoconf`).
Requiert autoconf: `brew install autoconf`
- ```bash
```bash
$ pecl uninstall -r xdebug
$ pecl install xdebug
@@ -81,7 +81,7 @@ Elles s'installent via [PECL](https://pecl.php.net) (requiert autoconf, `brew in
# Pour une version spécifique:
$ pecl install xdebug-2.7.0beta1
```
```
Pour les activer, créez un fichier de configuration dans `/usr/local/etc/php/7.3/conf.d/`
@@ -106,9 +106,11 @@ xdebug.remote_port=9000
```
#### Installer l'extension ssh2:
#### Installer une extension (depuis les sources):
```bash
# Installation de ssh2:
$ brew install libssh2
$ cd ~/Downloads
@@ -126,6 +128,18 @@ Ajouter au fichier:
extension="ssh2.so"
```
```bash
# Installation de xdebug:
$ wget http://xdebug.org/files/xdebug-x.x.x.tgz
$ tar -xzvf xdebug-x.x.x.tgz
$ cd xdebug-x.x.x
$ phpize
$ ./configure
$ make
$ make install
```
### Erreurs: