MaJ du 04-02-2021

This commit is contained in:
2021-02-04 09:55:26 +01:00
parent 84b4e1a85d
commit fb07a20b0c
56 changed files with 4962 additions and 95 deletions

View File

@@ -375,3 +375,28 @@ eloston-chromium
https://github.com/toland/qlmarkdown/issues/89
### Query:
Liste des casks avec 'auto_updates' à true:
```bash
$ brew info --installed --cask --json=v2 | jq -r '{casks} | .[] | .[] | select(.auto_updates == true) | (.name, .token, .version, .auto_updates)'
```
Info sur le cask 'onyx':
```bash
$ brew info --installed --cask --json=v2 | jq -r '{casks} | .[] | .[] | select(.token == "onyx") | (.name, .token, .version, .auto_updates)'
$ a="onyx"
$ brew info --installed --cask --json=v2 | jq -r '{casks} | .[] | .[] | select(.token == "'${a}'") | (.name, .token, .version, .auto_updates)'
```
Info (version) sur le paquet 'fzf':
```bash
$ brew info --installed --json=v2 | jq -r '{formulae} | .[] | .[] | select(.name == "fzf") | (.installed)' | jq -r '.[].version'
```

View File

@@ -827,6 +827,18 @@ ls: illegal option -- -
ls (GNU coreutils) 8.31
```
Utiliser date ou gdate:
```bash
gnudate() {
if hash gdate 2>/dev/null; then
gdate "$@"
else
date "$@"
fi
}
```
#### findutils (GNU Tools)

View File

@@ -145,7 +145,7 @@ bruno@SilverBook:~$ cd Sites/node_modules/
puis
- Liste package installé: `npm ls`
- Liste package installé: `npm ls` `npm list -g --depth=0`
- Mises à jour disponibles: `npm outdated`
- Installer une m-à-j: `npm update`
- Installer un package: `npm install package`
@@ -251,10 +251,70 @@ npm config set fund false
#### Erreur *"No matching version found for tar@^6.0.5"*:
```bash
$ npm install -g --unsafe-perm homebridge-config-ui-x
npm ERR! code ETARGET
npm ERR! notarget No matching version found for tar@^6.0.5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
```
```bash
$ npm info tar
tar@6.0.5 | ISC | deps: 6 | versions: 88
tar for node
https://github.com/npm/node-tar#readme
dist
.tarball: https://registry.npmjs.org/tar/-/tar-6.0.5.tgz
```
```bash
$ npm install https://github.com/npm/node-tar/tarball/v6.0.5 --save
npm ERR! code ETARGET
npm ERR! notarget No matching version found for minizlib@^2.1.1.
```
```bash
$ npm info minizlib
minizlib@2.1.2 | MIT | deps: 2 | versions: 20
A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.
https://github.com/isaacs/minizlib#readme
```
```bash
$ npm install https://github.com/isaacs/minizlib/tarball/v2.1.1 --save
```
```bash
$ npm install https://github.com/npm/node-tar/tarball/v6.0.5 --save
```
```bash
$ npm install -g --unsafe-perm homebridge-config-ui-x
added 362 packages, and audited 362 packages in 45s
```
#### Packages:
[Rechercher un package](https://npms.io)
```bash
$ npm search tar
NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS
tar | tar for node | =nlf… | 2020-08-14 | 6.0.5 |
tar-fs | filesystem bindings… | =mafintosh… | 2020-11-06 | 2.1.1 | tar fs file tarball directory stream
tar-stream | tar-stream is a… | =mafintosh… | 2020-09-10 | 2.1.4 | tar tarball parse parser generate generator stream stream2 streams streams2 str
archiver | a streaming… | =ctalkington | 2020-09-11 | 5.0.2 | archive archiver stream zip tar
```
##### uninstall-all-modules

216
docs/macos/node/nodeenv.md Normal file
View File

@@ -0,0 +1,216 @@
# nodeenv
https://github.com/ekalinin/nodeenv
### Installation locale:
On peut installer dans un environnement virtuel Python (virtualenv ou venv).
```bash
~/Documents/nodeenv master* ⇡
python3 -m venv homebridge
~/Documents/nodeenv master* ⇡
source homebridge/bin/activate
~/Documents/nodeenv master* ⇡
homebridge pip3 install -U pip setuptools
~/Documents/nodeenv master* ⇡ 7s
homebridge pip3 install nodeenv
~/Documents/nodeenv master* ⇡
cd homebridge/bin
total 48
-rw-r--r-- 1 bruno staff 8471 Nov 8 20:52 Activate.ps1
-rw-r--r-- 1 bruno staff 2233 Nov 8 20:52 activate
-rw-r--r-- 1 bruno staff 1285 Nov 8 20:52 activate.csh
-rw-r--r-- 1 bruno staff 2437 Nov 8 20:52 activate.fish
-rwxr-xr-x 1 bruno staff 270 Nov 8 20:53 easy_install
-rwxr-xr-x 1 bruno staff 270 Nov 8 20:53 easy_install-3.8
-rwxr-xr-x 1 bruno staff 243 Nov 8 20:54 nodeenv
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip3
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip3.8
lrwxr-xr-x 1 bruno staff 7 Nov 8 20:52 python -> python3
lrwxr-xr-x 1 bruno staff 58 Nov 8 20:52 python3 -> /Applications/Xcode.app/Contents/Developer/usr/bin/python3
```
Pour connaître les versions de node disponibles:
```bash
~/Documents/nodeenv/homebridge master* ⇡ 9s
nodeenv --list
0.1.14 0.1.15 0.1.16 0.1.17 0.1.18 0.1.19 0.1.20 0.1.21
...
14.11.0 14.12.0 14.13.0 14.13.1 14.14.0 14.15.0 15.0.0 15.0.1
15.1.0
```
On installe node:
```bash
~/Documents/nodeenv master* ⇡
homebridge nodeenv -p --node=14.15.0 env
* Install prebuilt node (14.15.0) ..... done.
~/Documents/nodeenv master* ⇡
homebridge node -v
v14.15.0
~/Documents/nodeenv/homebridge/bin master* ⇡ 11s
l
total 72364
-rw-r--r-- 1 bruno staff 8471 Nov 8 20:52 Activate.ps1
-rw-r--r-- 1 bruno staff 6115 Nov 8 21:03 activate
-rw-r--r-- 1 bruno staff 1285 Nov 8 20:52 activate.csh
-rw-r--r-- 1 bruno staff 6627 Nov 8 21:03 activate.fish
-rwxr-xr-x 1 bruno staff 270 Nov 8 20:53 easy_install
-rwxr-xr-x 1 bruno staff 270 Nov 8 20:53 easy_install-3.8
-rwxr-xr-x 1 bruno staff 74032864 Oct 27 12:44 node
-rwxr-xr-x 1 bruno staff 243 Nov 8 20:54 nodeenv
lrwxr-xr-x 1 bruno staff 4 Nov 8 21:03 nodejs -> node
lrwxr-xr-x 1 bruno staff 38 Nov 8 21:03 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 bruno staff 38 Nov 8 21:03 npx -> ../lib/node_modules/npm/bin/npx-cli.js
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip3
-rwxr-xr-x 1 bruno staff 261 Nov 8 20:53 pip3.8
-rw-r--r-- 1 bruno staff 65 Nov 8 21:03 predeactivate
lrwxr-xr-x 1 bruno staff 7 Nov 8 20:52 python -> python3
lrwxr-xr-x 1 bruno staff 58 Nov 8 20:52 python3 -> /Applications/Xcode.app/Contents/Developer/usr/bin/python3
-rwxr-xr-x 1 bruno staff 299 Nov 8 21:03 shim
```
On installe l'application:
```bash
~/Documents/nodeenv master* ⇡
homebridge npm install -g --unsafe-perm homebridge
~/Documents/nodeenv/env/bin master* ⇡
homebridge npm install -g --unsafe-perm homebridge-config-ui-x
~/Documents/nodeenv/env/bin master* ⇡
homebridge npm install -g --unsafe-perm homebridge-samsung-tizen
~/Documents/nodeenv/env/bin master* ⇡
homebridge npm install -g --unsafe-perm homebridge-sonos
~/Documents/nodeenv/env/bin master* ⇡
homebridge l
total 72312
-rwxr-xr-x 1 bruno staff 3653 Nov 9 07:52 activate
-rwxr-xr-x 1 bruno staff 3970 Nov 9 07:52 activate.fish
lrwxr-xr-x 1 bruno staff 65 Nov 9 08:07 hb-service -> ../lib/node_modules/homebridge-config-ui-x/dist/bin/hb-service.js
lrwxr-xr-x 1 bruno staff 45 Nov 9 08:05 homebridge -> ../lib/node_modules/homebridge/bin/homebridge
lrwxr-xr-x 1 bruno staff 65 Nov 9 08:07 homebridge-config-ui-x -> ../lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js
-rwxr-xr-x 1 bruno staff 74032864 Oct 27 12:44 node
lrwxr-xr-x 1 bruno staff 4 Nov 9 07:52 nodejs -> node
lrwxr-xr-x 1 bruno staff 38 Nov 9 07:52 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 bruno staff 38 Nov 9 07:52 npx -> ../lib/node_modules/npm/bin/npx-cli.js
-rwxr-xr-x 1 bruno staff 240 Nov 9 07:52 shim
```
### Installation globale:
```bash
$ pip3 install nodeenv
```
Création d'un environnement:
```bash
# Par défaut, nodeenv installe la dernière version de node:
~/Documents/nodeenv master* ⇡
nodeenv homebridge
* Install prebuilt node (15.1.0) ..... done.
```
```bash
~/Documents/nodeenv master* ⇡
cd homebridge
drwxr-xr-x 9 bruno staff 288 Nov 8 16:03 bin
drwxr-xr-x 3 bruno staff 96 Nov 4 20:39 include
drwxr-xr-x 4 bruno staff 128 Nov 4 20:39 lib
drwxr-xr-x 5 bruno staff 160 Nov 4 20:39 share
drwxr-xr-x 3 bruno staff 96 Nov 8 16:03 src
~/Documents/nodeenv/homebridge master* ⇡
cd bin
total 75420
-rwxr-xr-x 1 bruno staff 3674 Nov 8 16:03 activate
-rwxr-xr-x 1 bruno staff 3977 Nov 8 16:03 activate.fish
-rwxr-xr-x 1 bruno staff 77214592 Nov 4 20:39 node
lrwxr-xr-x 1 bruno staff 4 Nov 8 16:03 nodejs -> node
lrwxr-xr-x 1 bruno staff 38 Nov 8 16:03 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 bruno staff 38 Nov 8 16:03 npx -> ../lib/node_modules/npm/bin/npx-cli.js
-rwxr-xr-x 1 bruno staff 268 Nov 8 16:03 shim
```
Activer l'environnement fonctionne uniquement sous bash, ni zsh, ni fish.
```bash
~/Documents/nodeenv master* ⇡ 7s
homebridge/bin/node -v
v15.1.0
```
Pour installer une version précise de node:
```bash
~/Documents/nodeenv master* ⇡
nodeenv --node=14.15.0 homebridge
* Install prebuilt node (14.15.0) ..... done.
```
```bash
~/Documents/nodeenv master* ⇡ 7s
homebridge/bin/node -v
v14.15.0
```
Pour connaître les versions disponibles:
```bash
~/Documents/nodeenv/homebridge master* ⇡ 9s
nodeenv --list
0.1.14 0.1.15 0.1.16 0.1.17 0.1.18 0.1.19 0.1.20 0.1.21
...
14.11.0 14.12.0 14.13.0 14.13.1 14.14.0 14.15.0 15.0.0 15.0.1
15.1.0
```
Installer une application:
```bash
~/Documents/nodeenv master* ⇡
homebridge/bin/node -v
v14.15.0
# env obligatoire
~/Documents/nodeenv master* ⇡
nodeenv --node=14.15.0 env
~/Documents/nodeenv master* ⇡
cd homebridge/bin
~/Documents/nodeenv master* ⇡
env/bin/npm install -g --unsafe-perm homebridge
/Users/bruno/Documents/nodeenv/env/bin/homebridge -> /Users/bruno/Documents/nodeenv/env/lib/node_modules/homebridge/bin/homebridge
+ homebridge@1.1.6
added 78 packages from 78 contributors in 5.065s
~/Documents/nodeenv master* ⇡
env/bin/npm install -g --unsafe-perm homebridge-config-ui-x
/Users/bruno/Documents/nodeenv/env/bin/hb-service -> /Users/bruno/Documents/nodeenv/env/lib/node_modules/homebridge-config-ui-x/dist/bin/hb-service.js
/Users/bruno/Documents/nodeenv/env/bin/homebridge-config-ui-x -> /Users/bruno/Documents/nodeenv/env/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js
```

View File

@@ -174,6 +174,13 @@ v8.11.4
```bash
$ nvm use --lts
Now using node v8.11.4 (npm v5.6.0)
# Utilise la dernière version LTS
$ nvm use --lts=erbium
Now using node v12.20.0 (npm v6.14.8)
# Utilise la dernière version LTS=erbium
```
Changer la version par défaut (résiste à un changement de fenêtre du terminal):
@@ -181,6 +188,10 @@ Changer la version par défaut (résiste à un changement de fenêtre du termina
```bash
$ nvm alias default 10.15.0
default -> 10.15.0 (-> v10.15.0)
# Dernière version de node par défaut
$ nvm alias default node
default -> node (-> v14.15.0)
```
Réinstaller les paquets d'une ancienne version après une mise-à jour:
@@ -217,6 +228,35 @@ bruno@silverbook: ~/.nvm/versions/node/v10.16.2/lib/node_modules $ ls
npm
```
Current:
https://medium.com/@danielzen/using-nvm-with-webstorm-or-other-ide-d7d374a84eb1
```bash
$ export NVM_SYMLINK_CURRENT=true
$ nvm use --lts
Now using node v14.15.1 (npm v6.14.9)
$ ls -ld $NVM_DIR/current
lrwxr-xr-x 1 bruno staff 40 Nov 30 15:26 /Users/bruno/.nvm/current -> /Users/bruno/.nvm/versions/node/v14.15.1
# ~/.nvm/current/bin/node comme node par défaut
~/.nvm/current/bin tags/v0.37.2
ls
total 81296
lrwxr-xr-x 1 bruno staff 36 Dec 21 12:05 ezshare -> ../lib/node_modules/ezshare/index.js
lrwxr-xr-x 1 bruno staff 34 Dec 26 08:47 joplin -> ../lib/node_modules/joplin/main.js
lrwxr-xr-x 1 bruno staff 39 Dec 21 12:05 ng -> ../lib/node_modules/@angular/cli/bin/ng
-rwxr-xr-x 1 bruno staff 73884800 Dec 17 20:17 node
lrwxr-xr-x 1 bruno staff 38 Dec 21 13:52 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 bruno staff 38 Dec 21 13:52 npx -> ../lib/node_modules/npm/bin/npx-cli.js
lrwxr-xr-x 1 bruno staff 44 Dec 21 12:05 thumbsup -> ../lib/node_modules/thumbsup/bin/thumbsup.js
lrwxr-xr-x 1 bruno staff 44 Dec 21 12:05 workbox -> ../lib/node_modules/workbox-cli/build/bin.js
```
### Erreur:

