14-11-2023
This commit is contained in:
174
docs/macos/TimeMachine.md
Normal file
174
docs/macos/TimeMachine.md
Normal file
@@ -0,0 +1,174 @@
|
||||
# Time Machine
|
||||
|
||||
|
||||
|
||||
https://www.macworld.com/article/220774/control-time-machine-from-the-command-line.html
|
||||
|
||||
|
||||
|
||||
Activer Time Machine:
|
||||
|
||||
```bash
|
||||
$ tmutil enable
|
||||
```
|
||||
|
||||
Désactiver Time Machine:
|
||||
|
||||
```bash
|
||||
$ tmutil disable
|
||||
```
|
||||
|
||||
Démarrer une sauvegarde:
|
||||
|
||||
```bash
|
||||
$ tmutil startbackup
|
||||
```
|
||||
|
||||
Stopper une sauvegarde:
|
||||
|
||||
```bash
|
||||
$ tmutil stopbackup
|
||||
```
|
||||
|
||||
Connaitre le répertoire de stockage de Time Machine:
|
||||
|
||||
```bash
|
||||
$ tmutil machinedirectory
|
||||
/Volumes/Karadoc
|
||||
```
|
||||
|
||||
Liste des backups locaux:
|
||||
|
||||
```bash
|
||||
$ tmutil listlocalsnapshots /
|
||||
Snapshots for disk /:
|
||||
com.apple.TimeMachine.2023-08-06-183708.local
|
||||
com.apple.TimeMachine.2023-08-06-224319.local
|
||||
com.apple.TimeMachine.2023-08-06-234317.local
|
||||
com.apple.TimeMachine.2023-08-07-004401.local
|
||||
com.apple.TimeMachine.2023-08-07-014414.local
|
||||
com.apple.TimeMachine.2023-08-07-024419.local
|
||||
com.apple.TimeMachine.2023-08-07-034434.local
|
||||
com.apple.TimeMachine.2023-08-07-044445.local
|
||||
com.apple.TimeMachine.2023-08-07-054449.local
|
||||
com.apple.TimeMachine.2023-08-07-074454.local
|
||||
com.apple.TimeMachine.2023-08-07-084455.local
|
||||
com.apple.TimeMachine.2023-08-07-094541.local
|
||||
com.apple.TimeMachine.2023-08-07-104623.local
|
||||
com.apple.TimeMachine.2023-08-07-122033.local
|
||||
```
|
||||
|
||||
Date des backup locaux:
|
||||
|
||||
```bash
|
||||
$ tmutil listlocalsnapshotdates /
|
||||
Snapshot dates for disk /:
|
||||
2023-08-06-183708
|
||||
2023-08-06-224319
|
||||
2023-08-06-234317
|
||||
2023-08-07-004401
|
||||
2023-08-07-014414
|
||||
2023-08-07-024419
|
||||
2023-08-07-034434
|
||||
2023-08-07-044445
|
||||
2023-08-07-054449
|
||||
2023-08-07-074454
|
||||
2023-08-07-084455
|
||||
2023-08-07-094541
|
||||
2023-08-07-104623
|
||||
2023-08-07-122033
|
||||
```
|
||||
|
||||
Supprimer un backup local:
|
||||
|
||||
```bash
|
||||
$ sudo tmutil deletelocalsnapshots <snapshot_date>
|
||||
|
||||
$ sudo tmutil deletelocalsnapshots 2023-08-07-084455
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ tmutil calculatedrift "/Volumes/Karadoc"
|
||||
|
||||
Drift Averages
|
||||
-------------------------------------
|
||||
Added: 0B
|
||||
Removed: 0B
|
||||
Changed: 0B
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ tmutil --help
|
||||
Usage: tmutil version
|
||||
|
||||
Usage: tmutil enable
|
||||
|
||||
Usage: tmutil disable
|
||||
|
||||
Usage: tmutil startbackup [-a | --auto] [-b | --block] [-r | --rotation] [-d | --destination dest_id]
|
||||
|
||||
Usage: tmutil stopbackup
|
||||
|
||||
Usage: tmutil delete [-d backup_mount_point -t timestamp] [-p path]
|
||||
|
||||
Usage: tmutil deleteinprogress machine_directory
|
||||
|
||||
Usage: tmutil restore [-v] src ... dst
|
||||
|
||||
Usage: tmutil compare [-@acdefghlmnstuEX] [-D depth] [-I name]
|
||||
tmutil compare [-@acdefghlmnstuEX] [-D depth] [-I name] snapshot_path
|
||||
tmutil compare [-@acdefghlmnstuEUX] [-D depth] [-I name] path1 path2
|
||||
|
||||
Usage: tmutil setdestination [-a] mount_point
|
||||
tmutil setdestination [-ap] afp://user[:pass]@host/share
|
||||
|
||||
Usage: tmutil setdestination destination_id quota_in_gigabytes
|
||||
|
||||
Usage: tmutil removedestination destination_id
|
||||
|
||||
Usage: tmutil destinationinfo [-X]
|
||||
|
||||
Usage: tmutil addexclusion [-p|-v] item ...
|
||||
|
||||
Usage: tmutil removeexclusion [-p|-v] item ...
|
||||
|
||||
Usage: tmutil isexcluded item ...
|
||||
|
||||
Usage: tmutil inheritbackup machine_directory
|
||||
tmutil inheritbackup sparse_bundle
|
||||
|
||||
Usage: tmutil associatedisk [-a] mount_point volume_backup_directory
|
||||
|
||||
Usage: tmutil latestbackup [-m] [-t] [-d mount_point]
|
||||
|
||||
Usage: tmutil listbackups [-m] [-t] [-d mount_point]
|
||||
|
||||
Usage: tmutil machinedirectory
|
||||
|
||||
Usage: tmutil calculatedrift machine_directory
|
||||
|
||||
Usage: tmutil uniquesize path ...
|
||||
|
||||
Usage: tmutil verifychecksums path ...
|
||||
|
||||
Usage: tmutil localsnapshot
|
||||
|
||||
Usage: tmutil listlocalsnapshots <mount_point>
|
||||
|
||||
Usage: tmutil listlocalsnapshotdates [<mount_point>]
|
||||
|
||||
Usage: tmutil deletelocalsnapshots [<mount_point> | <snapshot_date>]
|
||||
|
||||
Usage: tmutil thinlocalsnapshots <mount_point> [purgeamount] [urgency]
|
||||
```
|
||||
|
||||
@@ -2,6 +2,24 @@
|
||||
|
||||
|
||||
|
||||
### Avec Sonoma
|
||||
|
||||
```bash
|
||||
$ sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
|
||||
|
||||
$ sudo nano /etc/pam.d/sudo_local
|
||||
```
|
||||
|
||||
Dé-commentez la 3e ligne:
|
||||
|
||||
```bash
|
||||
auth sufficient pam_tid.so
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Avant Sonoma
|
||||
|
||||
```bash
|
||||
$ sudo cp /etc/pam.d/sudo /etc/pam.d/sudo.bak
|
||||
|
||||
@@ -29,4 +47,3 @@ session required pam_permit.so
|
||||
!!! attention
|
||||
Les connections ssh sans mot-de-passe ne fonctionnent plus.
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,42 @@ $ brew upgrade
|
||||
# --cleanup Met à jour et supprime les anciennes versions installées.
|
||||
```
|
||||
|
||||
### Toutes les commandes:
|
||||
|
||||
```bash
|
||||
$ brew commands
|
||||
==> Built-in commands
|
||||
--cache deps list search
|
||||
--caskroom desc log shellenv
|
||||
--cellar developer migrate tap-info
|
||||
--env docs missing tap
|
||||
--prefix doctor nodenv-sync uninstall
|
||||
--repository fetch options unlink
|
||||
--version formulae outdated unpin
|
||||
analytics gist-logs pin untap
|
||||
autoremove help postgresql-upgrade-database update-report
|
||||
casks home postinstall update-reset
|
||||
cleanup info pyenv-sync update
|
||||
commands install rbenv-sync upgrade
|
||||
completions leaves readall uses
|
||||
config link reinstall vendor-install
|
||||
|
||||
==> Built-in developer commands
|
||||
audit contributions generate-man-completions prof typecheck
|
||||
bottle create install-bundler-gems release unbottled
|
||||
bump-cask-pr determine-test-runners irb rubocop unpack
|
||||
bump-formula-pr dispatch-build-bottle linkage ruby update-license-data
|
||||
bump-revision edit livecheck sh update-maintainers
|
||||
bump-unversioned-casks extract pr-automerge style update-python-resources
|
||||
bump formula pr-publish tap-new update-sponsors
|
||||
cat generate-cask-api pr-pull test update-test
|
||||
command generate-formula-api pr-upload tests vendor-gems
|
||||
|
||||
==> External commands
|
||||
bundle services
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Formules:
|
||||
@@ -563,13 +599,15 @@ $ brew bundle
|
||||
```bash
|
||||
bruno@SilverBook:~$ brew services list
|
||||
|
||||
Name Status User Plist
|
||||
|
||||
mariadb started bruno /Users/bruno/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
||||
|
||||
php71 started bruno /Users/bruno/Library/LaunchAgents/homebrew.mxcl.php71.plist
|
||||
|
||||
httpd started root /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
|
||||
Name Status User File
|
||||
dbus none
|
||||
emacs none
|
||||
httpd started bruno ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
|
||||
mariadb started bruno ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
||||
php started bruno ~/Library/LaunchAgents/homebrew.mxcl.php.plist
|
||||
php@7.4 none
|
||||
redis started bruno ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
|
||||
unbound none
|
||||
```
|
||||
|
||||
#### Lancer au démarrage:
|
||||
@@ -606,22 +644,23 @@ $ brew services restart mysql
|
||||
|
||||
```bash
|
||||
$ brew tap
|
||||
caskroom/cask
|
||||
homebrew/apache
|
||||
homebrew/bundle
|
||||
homebrew/cask
|
||||
homebrew/cask-drivers
|
||||
homebrew/cask-fonts
|
||||
homebrew/core
|
||||
homebrew/dupes
|
||||
homebrew/php
|
||||
homebrew/services
|
||||
homebrew/versions
|
||||
tideways/profiler
|
||||
vapor/tap
|
||||
joedrago/repo
|
||||
shivammathur/extensions
|
||||
shivammathur/php
|
||||
sidneys/homebrew
|
||||
```
|
||||
|
||||
<u>Les tap sont situés là:</u>
|
||||
|
||||
```bash
|
||||
bruno@silverbook:/usr/local/Homebrew/Library/Taps$ ls
|
||||
caskroom homebrew tideways vapor
|
||||
/opt/homebrew/Library/Taps $ ls
|
||||
homebrew joedrago shivammathur sidneys
|
||||
```
|
||||
|
||||
#### Ajouter un repo:
|
||||
@@ -640,26 +679,27 @@ $ brew untap <tapname>
|
||||
|
||||
```bash
|
||||
$ brew config
|
||||
HOMEBREW_VERSION: 2.2.4-6-g7fcae58
|
||||
HOMEBREW_VERSION: 3.6.10
|
||||
ORIGIN: https://github.com/Homebrew/brew
|
||||
HEAD: 7fcae58af70da20b3be04327ebeebdf236333d27
|
||||
Last commit: 19 hours ago
|
||||
HEAD: eaf887656ffb8e9e35ccf08081814d4735637564
|
||||
Last commit: 13 hours ago
|
||||
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
|
||||
Core tap HEAD: 91f4df97adc4fcb9459b1a8dbd026c9fa1e45c31
|
||||
Core tap last commit: 73 minutes ago
|
||||
HOMEBREW_PREFIX: /usr/local
|
||||
HOMEBREW_DEV_CMD_RUN: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
CPU: octa-core 64-bit skylake
|
||||
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
|
||||
Clang: 11.0 build 1100
|
||||
Git: 2.25.0 => /usr/local/bin/git
|
||||
Curl: 7.64.1 => /usr/bin/curl
|
||||
Java: 13.0.1
|
||||
macOS: 10.15.2-x86_64
|
||||
CLT: N/A
|
||||
Xcode: 11.3.1
|
||||
XQuartz: 2.7.11 => /opt/X11
|
||||
Core tap HEAD: 27b9f0718bb03e5ea933b5ceb5cd0cadb2bbd4a0
|
||||
Core tap last commit: 19 minutes ago
|
||||
Core tap branch: master
|
||||
HOMEBREW_PREFIX: /opt/homebrew
|
||||
HOMEBREW_CASK_OPTS: []
|
||||
HOMEBREW_EDITOR: nano
|
||||
HOMEBREW_MAKE_JOBS: 8
|
||||
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
|
||||
CPU: octa-core 64-bit arm_firestorm_icestorm
|
||||
Clang: 14.0.0 build 1400
|
||||
Git: 2.38.1 => /opt/homebrew/bin/git
|
||||
Curl: 7.79.1 => /usr/bin/curl
|
||||
macOS: 12.6-arm64
|
||||
CLT: 14.1.0.0.1.1663981106
|
||||
Xcode: 14.0.1
|
||||
Rosetta 2: false
|
||||
```
|
||||
|
||||
#### Afficher les formules qui ont le paquet cité comme dépendance (brew uses):
|
||||
@@ -781,41 +821,68 @@ Les outils GNU sont préfixés par la lettre **g** (**g**ls, **g**cat, **g**chmo
|
||||
|
||||
*Les outils GNU sont installés dans /usr/local/bin/*
|
||||
|
||||
*Un alias sans le préfixe **g** est crée dans /usr/local/opt/coreutils/libexec/gnubin/*
|
||||
*Un alias sans le préfixe **g** est crée dans /usr/local/opt/coreutils/libexec/gnubin/* ou */opt/homebrew/opt/coreutils/libexec/gnubin*
|
||||
|
||||
|
||||
|
||||
On peut ajouter le dossier /usr/local/opt/coreutils/libexec/gnubin dans le $PATH. Les outils GNU sont alors disponibles sans préfixe, à la place des outils BSD.
|
||||
```bash
|
||||
❯ ls /opt/homebrew/opt/coreutils/libexec/gnubin/
|
||||
'['
|
||||
b2sum, base32, base64, basename, basenc,
|
||||
cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut
|
||||
date, dd, df, dir, dircolors, dirname, du,
|
||||
echo, env, expand, expr,
|
||||
factor, false, fmt, fold,
|
||||
groups
|
||||
head, hostid,
|
||||
id, install,
|
||||
join
|
||||
kill
|
||||
link, ln, logname ,ls
|
||||
md5sum, mkdir, mkfifo, mknod, mktemp, mv
|
||||
nice, nl, nohup, nproc, numfmt,
|
||||
od
|
||||
paste, pathchk, pinky, pr, printenv, printf, ptx, pwd,
|
||||
readlink, realpath, rm, rmdir, runcon,
|
||||
seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync
|
||||
tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty,
|
||||
uname, unexpand, uniq, unlink, uptime, users,
|
||||
vdir
|
||||
wc, who, whoami
|
||||
yes
|
||||
```
|
||||
|
||||
On peut ajouter le dossier /usr/local/opt/coreutils/libexec/gnubin (/opt/homebrew/opt/coreutils/libexec/gnubin) dans le $PATH. Les outils GNU sont alors disponibles sans préfixe, à la place des outils BSD.
|
||||
|
||||
De même pour les man (`MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"`)
|
||||
|
||||
```bash
|
||||
# AVEC PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
|
||||
# AVEC PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
|
||||
|
||||
❯ which ls
|
||||
/usr/local/opt/coreutils/libexec/gnubin/ls
|
||||
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
|
||||
|
||||
❯ which gls
|
||||
/usr/local/bin/gls
|
||||
/opt/homebrew/bin/gls
|
||||
(gls -> ../Cellar/coreutils/8.31/bin/gls)
|
||||
|
||||
❯ which /bin/ls
|
||||
/bin/ls
|
||||
|
||||
❯ ls --version
|
||||
ls (GNU coreutils) 8.31
|
||||
ls (GNU coreutils) 9.1
|
||||
|
||||
❯ gls --version
|
||||
ls (GNU coreutils) 8.31
|
||||
ls (GNU coreutils) 9.1
|
||||
|
||||
|
||||
# SANS PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
|
||||
# SANS PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
|
||||
|
||||
❯ which ls
|
||||
/bin/ls
|
||||
|
||||
❯ which gls
|
||||
/usr/local/bin/gls
|
||||
/opt/homebrew/bin/gls
|
||||
|
||||
❯ which /bin/ls
|
||||
/bin/ls
|
||||
@@ -824,7 +891,7 @@ ls (GNU coreutils) 8.31
|
||||
ls: illegal option -- -
|
||||
|
||||
❯ gls --version
|
||||
ls (GNU coreutils) 8.31
|
||||
ls (GNU coreutils) 9.1
|
||||
```
|
||||
|
||||
Utiliser date ou gdate:
|
||||
@@ -848,27 +915,27 @@ Comprend les versions GNU de *find, locate, xargs* (pas de updatedb dans osx )
|
||||
```bash
|
||||
$ brew install findutils
|
||||
|
||||
# SANS PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
|
||||
# SANS PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"
|
||||
|
||||
$ which find
|
||||
/usr/bin/find
|
||||
|
||||
$ which gfind
|
||||
/usr/local/bin/gfind
|
||||
/opt/homebrew/bin/gfind
|
||||
|
||||
$ gfind --version
|
||||
find (GNU findutils) 4.7.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
find (GNU findutils) 4.9.0
|
||||
Packaged by Homebrew
|
||||
Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
|
||||
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
|
||||
|
||||
```
|
||||
|
||||
Ajouter `PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"` et `PATH="/usr/local/opt/findutils/libexec/gnuman:$PATH"` au $PATH pour accéder aux commandes sans le préfixe **g**.
|
||||
Ajouter `PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"` et `PATH="/opt/homebrew/opt/coreutils/libexec/gnuman:$PATH"` au $PATH pour accéder aux commandes sans le préfixe **g**.
|
||||
|
||||
|
||||
|
||||
@@ -1007,6 +1074,27 @@ brew update-reset
|
||||
|
||||
|
||||
|
||||
#### 4. error: Unable to create '/opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock': File exists.
|
||||
|
||||
```bash
|
||||
error: Unable to create '/opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock': File exists.
|
||||
|
||||
Another git process seems to be running in this repository, e.g.
|
||||
an editor opened by 'git commit'. Please make sure all processes
|
||||
are terminated then try again. If it still fails, a git process
|
||||
may have crashed in this repository earlier:
|
||||
remove the file manually to continue.
|
||||
error: could not detach HEAD
|
||||
```
|
||||
|
||||
Pour corriger, lancer:
|
||||
|
||||
```bash
|
||||
rm /opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/index.lock
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Réinstaller Homebrew
|
||||
|
||||
```bash
|
||||
|
||||
@@ -85,8 +85,11 @@ $ nvm install 8.9.4
|
||||
# la dernière version 6
|
||||
$ nvm install 6
|
||||
|
||||
# la dernière version LTS (v10)
|
||||
$ nvm install --lts=dubnium
|
||||
# la dernière version LTS (v16)
|
||||
$ nvm install --lts=gallium
|
||||
|
||||
# la dernière version LTS (v18)
|
||||
$ nvm install --lts=hydrogen
|
||||
```
|
||||
|
||||
Mettre à jour NodeJS et réinstaller les paquets.
|
||||
@@ -100,6 +103,8 @@ Stable (LTS) version:
|
||||
nvm install lts/* --reinstall-packages-from=node
|
||||
# nvm install --lts=erbium && nvm reinstall-packages $(nvm current | sed 's/^.//')
|
||||
# nvm install --lts=erbium && nvm reinstall-packages 12.18.3
|
||||
|
||||
nvm install --lts=hydrogen --reinstall-packages-from=18.17.0
|
||||
```
|
||||
|
||||
Liste des versions de Node installées:
|
||||
@@ -149,8 +154,11 @@ v10.9.0 v8.11.4
|
||||
Version en usage:
|
||||
|
||||
```bash
|
||||
$ nvm current
|
||||
v16.17.1
|
||||
|
||||
$ node -v
|
||||
v8.11.4
|
||||
v16.17.1
|
||||
```
|
||||
|
||||
Changer de version:
|
||||
@@ -183,6 +191,23 @@ Now using node v12.20.0 (npm v6.14.8)
|
||||
# Utilise la dernière version LTS=erbium
|
||||
```
|
||||
|
||||
Alias:
|
||||
|
||||
```bash
|
||||
$ nvm alias maintenance 16.17.0
|
||||
maintenance -> 16.17.0 (-> v16.17.0)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ nvm use maintenance
|
||||
Now using node v16.17.0 (npm v8.19.2)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ nvm unalias maintenance
|
||||
Deleted alias maintenance - restore it with `nvm alias "maintenance" "16.17.0"`
|
||||
```
|
||||
|
||||
Changer la version par défaut (résiste à un changement de fenêtre du terminal):
|
||||
|
||||
```bash
|
||||
@@ -276,3 +301,29 @@ Entrer:
|
||||
$ nvm alias default 12
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Desinstaller nvm:
|
||||
|
||||
1. Désactiver nvm
|
||||
|
||||
```bash
|
||||
$ nvm deactivate
|
||||
```
|
||||
|
||||
2. Désinstaller nvm
|
||||
|
||||
```bash
|
||||
$ nvm unload
|
||||
```
|
||||
|
||||
3. Nettoyer .zshrc ou .bashrc
|
||||
|
||||
```bash
|
||||
# Supprimer les lignes:
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm
|
||||
```
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
# WebServer
|
||||
# Python
|
||||
|
||||
|
||||
|
||||
[Conda](conda.md)
|
||||
|
||||
[Django](Django.md)
|
||||
|
||||
[pip](pip.md)
|
||||
|
||||
[python3](python3.md)
|
||||
|
||||
[pipx](pipx.md)
|
||||
|
||||
[poetry](poetry.md)
|
||||
|
||||
[venv](virtuel.md)
|
||||
|
||||
@@ -452,6 +452,58 @@ mkdocs-tooltipster-links-plugin (0.1.0) - An MkDocs plugin
|
||||
|
||||
|
||||
|
||||
#### Connaitre toutes les versions disponibles d'un module:
|
||||
|
||||
*Depuis pypi.org avec curl:*
|
||||
|
||||
```bash
|
||||
# $ curl -L -s "https://pypi.org/pypi/<$PACKAGE>/json" | jq -r '.releases | keys | .[]' | sort -V
|
||||
|
||||
$ curl -L -s "https://pypi.org/pypi/geomet/json" | jq -r '.releases | keys | .[]' | sort -V
|
||||
0.1.0
|
||||
0.1.1
|
||||
0.1.2
|
||||
0.2.0.post2
|
||||
0.2.1
|
||||
0.2.1.post1
|
||||
0.3.0
|
||||
```
|
||||
|
||||
*pip >= 21.2*
|
||||
|
||||
```bash
|
||||
$ pip index versions geomet
|
||||
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
|
||||
geomet (0.3.0)
|
||||
Available versions: 0.3.0, 0.2.1.post1, 0.2.0.post2, 0.1.2, 0.1.1, 0.1.0
|
||||
INSTALLED: 0.3.0
|
||||
LATEST: 0.3.0
|
||||
```
|
||||
|
||||
*Précédentes versions de pip:*
|
||||
|
||||
```bash
|
||||
# en ne précisant pas la version
|
||||
$ pip install geomet==
|
||||
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
|
||||
ERROR: Ignored the following versions that require a different python version: 0.2.1 Requires-Python >2.6, !=3.3.*, <3.8
|
||||
ERROR: Could not find a version that satisfies the requirement geomet== (from versions: 0.1.0, 0.1.1, 0.1.2, 0.2.0.post2, 0.2.1.post1, 0.3.0)
|
||||
ERROR: No matching distribution found for geomet==
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pip install geomet== --use-deprecated=legacy-resolver
|
||||
```
|
||||
|
||||
```bash
|
||||
# en spécifiant une version qui n'existe pas:
|
||||
$ pip install geomet==9999
|
||||
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
|
||||
ERROR: Ignored the following versions that require a different python version: 0.2.1 Requires-Python >2.6, !=3.3.*, <3.8
|
||||
ERROR: Could not find a version that satisfies the requirement geomet==9999 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.2.0.post2, 0.2.1.post1, 0.3.0)
|
||||
ERROR: No matching distribution found for geomet==9999
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Dépendances:
|
||||
|
||||
@@ -8,7 +8,7 @@ Python 3 peut s'installer avec Homebrew:
|
||||
$ brew install python3
|
||||
```
|
||||
|
||||
Les extensions Python 3 s'installent dans `/usr/local/lib/python3.7/site-packages/`
|
||||
Les extensions Python 3 s'installent dans `/usr/local/lib/python3.7/site-packages/` (Intel) ou `/opt/homebrew/lib/python3.9/site-packages/` (Arm)
|
||||
|
||||
Pour lancer un script Python 3:
|
||||
|
||||
|
||||
@@ -184,21 +184,107 @@ pipenv install requests
|
||||
|
||||
|
||||
|
||||
### Mise-à-jour de Python dans un venv
|
||||
|
||||
1. On sauvegarde les dépendances:
|
||||
|
||||
```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
|
||||
~/Documents/venv mkdocs soco-cli
|
||||
|
||||
❯ source soco-cli/bin/activate
|
||||
soco-cli ❯ pip3 freeze > requirements.txt
|
||||
soco-cli ❯ deactivate
|
||||
```
|
||||
|
||||
2. On supprime le venv:
|
||||
|
||||
```bash
|
||||
❯ rm -rf soco-cli
|
||||
```
|
||||
|
||||
3. On recrée le venv (avec la version courante de python):
|
||||
|
||||
```bash
|
||||
# avec la version courante de python:
|
||||
❯ python3 -m venv soco-cli
|
||||
|
||||
# avec une version précise de python:
|
||||
❯ python3.10 -m venv soco-cli
|
||||
```
|
||||
|
||||
4. On met à jour les outils:
|
||||
|
||||
```bash
|
||||
❯ source soco-cli/bin/activate
|
||||
soco-cli ❯ pip3 install -U pip setuptools wheel
|
||||
```
|
||||
|
||||
5. On réinstalle les dépendances:
|
||||
|
||||
```bash
|
||||
soco-cli ❯ pip3 install -r requirements.txt
|
||||
soco-cli ❯ deactivate
|
||||
```
|
||||
|
||||
```
|
||||
❯ $HOME/Documents/venv/soco-cli/bin/soco -v
|
||||
soco-cli version: 0.4.52
|
||||
soco version: 0.28.0
|
||||
python version: 3.10.8
|
||||
command path: /Users/bruno/Documents/venv/soco-cli/bin/soco
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Installer LiveboxMonitor dans un venv
|
||||
|
||||
Cloner le [dépot](https://p-dor.github.io/LiveboxMonitor/):
|
||||
|
||||
```bash
|
||||
~/Downloads $ git clone https://github.com/p-dor/LiveboxMonitor.git
|
||||
```
|
||||
|
||||
Créer le venv:
|
||||
|
||||
```bash
|
||||
~/Documents/venv $ python -m venv liveboxmonitor
|
||||
```
|
||||
|
||||
Activer le venv:
|
||||
|
||||
```bash
|
||||
~/Documents/venv $ source liveboxmonitor/bin/activate
|
||||
```
|
||||
|
||||
Mettre à jour:
|
||||
|
||||
```bash
|
||||
~/Documents/venv liveboxmonitor ❯ pip3 install -U pip setuptools wheel
|
||||
Requirement already satisfied: pip in ./liveboxmonitor/lib/python3.10/site-packages (23.0)
|
||||
Requirement already satisfied: setuptools in ./liveboxmonitor/lib/python3.10/site-packages (67.2.0)
|
||||
Collecting setuptools
|
||||
```
|
||||
|
||||
Copier LiveboxMonitor dans le venv:
|
||||
|
||||
```bash
|
||||
~/Downloads/LiveboxMonitor $ cp -R * ~/Documents/venv/liveboxmonitor
|
||||
```
|
||||
|
||||
Installer les dépendances:
|
||||
|
||||
```bash
|
||||
~/Documents/venv/liveboxmonitor
|
||||
liveboxmonitor ❯ pip3 install -r requirements.txt
|
||||
Collecting PyQt6
|
||||
```
|
||||
|
||||
Créer un exécutable avec [PyInstaller](https://pyinstaller.org/en/stable/index.html):
|
||||
|
||||
```bash
|
||||
pyinstaller --paths liveboxmonitor/lib/python3.10/site-packages LiveboxMonitor.py
|
||||
|
||||
# Ne marche pas: PyQt6 est installé dans /opt/homebrew/lib
|
||||
```
|
||||
|
||||
https://stackoverflow.com/questions/55312146/how-to-include-only-needed-modules-in-pyinstaller#55312170
|
||||
|
||||
@@ -62,7 +62,11 @@ Current installation options:
|
||||
|
||||
|
||||
|
||||
### Installer kiro-editor:
|
||||
### Cargo:
|
||||
|
||||
Cargo est le gestionnaire de paquets de Rust.
|
||||
|
||||
#### Installer un paquet:
|
||||
|
||||
```bash
|
||||
$ cargo install kiro-editor
|
||||
@@ -108,3 +112,231 @@ $ cargo install kiro-editor
|
||||
|
||||
```
|
||||
|
||||
Les paquets sont installés dans `~/.cargo/bin`
|
||||
|
||||
```bash
|
||||
~/.cargo/bin 11:33:15
|
||||
❯ ls -la
|
||||
total 3492
|
||||
drwxr-xr-x 16 bruno staff 512 mai 9 2022 .
|
||||
drwxr-xr-x 8 bruno staff 256 fév 4 2022 ..
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 cargo -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 cargo-clippy -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 cargo-fmt -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 cargo-miri -> /opt/homebrew/bin/rustup-init
|
||||
-rwxr-xr-x 1 bruno staff 2483315 mai 9 2022 cavif
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 clippy-driver -> /opt/homebrew/bin/rustup-init
|
||||
-rwxr-xr-x 1 bruno staff 1088162 fév 4 2022 kiro
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rls -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rust-gdb -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rust-lldb -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rustc -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rustdoc -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rustfmt -> /opt/homebrew/bin/rustup-init
|
||||
lrwxr-xr-x 12 bruno staff 29 fév 4 2022 rustup -> /opt/homebrew/bin/rustup-init
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Chercher un paquet:
|
||||
|
||||
```bash
|
||||
$ cargo search avif
|
||||
avif = "0.0.0" # RESERVED. Open for adoption by projects that fulfill some criteria. Please see the gist in the home…
|
||||
avif-serialize = "0.7.6" # Minimal writer for AVIF header structure (MPEG/HEIF/MIAF/ISO-BMFF)
|
||||
avif-decode = "0.2.2" # Convert AVIF images to PNG or decompressed pixel data
|
||||
avif-parse = "1.0.0" # Parser for AVIF image files
|
||||
cavif = "1.4.0" # Encodes images in AVIF format (image2avif converter) using a pure-Rust encoder.
|
||||
ravif = "0.9.1" # rav1e-based pure Rust library for encoding images in AVIF format (powers the `cavif` tool)
|
||||
libavif = "0.10.1" # High-level API for AVIF image files
|
||||
libavif-image = "0.9.0" # Load AVIF files into the `image` crate
|
||||
aom-decode = "0.2.4" # Minimal safe wrapper for libaom AV1 decoder
|
||||
libavif-sys = "0.13.1" # Unsafe wrapper around libavif, the image codec
|
||||
... and 23 crates more (use --limit N to see more)
|
||||
```
|
||||
|
||||
#### Supprimer un paquet:
|
||||
|
||||
```bash
|
||||
$ cargo uninstall kiro-editor
|
||||
|
||||
Removing /Users/bruno/.cargo/bin/kiro
|
||||
```
|
||||
|
||||
#### Mettre à jour un paquet:
|
||||
|
||||
```bash
|
||||
$ cargo install <crate>
|
||||
```
|
||||
|
||||
Installe la dernière version du paquet si nécessaire, sinon ne fait rien.
|
||||
|
||||
#### Force la réinstallation:
|
||||
|
||||
-> Supprime le paquet -> télécharge la dernière version -> installe
|
||||
|
||||
```bash
|
||||
$ cargo install --force <crate>
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Liste des paquets installés:
|
||||
|
||||
```bash
|
||||
$ cargo install --list
|
||||
cavif v1.3.4:
|
||||
cavif
|
||||
kiro-editor v0.4.3:
|
||||
kiro
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cat .crates2.json | jq .
|
||||
{
|
||||
"installs": {
|
||||
"cavif 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)": {
|
||||
"version_req": null,
|
||||
"bins": [
|
||||
"cavif"
|
||||
],
|
||||
"features": [],
|
||||
"all_features": false,
|
||||
"no_default_features": false,
|
||||
"profile": "release",
|
||||
"target": "aarch64-apple-darwin",
|
||||
"rustc": "rustc 1.58.1 (db9d1b20b 2022-01-20)\nbinary: rustc\ncommit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b\ncommit-date: 2022-01-20\nhost: aarch64-apple-darwin\nrelease: 1.58.1\nLLVM version: 13.0.0\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Mettre à jour les paquets:
|
||||
|
||||
```bash
|
||||
$ cargo install $(cargo install --list | ggrep -E '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ')
|
||||
Updating crates.io index
|
||||
Ignored package `cavif v1.4.0` is already installed, use --force to override
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://github.com/kbknapp/cargo-outdated
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# https://lib.rs/crates/cargo-cache
|
||||
|
||||
$ cargo install cargo-cache
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cargo cache --autoclean
|
||||
Clearing cache...
|
||||
|
||||
Cargo cache '/Users/bruno/.cargo':
|
||||
|
||||
Total: 737.91 MB => 594.18 MB
|
||||
15 installed binaries: 103.16 MB
|
||||
Registry: 634.75 MB => 491.01 MB
|
||||
Registry index: 457.35 MB
|
||||
291 crate archives: 33.67 MB
|
||||
291 => 0 crate source checkouts: 143.73 MB => 0 B
|
||||
Git db: 0 B
|
||||
0 bare git repos: 0 B
|
||||
0 git repo checkouts: 0 B
|
||||
|
||||
Size changed 737.91 MB => 594.18 MB (-143.73 MB, -19.47%)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ rm -rf ~/.cargo/registry
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# https://lib.rs/crates/cargo-prune
|
||||
|
||||
$ cargo install cargo-prune
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cargo prune
|
||||
```
|
||||
|
||||
|
||||
|
||||
### rustup:
|
||||
|
||||
```bash
|
||||
$ rustup check
|
||||
stable-aarch64-apple-darwin - Update available : 1.61.0 (fe5b13d68 2022-05-18) -> 1.65.0 (897e37553 2022-11-02)
|
||||
rustup - Up to date : 1.25.1
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ rustup show
|
||||
Default host: aarch64-apple-darwin
|
||||
rustup home: /Users/bruno/.rustup
|
||||
|
||||
stable-aarch64-apple-darwin (default)
|
||||
rustc 1.61.0 (fe5b13d68 2022-05-18)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### M-à-J de rustup (réalisée par brew):
|
||||
|
||||
```bash
|
||||
$ rustup self update
|
||||
error: self-update is disabled for this build of rustup
|
||||
error: you should probably use your system package manager to update rustup
|
||||
```
|
||||
|
||||
#### M-à-J de Rust:
|
||||
|
||||
```bash
|
||||
$ rustup update
|
||||
info: syncing channel updates for 'stable-aarch64-apple-darwin'
|
||||
info: latest update on 2022-11-03, rust version 1.65.0 (897e37553 2022-11-02)
|
||||
info: downloading component 'cargo'
|
||||
4.2 MiB / 4.2 MiB (100 %) 1.0 MiB/s in 4s ETA: 0s
|
||||
info: downloading component 'clippy'
|
||||
2.0 MiB / 2.0 MiB (100 %) 1.2 MiB/s in 1s ETA: 0s
|
||||
info: downloading component 'rust-std'
|
||||
27.6 MiB / 27.6 MiB (100 %) 1.1 MiB/s in 28s ETA: 0s
|
||||
info: downloading component 'rustc'
|
||||
52.2 MiB / 52.2 MiB (100 %) 801.6 KiB/s in 1m 7s ETA: 0s
|
||||
info: downloading component 'rustfmt'
|
||||
2.3 MiB / 2.3 MiB (100 %) 757.0 KiB/s in 3s ETA: 0s
|
||||
info: removing previous version of component 'cargo'
|
||||
info: removing previous version of component 'clippy'
|
||||
info: removing previous version of component 'rust-std'
|
||||
info: removing previous version of component 'rustc'
|
||||
info: removing previous version of component 'rustfmt'
|
||||
info: installing component 'cargo'
|
||||
info: installing component 'clippy'
|
||||
info: installing component 'rust-std'
|
||||
27.6 MiB / 27.6 MiB (100 %) 18.2 MiB/s in 1s ETA: 0s
|
||||
info: installing component 'rustc'
|
||||
52.2 MiB / 52.2 MiB (100 %) 20.9 MiB/s in 2s ETA: 0s
|
||||
info: installing component 'rustfmt'
|
||||
|
||||
stable-aarch64-apple-darwin updated - rustc 1.65.0 (897e37553 2022-11-02) (from rustc 1.61.0 (fe5b13d68 2022-05-18))
|
||||
|
||||
info: cleaning up downloads & tmp directories
|
||||
info: self-update is disabled for this build of rustup
|
||||
info: any updates to rustup will need to be fetched with your system package manager
|
||||
```
|
||||
|
||||
```bash
|
||||
$ rustup check
|
||||
stable-aarch64-apple-darwin - Up to date : 1.65.0 (897e37553 2022-11-02)
|
||||
rustup - Up to date : 1.25.1
|
||||
```
|
||||
|
||||
|
||||
51
docs/macos/terminal/mdfind.md
Normal file
51
docs/macos/terminal/mdfind.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# mdfind
|
||||
|
||||
#### find + Spotlight
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### Opérateurs logiques: AND, OR, NOT
|
||||
|
||||
|
||||
|
||||
Par nom de fichier: `name:<keyword>`
|
||||
|
||||
Par créateur: `author:<author>`
|
||||
|
||||
Par date: `date:today` (today, yesterday et tomorrow)
|
||||
|
||||
Par de création: `created:12/25/07`
|
||||
|
||||
Par date de modification: `modified:<11/30/06`
|
||||
|
||||
Par type de fichier:
|
||||
|
||||
| Aliases | kind:alias |
|
||||
| ----------------- | --------------------------------------------- |
|
||||
| Applications | kind:application, kind:applications, kind:app |
|
||||
| Audio | kind:audio |
|
||||
| Bookmarks | kind:bookmark, kind:bookmarks |
|
||||
| Browser history | kind:history |
|
||||
| Contacts | kind:contact, kind:contacts |
|
||||
| E-mail messages | kind:email, kind:emails, kind:mail message |
|
||||
| Folders | kind:folder, kind:folders, kind:fol |
|
||||
| Fonts | kind:font, kind:fonts |
|
||||
| iCal Events | kind:event, kind:events |
|
||||
| iCal To-Do Items | kind:todo, kind:todos, kind:to do |
|
||||
| Images | kind:image, kind:images |
|
||||
| JPEG files | kind:jpeg |
|
||||
| Keynote files | kind:keynote |
|
||||
| Movies | kind:movie, kind:movies |
|
||||
| MP3 files | kind:mp3 |
|
||||
| Music | kind:music |
|
||||
| Numbers documents | kind:numbers |
|
||||
| Pages documents | kind:pages |
|
||||
| PDF files | kind:pdf, kind:pdfs |
|
||||
| PowerPoint files | kind:powerpoint |
|
||||
| Preference panes | kind:preference, kind:preferences |
|
||||
| Presentations | kind:presentation, kind:presentations |
|
||||
| QuickTime files | kind:quicktime |
|
||||
| TIFF files | kind:tiff |
|
||||
| Word documents | kind:word |
|
||||
117
docs/macos/terminal/reachable.md
Normal file
117
docs/macos/terminal/reachable.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# Reachable
|
||||
|
||||
### ping
|
||||
|
||||
```bash
|
||||
❯ ping -c1 -W1 -q maboiteverte.fr
|
||||
PING maboiteverte.fr (212.227.191.167): 56 data bytes
|
||||
|
||||
--- maboiteverte.fr ping statistics ---
|
||||
1 packets transmitted, 0 packets received, 100.0% packet loss
|
||||
|
||||
# immédiat
|
||||
|
||||
❯ echo $?
|
||||
0
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ ping -c1 -W1 -q clicclac.synology.me
|
||||
PING clicclac.synology.me (192.168.2.7): 56 data bytes
|
||||
|
||||
--- clicclac.synology.me ping statistics ---
|
||||
1 packets transmitted, 0 packets received, 100.0% packet loss
|
||||
|
||||
# immédiat
|
||||
|
||||
❯ echo $?
|
||||
2
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ ping -c1 -W1 -q google.fr
|
||||
PING google.fr (216.58.213.67): 56 data bytes
|
||||
|
||||
--- google.fr ping statistics ---
|
||||
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||
round-trip min/avg/max/stddev = 19.936/19.936/19.936/0.000 ms
|
||||
|
||||
❯ echo $?
|
||||
0
|
||||
```
|
||||
|
||||
|
||||
|
||||
### nmap
|
||||
|
||||
```bash
|
||||
❯ nmap maboiteverte.fr -PN -p 22 | grep open
|
||||
22/tcp open ssh
|
||||
|
||||
# immédiat
|
||||
|
||||
❯ echo $?
|
||||
0
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ nmap clicclac.synology.me -PN -p 42666 | grep open
|
||||
|
||||
# 2s
|
||||
|
||||
❯ echo $?
|
||||
1
|
||||
```
|
||||
|
||||
```bash
|
||||
if [ "$?" = 0 ]
|
||||
then
|
||||
echo "Host found"
|
||||
else
|
||||
echo "Host not found"
|
||||
fi
|
||||
```
|
||||
|
||||
|
||||
|
||||
# nc
|
||||
|
||||
```bash
|
||||
❯ nc -z -G 2 maboiteverte.fr 22
|
||||
Connection to maboiteverte.fr port 22 [tcp/ssh] succeeded!
|
||||
|
||||
# immédiat
|
||||
|
||||
❯ echo $?
|
||||
0
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ nc -z -G 2 clicclac.synology.me 42666
|
||||
|
||||
# 3s
|
||||
|
||||
❯ echo $?
|
||||
1
|
||||
```
|
||||
|
||||
|
||||
|
||||
# ssh
|
||||
|
||||
```bash
|
||||
❯ &>/dev/null ssh bruno@maboiteverte.fr true && echo "up" || echo "down"
|
||||
up
|
||||
|
||||
# 2s
|
||||
```
|
||||
|
||||
```bash
|
||||
❯ &>/dev/null ssh bruno@clicclac.synology.me true && echo "up" || echo "down"
|
||||
down
|
||||
|
||||
# long 75s
|
||||
```
|
||||
|
||||
@@ -74,6 +74,33 @@ $ xattr -d com.apple.quarantine /Users/bruno/.local/bin/convert-videos-for-plex.
|
||||
|
||||
|
||||
|
||||
#### Erreur: '/usr/bin/env : mauvais interpréteur: Operation not permitted'
|
||||
|
||||
```bash
|
||||
/usr/local/bin/kymsu2: /Users/bruno/.kymsu/plugins.d/00-kymsu.sh : /usr/bin/env : mauvais interpréteur: Operation not permitted
|
||||
```
|
||||
|
||||
```bash
|
||||
$ xattr -l 00-kymsu.sh
|
||||
com.apple.TextEncoding: UTF-8;134217984
|
||||
com.apple.lastuseddate#PS: J<><4A>b
|
||||
com.apple.provenance:
|
||||
com.apple.quarantine: 0086;62df747e;BBEdit;
|
||||
```
|
||||
|
||||
Pour supprimer la quarantaine:
|
||||
|
||||
```bash
|
||||
$ xattr -d com.apple.quarantine 00-kymsu.sh
|
||||
|
||||
$ xattr -l 00-kymsu.sh
|
||||
com.apple.TextEncoding: UTF-8;134217984
|
||||
com.apple.lastuseddate#PS: J<><4A>b
|
||||
com.apple.provenance:
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Raccourcis:
|
||||
|
||||
Aller en début de ligne: `CTRL+A`
|
||||
|
||||
82
docs/macos/terminal/trash.md
Normal file
82
docs/macos/terminal/trash.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# trash
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### trash
|
||||
|
||||
http://hasseg.org/trash/
|
||||
|
||||
```bash
|
||||
brew install trash
|
||||
```
|
||||
|
||||
```bash
|
||||
trash <file>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### macos-trash
|
||||
|
||||
https://github.com/sindresorhus/macos-trash
|
||||
|
||||
```bash
|
||||
brew install macos-trash
|
||||
```
|
||||
|
||||
```bash
|
||||
trash <file>
|
||||
```
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
### AppleScript
|
||||
|
||||
```bash
|
||||
osascript -e "tell application \"Finder\" to delete POSIX file \"${PWD}/${InputFile}\""
|
||||
```
|
||||
|
||||
```bash
|
||||
trash() (
|
||||
: "${1:?}"
|
||||
case $1 in
|
||||
(/*) FNAME="$1" ;;
|
||||
(*) FNAME="$(pwd)/$1"
|
||||
esac
|
||||
export FNAME
|
||||
exec osascript <<-EOF >/dev/null
|
||||
set fName to system attribute "FNAME"
|
||||
tell application "Finder" to delete my (POSIX file fName)
|
||||
EOF
|
||||
)
|
||||
```
|
||||
|
||||
```bash
|
||||
function rem {
|
||||
for b in "$@"
|
||||
do
|
||||
osascript -e "tell app \"Finder\" to delete POSIX file \"${PWD}/$b\""
|
||||
done
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
trash() { mv -fv "$@" ~/.Trash/ ; }
|
||||
|
||||
#
|
||||
```
|
||||
|
||||
```
|
||||
/Volumes/Sharon/Windows ❯ trash Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx
|
||||
copied 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx' -> '/Users/bruno/.Trash/Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
|
||||
removed 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
|
||||
|
||||
/Volumes/Sharon/Windows 25s 09:06:33
|
||||
```
|
||||
|
||||
11
docs/macos/trucs.md
Normal file
11
docs/macos/trucs.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Trucs
|
||||
|
||||
|
||||
|
||||
#### Désactiver la caméra dans macOS:
|
||||
|
||||
https://github.com/rthomson/isight-disabler
|
||||
|
||||
Télécharger [camera-disabler.mobileconfig](https://github.com/rthomson/isight-disabler/blob/master/camera-disabler.mobileconfig)
|
||||
|
||||
Installer le [profile](https://support.apple.com/fr-fr/guide/profile-manager/pmdbd71ebc9/mac)
|
||||
@@ -705,8 +705,36 @@ $ brew services restart httpd
|
||||
|
||||
|
||||
|
||||
### cgi
|
||||
|
||||
```http
|
||||
LoadModule mpm_prefork_module lib/httpd/modules/mod_mpm_prefork.so
|
||||
|
||||
<IfModule mpm_prefork_module>
|
||||
LoadModule cgi_module lib/httpd/modules/mod_cgi.so
|
||||
</IfModule>
|
||||
|
||||
# Options Indexes FollowSymLinks ExecCGI
|
||||
|
||||
ScriptAlias /cgi-bin/ "/opt/homebrew/var/www/cgi-bin/"
|
||||
|
||||
<Directory "/opt/homebrew/var/www/cgi-bin">
|
||||
AllowOverride None
|
||||
Options None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
# AddHandler cgi-script .cgi .sh
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Liens:
|
||||
|
||||
[:fa-link: https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions](https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions)
|
||||
|
||||
[:fa-link: https://lukearmstrong.github.io/2016/12/setup-apache-mysql-php-homebrew-macos-sierra/](https://lukearmstrong.github.io/2016/12/setup-apache-mysql-php-homebrew-macos-sierra/)
|
||||
[:fa-link: https://lukearmstrong.github.io/2016/12/setup-apache-mysql-php-homebrew-macos-sierra/](https://lukearmstrong.github.io/2016/12/setup-apache-mysql-php-homebrew-macos-sierra/)
|
||||
|
||||
[:fa-link: https://httpd.apache.org/docs/2.4/howto/cgi.html](https://httpd.apache.org/docs/2.4/howto/cgi.html)
|
||||
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
|
||||
[composer](composer.md)
|
||||
|
||||
[MySQL](mysql)
|
||||
[MySQL](mysql.md)
|
||||
|
||||
[mongodb](mongodb)
|
||||
[mongodb](mongodb.md)
|
||||
|
||||
[PHP](php.md)
|
||||
|
||||
[PHP 7.2](php72)
|
||||
|
||||
[PHP 7.3](php73.md)
|
||||
|
||||
[PHP 7.4](php74.md)
|
||||
|
||||
[PHP 8.0](php80.md)
|
||||
|
||||
[Protéger l'accès à une page par un mot-de-passe](htpasswd.md)
|
||||
|
||||
[Xhprof](Xhprof.md)
|
||||
|
||||
@@ -6,14 +6,14 @@ Mac intel:
|
||||
|
||||
```bash
|
||||
$ nano /usr/local/etc/php/7.4/php.ini
|
||||
$ nano /usr/local/etc/php/8.0/php.ini
|
||||
$ nano /usr/local/etc/php/8.2/php.ini
|
||||
```
|
||||
|
||||
Mac M1:
|
||||
|
||||
```bash
|
||||
$ nano /opt/homebrew/etc/php/7.4/php.ini
|
||||
$ nano /opt/homebrew/etc/php/8.0/php.ini
|
||||
$ nano /opt/homebrew/etc/php/8.2/php.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ $ brew link --overwrite --force php
|
||||
brew services restart shivammathur/php/php # php 8.0
|
||||
brew services restart shivammathur/php/php@7.4
|
||||
brew services restart shivammathur/php/php@8.1
|
||||
brew services restart shivammathur/php/php@8.2
|
||||
```
|
||||
|
||||
|
||||
@@ -90,7 +91,7 @@ $ php -i
|
||||
/opt/homebrew/var/log/php-fpm.log
|
||||
```
|
||||
|
||||
|
||||
/opt/homebrew/var/php_errors.log
|
||||
|
||||
### Extensions:
|
||||
|
||||
@@ -168,20 +169,47 @@ extension="/opt/homebrew/opt/imagick@8.0/imagick.so"
|
||||
|
||||
|
||||
```bash
|
||||
$ brew install memcached@8.0
|
||||
$ brew install shivammathur/extensions/memcached@8.1
|
||||
|
||||
# Fichier config
|
||||
/opt/homebrew/etc/php/7.4/conf.d/memcached.ini # M1
|
||||
/usr/local/etc/php/8.0/conf.d/memcached.ini # intel
|
||||
/opt/homebrew/etc/php/8.1/conf.d/30-memcached.ini # M1
|
||||
/usr/local/etc/php/8.1/conf.d/memcached.ini # intel
|
||||
|
||||
# Memcached dépend de 2 extensions
|
||||
/opt/homebrew/etc/php/8.1/conf.d/20-igbinary.ini
|
||||
/opt/homebrew/etc/php/8.1/conf.d/20-msgpack.ini
|
||||
# qui doivent être chargées avant, d'où la priorité 20- pour igbinary et msgpack et 30- pour memcached.
|
||||
```
|
||||
|
||||
Si la priorité n'est pas respectée:
|
||||
|
||||
```bash
|
||||
$ nano /opt/homebrew/etc/php/7.4/conf.d/memcached.ini
|
||||
/opt/homebrew/etc/php/8.1/conf.d ls
|
||||
|
||||
/opt/homebrew/etc/php/8.1/conf.d/igbinary.ini
|
||||
/opt/homebrew/etc/php/8.1/conf.d/msgpack.ini
|
||||
/opt/homebrew/etc/php/8.1/conf.d/memcached.ini
|
||||
```
|
||||
|
||||
on a une erreur:
|
||||
|
||||
```php
|
||||
PHP Startup: Unable to load dynamic library '/opt/homebrew/opt/memcached@8.1/memcached.so'
|
||||
symbol not found in flat namespace '_php_msgpack_serialize')
|
||||
|
||||
PHP Startup: Unable to load dynamic library '/opt/homebrew/opt/memcached@8.1/memcached.so'
|
||||
symbol not found in flat namespace '_php_igbinary_serialize')
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ nano /opt/homebrew/etc/php/8.1/conf.d/30-memcached.ini
|
||||
```
|
||||
|
||||
```php
|
||||
[memcached]
|
||||
extension="/opt/homebrew/opt/memcached@7.4/memcached.so"
|
||||
extension="/opt/homebrew/opt/memcached@78.1/memcached.so"
|
||||
```
|
||||
|
||||
|
||||
|
||||
92
docs/macos/webserver/redis.md
Normal file
92
docs/macos/webserver/redis.md
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
|
||||
# redis
|
||||
|
||||
|
||||
|
||||
### Installation:
|
||||
|
||||
```bash
|
||||
$ brew install redis
|
||||
```
|
||||
|
||||
### Redémarrer:
|
||||
|
||||
```bash
|
||||
$ brew services restart redis
|
||||
```
|
||||
|
||||
### Le fichier de config:
|
||||
|
||||
```bash
|
||||
/opt/homebrew/etc/redis.conf
|
||||
```
|
||||
|
||||
### Tester redis:
|
||||
|
||||
```bash
|
||||
$ redis-server
|
||||
30766:C 25 Jul 2022 11:46:58.611 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
|
||||
30766:C 25 Jul 2022 11:46:58.611 # Redis version=7.0.3, bits=64, commit=00000000, modified=0, pid=30766, just started
|
||||
30766:C 25 Jul 2022 11:46:58.611 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
|
||||
30766:M 25 Jul 2022 11:46:58.612 * Increased maximum number of open files to 10032 (it was originally set to 256).
|
||||
30766:M 25 Jul 2022 11:46:58.612 * monotonic clock: POSIX clock_gettime
|
||||
_._
|
||||
_.-``__ ''-._
|
||||
_.-`` `. `_. ''-._ Redis 7.0.3 (00000000/0) 64 bit
|
||||
.-`` .-```. ```\/ _.,_ ''-._
|
||||
( ' , .-` | `, ) Running in standalone mode
|
||||
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
|
||||
| `-._ `._ / _.-' | PID: 30766
|
||||
`-._ `-._ `-./ _.-' _.-'
|
||||
|`-._`-._ `-.__.-' _.-'_.-'|
|
||||
| `-._`-._ _.-'_.-' | https://redis.io
|
||||
`-._ `-._`-.__.-'_.-' _.-'
|
||||
|`-._`-._ `-.__.-' _.-'_.-'|
|
||||
| `-._`-._ _.-'_.-' |
|
||||
`-._ `-._`-.__.-'_.-' _.-'
|
||||
`-._ `-.__.-' _.-'
|
||||
`-._ _.-'
|
||||
`-.__.-'
|
||||
|
||||
30766:M 25 Jul 2022 11:46:58.613 # WARNING: The TCP backlog setting of 511 cannot be enforced because kern.ipc.somaxconn is set to the lower value of 128.
|
||||
30766:M 25 Jul 2022 11:46:58.613 # Server initialized
|
||||
30766:M 25 Jul 2022 11:46:58.613 * Ready to accept connections
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Démarrer redis:
|
||||
|
||||
```bash
|
||||
❯ brew services start redis
|
||||
==> Successfully started `redis` (label: homebrew.mxcl.redis)
|
||||
```
|
||||
|
||||
### Si le service est actif:
|
||||
|
||||
```bash
|
||||
❯ brew services info redis
|
||||
redis (homebrew.mxcl.redis)
|
||||
Running: ✔
|
||||
Loaded: ✔
|
||||
Schedulable: ✘
|
||||
User: bruno
|
||||
PID: 31087
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Se connecter à redis:
|
||||
|
||||
```bash
|
||||
❯ redis-cli
|
||||
127.0.0.1:6379> lpush demos redis-macOS-demo
|
||||
(integer) 1
|
||||
127.0.0.1:6379> rpop demos
|
||||
"redis-macOS-demo"
|
||||
127.0.0.1:6379> ping
|
||||
PONG
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user