View File

@@ -76,7 +76,7 @@ $ pip3 --no-cache-dir install mkdocs
## Environnement virtuel:
Création de l'environnement virtuel pour l'application MkDocs:
```bash
# Création de l'environnement virtuel
@@ -90,27 +90,41 @@ $ mkdocs_env/bin/pip3 install mkdocs
# Installation du thème
$ mkdocs_env/bin/pip3 install mkdocs-material pymdown-extensions pygments
# Installation des plugins
$ mkdocs_env/bin/pip3 install mkdocs-pdf-export-plugin mkdocs-minify-plugin
$ mkdocs_env/bin/pip3 install mkdocs-pdf-export-plugin mkdocs-minify-plugin mkdocs-pdf-export-plugin
# Installation du plugin depuis les sources
$ mkdocs_env/bin/pip3 install mkdocs-pdf-export-plugin-0.5.5.tar.gz
# $ mkdocs_env/bin/pip3 install mkdocs-pdf-export-plugin-0.5.5.tar.gz
# Mise-à-jour
$ mkdocs_env/bin/pip3 install -U mkdocs
# Mise-à-jour de l'environnement virtuel
$ python3 -m venv --upgrade mkdocs_env
up_venv() {
/Users/bruno/Documents/venv/$1/bin/python3 -m venv --upgrade $1
}
$ up_venv mkdocs
# Mise-à-jour de l'application dans un venv
up_venv_mod() {
pip_venv="/Users/bruno/Documents/venv/$1/bin/pip3"
$pip_venv list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip_venv install -U
}
$ up_venv_mod mkdocs
```
Initialisation et démarrage de MkDocs:
```bash
~/Documents/mydocs master*
~/Documents/docs master*
# Création d'un nouveau projet
$ ~/Documents/mkdocs_env/bin/mkdocs new
$ ~/Documents/venv/mkdocs/bin/mkdocs new ~/Documents/docs
INFO - Writing config file: /Users/bruno/Documents/docs/mkdocs.yml
INFO - Writing initial docs: /Users/bruno/Documents/docs/docs/index.md
# Démarrage de mkdocs
$ ~/Documents/mkdocs_env/bin/mkdocs serve
$ ~/Documents/venv/mkdocs/bin/mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
```
@@ -128,6 +142,16 @@ mkdocs_env mkdocs serve
mkdocs_env deactivate
```
Mise-à-jour des modules:
```bash
up_venv_mod() {
/Users/bruno/Documents/venv/$1/bin/pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
}
$ up_venv mkdocs_env
```
## Modules:
@@ -437,6 +461,13 @@ $ pip3 show mkdocs | grep Requires
Requires: click, Markdown, PyYAML, Jinja2, tornado, lunr, livereload
```
#### Vérifier les paquets installés:
```bash
$ pip3 check
mkdocs 1.1.2 has requirement lunr[languages]==0.5.8, but you have lunr 0.5.9.
```
#### pipdeptree:
@@ -474,3 +505,11 @@ mkdocs==1.1
- tornado [required: >=5.0, installed: 6.0.4]
```
## Configuration:
```bash
$ pip3 config edit
```

View File

@@ -42,7 +42,31 @@ $ python3 -m site --user-base
/Users/bruno/Library/Python/3.7
```
[Pipenv](https://docs.pipenv.org)
### Pipenv
#### Outil qui remplace pip et virtualenv
https://github.com/pypa/pipenv
[Docs](https://pipenv.pypa.io/en/latest/)
### Pyenv
#### Python Version Management
https://github.com/pyenv/pyenv
### Venv (Pyvenv)
#### Outil pour créer un environnement virtuel
Fournit avec Python (>= 3.4). Similaire à virtualenv.
@@ -249,3 +273,35 @@ sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks
```
#### Python@39: Error: The brew link step did not complete successfully
```bash
==> Pouring python@3.9-3.9.1_4.big_sur.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/easy_install-3.9
Target /usr/local/bin/easy_install-3.9
already exists. You may want to remove it:
rm '/usr/local/bin/easy_install-3.9'
To force the link and overwrite all conflicting files:
brew link --overwrite python@3.9
To list all files that would be deleted:
brew link --overwrite --dry-run python@3.9
Possible conflicting files are:
/usr/local/bin/easy_install-3.9
/usr/local/bin/pip3
/usr/local/bin/pip3.9
```
```bash
$ brew link --overwrite --dry-run python@3.9
# puis
$ rm '/usr/local/bin/easy_install-3.9'
$ brew link --overwrite python@3.9
```

View File

@@ -153,3 +153,23 @@ cd myproject
pipenv install requests
```
```bash
~/venv master* ⇡
python3 -m venv rpd
> cd rpd
bin/pip3 install -U pip setuptools
cp /Users/bruno/Downloads/install.py /Users/bruno/Documents/venv/rpd
source bin/activate
```

View File

@@ -30,3 +30,19 @@ $ sudo spctl --master-disable
$ sudo xattr -rd com.apple.quarantine /Applications/LockedApp.app
```
# Sudo
#### Changer le délai d'expiration du mot de passe Sudo:
```bash
sudo visudo
```
Ajouter `Defaults timestamp_timeout=0` en dernière ligne, pour demander le mot-de-passe à chaque `sudo`
Ajouter Defaults timestamp_timeout=15 en dernière ligne, pour re-demander le mot-de-passe après 15mn (5mn par défaut).

View File

@@ -0,0 +1,199 @@
# alias
##### (bash & zsh)
| | |
| -------------- | ------------------------------------------------------------ |
| **reload** | Recharge .zshrc |
| **change** | Edite .zshrc |
| **backupzsh** | Backup .zshrc .zsh_plugins.txt .zsh_plugins.sh .sh_aliases sur clicclac.info |
| **restorezsh** | Restaure .zshrc .zsh_plugins.txt .zsh_plugins.sh .sh_aliases depuis clicclac.info |
#### Répertoires, fichiers...
| | | |
| ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| **c** | `clear` | |
| **cd()** | `{ builtin cd "$@" && gls -lA --color; }`<br />`{ builtin cd "$@" && ls -la; }` | cd + ls |
| **cdf()** | `pwdf; cd "$(pwdf)"` | Changer le répertoire dans la fenêtre active du Finder |
| **cpb()** | `{ cp $@{,.bak} ;}` | Crée un backup (.bak) |
| **dus** | `du -schx * | sort -nr` | Taille des dossiers et fichiers du répertoire courant |
| **ex()** | | Extraire une archive |
| **ff()** | `{ /usr/bin/find . -name "$@" ; }` | Recherche dans le répertoire courante |
| **ffs()** | `{ /usr/bin/find . -name "$@"'*' ; }` | Recherche dans le répertoire courante (le nom commence par) |
| **ffe()** | `{ /usr/bin/find . -name '*'"$@" ; }` | Recherche dans le répertoire courante (le nom se termine par) |
| **hc** | `history -c` | Effacer l'historique |
| **l** | `gls -lA --color` (ls -la) | |
| **lh** | `gls -dla --color .*` (ls -a \| grep "^\."') | |
| **nano** | `nano -l` | N° de ligne dans nano |
| **path** | `echo -e ${PATH//:/\\n}` | |
| **qfind** | `find / -name` | find / |
| **x** | `exit` | Sortir |
| **s()<br />i()** | `{ pwd > ~/.save_dir ; }`<br />`{ cd "$(cat ~/.save_dir)" ; }` | Sauve le répertoire courante<br />Change le répertoire vers celui sauvegardé |
| **sha** | `shasum -a 256 ` | Calcule un checksum |
#### git
| | |
| --------- | ------------------------------------------------------------ |
| **ga** | git add |
| **gp** | git push |
| **gl** | git log |
| **gt** | git status |
| **gd** | git diff |
| **gc** | git commit -m |
| **gca** | git commit -am |
| **gb** | git branch |
| **gh** | git checkout |
| **gra** | git remote add |
| **grr** | git remote rm |
| **gpu** | git pull |
| **gcl** | git clone |
| **gta** | git tag -a -m |
| **gf** | git reflog |
| **acp()** | {<br/> git add .<br/> git commit -m "$1"<br/> git push<br/>} |
#### ssh serveurs
| | |
| -------------- | ----------------------- |
| **916e** | `ssh dsm916e` |
| **916** | `ssh dsm916` |
| **414** | `ssh dsm414` |
| **ovh** | `ssh ovh` |
| **11** | `ssh 1and1` |
| **pi3** | `ssh pi3` |
| **pi3e** | `ssh pi3e` |
| **sls** | `ssh vpssls` |
| **mbv** | `ssh vpsmbv` |
| **vps** | `ssh vps` |
| **asus** | `ssh asus` |
| **rebootasus** | `ssh asus /sbin/reboot` |
#### Réseau
| | | |
| --------------- | ------------------------------------------------------------ | ------------------------------- |
| **flushDNS** | `sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache` | |
| **ipinfo0** | `ipconfig getpacket en0` | Get info on connections for en0 |
| **ipinfo1** | `ipconfig getpacket en1` | Get info on connections for en1 |
| **lsock** | `sudo /usr/sbin/lsof -i -P` | Display open sockets |
| **lsockU** | `sudo /usr/sbin/lsof -nP | grep UDP` | Display only open UDP sockets |
| **lsockT** | `sudo /usr/sbin/lsof -nP | grep TCP` | Display only open TCP sockets |
| **myip** | `curl ifconfig.me` | IP publique |
| **netCons** | `lsof -i` | Show all open TCP/IP sockets |
| **openports** | `sudo lsof -i | grep LISTEN` | All listening connections |
| **ping** | `ping -c4` | |
| **pin()** | `ping -c4 "$1" | grep 'received';` | |
| **showblocked** | `sudo ipfw list` | All ipfw rules inc/ blocked IPs |
#### Développement web
| | | |
| ----------------- | ------------------------------------------------------------ | ------------------------------ |
| **apacheEdit** | `bbedit /usr/local/etc/httpd/httpd.conf` | Editer la config Apache |
| **apacheRelance** | `sudo apachectl stop ; sudo apachectl start` | Stop and start Apache |
| **apacheRestart** | `sudo apachectl -k restart` | Restart Apche gracefully |
| **apal** | `tail -f /usr/local/var/log/httpd/access_log` | Apache access_log |
| **apel** | `tail -f /usr/local/var/log/httpd/error_log` | Apache error_log |
| **editHosts** | `sudo edit /etc/hosts` | Editer le fichier hosts |
| **httpHeaders** | `/usr/bin/curl -I -L $@ ;` | Grabs headers from web page |
| **log2** | `less +F /usr/local/var/log/httpd/error_log` | Apache error_log |
| **multiapa** | `multitail -F /usr/local/etc/multitail.conf -cS apache /usr/local/var/log/httpd/error_log -cS apache /usr/local/var/log/httpd/access_log` | Apache access_log ET error_log |
| **mtapa** | `multitail -ci green /usr/local/var/log/httpd/access_log -ci red -I /usr/local/var/log/httpd/error_log` | Apache access_log ET error_log |
#### Soco-cli
| | |
| ------------------ | ------------------------------------------------------------ |
| **sonos-discover** | `/$HOME/Documents/venv/soco-cli/bin/sonos-discover -t 256 -n 1.0 -m 24` |
| **sfinfo** | `sonos Salon play_fav 'franceinfo'` |
| **sfi** | `sonos Salon play_fav 'france inter'` |
| **sk6** | `sonos Salon play_fav 'K6 FM'` |
| **srire** | `sonos Salon play_fav 'Rire et Chansons'` |
| **srtl** | `sonos Salon play_fav 'RTL'` |
| **sflow** | `sonos Salon play_fav 'Flow'` |
| **slist** | `sonos Salon list_favs` |
| **smeu** | `sonos Salon play_fav 'Meurice'` |
| **son** | `sonos Salon mute on` |
| **soff** | `sonos Salon mute off` |
| **sstart** | `sonos Salon start` |
| **sstop** | `sonos Salon stop` |
| **sv11** | `sonos Salon volume 11` |
| **sv13** | `sonos Salon volume 13` |
| **sv15** | `sonos Salon volume 15` |
#### Alias globaux
| | |
| --------- | ------------------ |
| **...** | `../..` |
| **....** | `../../..` |
| **.....** | `../../../..` |
| **C** | `| wc -l` |
| **DN** | `/dev/null` |
| **H** | `| head` |
| **LL** | `2>&1 | less` |
| **L** | `| less` |
| **LS** | `| less -S` |
| **NE** | `2> /dev/null` |
| **NUL** | `> /dev/null 2>&1` |
| **NS** | `| sort -n` |
| **RNS** | `| sort -nr` |
| **S** | `| sort` |
| **US** | `| sort -u` |
| **TL** | `| tail -20` |
| **T** | `| tail` |
| **X** | `| xargs` |
#### Divers
| | | |
| ----------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
| **bashTools** | `/$HOME/Documents/Scripts/bash/bash_tools.sh` | |
| **dld()** | `{ pbpaste >> $HOME/Desktop/"$1".txt; }` | Recupère le presse-papier et le met dans un fichier .txt |
| **mailoptimiser** | `curl -sS https://raw.githubusercontent.com/pbihq/tools/master/MailDBOptimiser/MailDBOptimiser.sh | bash` | |
| **mkbuild** | `/$HOME/Documents/Scripts/bash/mkbuild.sh` | Mkdocs: |
| **mkserve** | `cd ~/project/ ; mkdocs serve` | Mkdocs: |
| **mt** | `multitail -F /usr/local/etc/multitail.conf` | Multitail |
| **quarantine** | `sudo xattr -rd com.apple.quarantine` | De-quarantine |
| **tolowercase** | `pbpaste | tr "[:upper:]" "[:lower:]" | pbcopy` | Convertit en minuscule |
| **touppercase** | `pbpaste | tr "[:lower:]" "[:upper:]" | pbcopy` | Convertit en majuscule |
| **txt** | `pbpaste | textutil -convert txt -stdin -stdout -encoding 30 | pbcopy` | Convert contents of clipboard to plain text |
| **typora** | `open -a typora` | Ouvrir un fichier markdow dans Typora |
| **up_kymsu** | `cd /$HOME/Documents/Scripts/kymsu2/ ; ./install.sh` | MàJ kymsu2 |
| **zshTools** | `/$HOME/Documents/Scripts/bash/zsh_tools.sh` | |
#### Autres
| Fonctions | | |
| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| **backpi** | `sudo rsync -av --exclude ".*/" pi@192.168.1.100:/home/pi/ ~/RPi-backup` | |
| **bbshellcheck()** | | Vérifie la syntaxe des scripts bash |
| **listening()** | | Affiche les ports |
| **portainer** | `docker run -d -v "/var/run/docker.sock:/var/run/docker.sock" -p 9000:9000 portainer/portainer` | |
| **pwdf()** | | Prints the path of the front Finder window. Desktop if no window open |
| **upd_nvm()** | | Mise-à-jour de nvm |

View File

@@ -113,6 +113,9 @@ Chaque version de PHP a son propre répertoire d'extensions:
/usr/local/lib/php/pecl/20170718 ← 7.2
/usr/local/lib/php/pecl/20180731 ← 7.3
/usr/local/lib/php/pecl/20190902 ← 7.4
/usr/local/lib/php/pecl/20200930 ← 8.0
/usr/local/Cellar/php@7.4/7.4.14_1/pecl/20190902/
```
@@ -140,7 +143,7 @@ extension="ssh2.so"
```
```bash
# Installation de xdebug:
# Installation de Xdebug:
$ wget http://xdebug.org/files/xdebug-x.x.x.tgz
$ tar -xzvf xdebug-x.x.x.tgz
@@ -151,6 +154,37 @@ $ make
$ make install
```
```bash
# Installation de imagick:
git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
make install
```
[Activer / désactiver](https://gist.githubusercontent.com/rhukster/073a2c1270ccb2c6868e7aced92001cf/raw/c1629293bcf628cd6ded20c201c4ef0a2fa79144/xdebug) Xdebug:
```bash
curl -L https://gist.githubusercontent.com/rhukster/073a2c1270ccb2c6868e7aced92001cf/raw/c1629293bcf628cd6ded20c201c4ef0a2fa79144/xdebug > /usr/local/bin/xdebug
chmod +x /usr/local/bin/xdebug
# Utilisation:
xdebug on
xdebug off
```
```bash
https://pecl.php.net
https://github.com/Imagick/imagick.git
https://github.com/php/pecl-file_formats-yaml.git
```
### Erreurs:

View File

@@ -0,0 +1,87 @@
# PHP 7.4
#### Installer PHP 7.4
```bash
$ brew install php@7.4
```
### Changer de version de PHP:
#### Installer Brew PHP Switcher
```bash
$ brew install brew-php-switcher
```
Changer de version:
```bash
$ brew-php-switcher 7.3
```
Version de PHP (Apache):
```bash
php --info | grep 'PHP Version' | sed -n '1p'
PHP Version => 7.4.9
```
Version de PHP (cli):
```bash
php -v
PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.9, Copyright (c), by Zend Technologies
with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
```
Version de l'API:
```bash
php --info | grep 'PHP API'
PHP API => 20190902
```
PECL et PEAR sont linkés:
```bash
which pecl
/usr/local/bin/pecl
which pear
/usr/local/bin/pear
```
#### Installer des extensions (avec [PECL](https://pecl.php.net)):
Requiert autoconf: `brew install autoconf`
```bash
$ pecl uninstall -r xdebug
$ pecl install xdebug
$ pecl install yaml
$ pecl install apcu
$ pecl install imagick
$ pecl install ssh2
$ pecl install memcached
$ pecl install redis
# Pour une version spécifique:
$ pecl install xdebug-2.7.0beta1
```

View File

@@ -0,0 +1,63 @@
# PHP 8
https://getgrav.org/blog/macos-bigsur-apache-mysql-vhost-apc
https://stitcher.io/blog/the-latest-php-version
#### Installer des extensions (avec [PECL](https://pecl.php.net)):
Requiert autoconf: `brew install autoconf`
```bash
$ pecl uninstall -r xdebug
$ pecl install xdebug
$ pecl install yaml
$ pecl install apcu
$ pecl install redis
$ pecl install memcached
$ pecl install imagick # Ne fontionne pas (pecl ou compile)
$ pecl install ssh2 # Ne fontionne pas (pecl ou compile)
# 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/8.0/conf.d/`
```bash
/usr/local/etc/php/8.0/conf.d 20s
ls -la
total 16
-rw-r--r-- 1 bruno admin 27 Dec 1 09:39 ext-apcu.ini
-rw-r--r-- 1 bruno admin 74 Dec 1 09:26 ext-opcache.ini
-rw-r--r-- 1 bruno admin 27 Dec 1 09:39 ext-ssh2.ini.bak
-rw-r--r-- 1 bruno admin 392 Dec 1 09:39 ext-xdebug.ini
/usr/local/etc/php/8.0/conf.d
code ext-xdebug.ini
[xdebug]
zend_extension="xdebug.so"
xdebug.client_host = 127.0.0.1
;xdebug.client_port = 9001
xdebug.mode = debug
;xdebug.discover_client_host = true
;xdebug.start_with_request = yes
;xdebug.start_upon_error = yes
;xdebug.log_level = 10
xdebug.log = "/tmp/xdebug.log"
xdebug.output_dir = "/tmp/xdebug"
xdebug.profiler_output_name="cachegrind.out.%t.%p"
xdebug.trace_output_name= %H-%p.trace
```