16-03-2021

This commit is contained in:
2021-03-16 06:57:22 +01:00
parent fb07a20b0c
commit e02b036875
27 changed files with 1860 additions and 128 deletions

View File

@@ -2,7 +2,7 @@
#### screentech:
#### screenfetch:
```bash
screenfetch

View File

@@ -0,0 +1,20 @@
# zsh
### Changer de Shell:
Ajouter les shells à la liste de Shells:
```bash
echo "/bin/zsh" | sudo tee -a /etc/shells
echo "/bin/bash" | sudo tee -a /etc/shells
```
Changer le shell par défaut:
```bash
sudo chsh -s /bin/zsh
```
Log out / log back pour prendre effet.

View File

@@ -0,0 +1,74 @@
# Update
| **Update** | |
| ----------------- | ------------------------------------------------------------ |
| `apt update` | recherche les mises-à-jour disponibles en se basant sur les sources définies dans `/etc/apt/source.list` |
| `apt-get update` | |
| `aptitude update` | |
| **Upgrade** | |
| ----------------------- | ------------------------------------------------------------ |
| `apt upgrade` | installe les paquets mis-à-jour identifiées par `apt update` sans en installer de nouveau |
| `apt-get upgrade` | installe les paquets mis-à-jour identifiées par `apt update`et nouveaux pour satisfaire les dépendances |
| `aptitude safe-upgrade` | installe les paquets mis-à-jour identifiées par `apt update`. Les paquets installés ne sont pas retirés sauf s'ils sont inutilisés |
| **Full-upgrade** | |
| ------------------ | ------------------------------------------------------------ |
| `apt full-upgrade` | installe les mises-à-jour dentifiées par `apt update`et gère les dépendances |
| `apt dist-upgrade` | à utiliser lors de la mise à jour du système (Debian 9 à Debian 10) |
| | |
| **Search** | |
| ----------------------- | ------------------------------------------------------------ |
| `apt search` node | recherche un package donné dans la liste des packages disponibles |
| `apt-cache search` node | |
| | |
| **Install** | |
| ---------------------- | ---- |
| `apt install` node | |
| `apt-get install` node | |
| | |
| | |
| --------------------- | ------------------------------- |
| `apt show` node | Affiche les infos sur un paquet |
| `apt-cache show` node | |
| | |
| **List** | |
| ------------------------ | -------------------------------------------------- |
| `apt list` | Liste de tous les packages dispos |
| `apt list --installed` | Liste de tous les packages installés |
| `apt list --upgradeable` | Liste de tous les packages pouvant être mis-à-jour |
| **Remove** | |
| ----------------- | ------------------------ |
| `apt remove` node | Supprime le package node |
| | |
| | |
| | |
| ----------------- | ----------------------------------------------------- |
| `apt auto-remove` | Supprime des dépendances qui ne sont plus nécessaires |
| | |
| | |

View File

@@ -0,0 +1,88 @@
# Commandes bash
#### history
```bash
# Synology
$ history
502 cd `/usr/local/etc/apache24`
503 cd /usr/local/etc/apache24
504 cd conf
505 nano httpd24.conf
506 cd
507 cd .ssh/
508 chown http:http wp*
509 sudo chown http:http wp*
510 l
511 cat wp_rsa
512 sudo cat wp_rsa
513 sudo cat id_rsa
514 ssh-keygen -t rsa -b 1024
515 l
516 cat wp_rsa
517 sudo cat wp_rsa
518 l
519 sudo rm wp*
520 l
521 history
```
```bash
$ history | grep 'chmod'
250 sudo chmod -R 755 gallery/
251 sudo chmod -R 644 gallery/
252 sudo chmod -R 755 gallery/
275 sudo chmod -R 755 public/
358 chmod -R 755 public/
359 sudo chmod -R 755 public/
360 sudo chmod -R 755 public/
361 sudo chmod -R 755 public/
407 sudo chmod -R 755 gallery/
408 sudo chmod -R 755 /volume1/web/gallery/
526 history | grep 'chmod'
```
```bash
# macOS
$ history
5020* git clone https://github.com/thumbsup/theme-flow.git
5021* l
5024* cd Scripts/kymsu2/plugins.d
5026* mas outdated --help
5027* mas outdated help
5028* mas --help
5029* mas help
5030* mas help outdated
5031* mas help info
5032* mas info 1243909868
5033* ./mas.sh
5034* mas outdated
5035* mas info 784466108
5036* mas info 1526844137
5038 kymsu2
5039* 916e
```
```bash
$ history | grep mas
5031* mas help info
5032* mas info 1243909868
5033* ./mas.sh
5034* mas outdated
5035* mas info 784466108
5036* mas info 1526844137
```

View File

@@ -161,7 +161,9 @@ https://github.com/thumbsup/thumbsup
Sur le NAS Synology, impossible d'installer thumbsup avec nvm (erreur à la compilation de `better_sqlite3`).
Sur le NAS Synology, erreur avec <u>thumbsup (1.15) installé avec npm et GraphicMagick</u>.
Il faut passer par **Docker**:
@@ -241,6 +243,158 @@ La galerie est alors accessible depuis http://192.168.1.7/thumbsup/index.html.
#### **Update 15/03/2021:**
```bash
bruno@DS916:/volume1/photo/thumbsup $ ls -la
-rwxrwxrwx 1 bruno users 440 Mar 12 06:51 config-npm.json
-rwxrwxrwx 1 bruno users 487 Mar 14 18:19 config.json
-rwxrwxrwx 1 bruno users 459 Mar 14 10:52 config.json.bak
drwxrwxrwx 1 bruno users 124 Mar 14 12:48 theme-flow
drwxrwxrwx 1 bruno users 122 Nov 29 14:35 theme-flow-bruno
-rwxrwxrwx 1 bruno users 24 Nov 15 12:51 theme_options.json
-rwxrwxrwx 1 bruno users 428 Mar 14 11:58 thumbsup.sh
-rwxrwxrwx 1 bruno users 303 Mar 15 09:40 thumbsup_update.sh
```
<u>Fichier de configuration de thumbsup</u> (config.json):
```json
{
"input": "/input/Flore",
"output": "/output/gallery",
"exclude": ["_Archived Items/","thumbsup"],
"include-raw-photos": true,
"thumb-size": 250,
"large-size": 1600,
"photo-download": "symlink",
"cleanup": true,
"sort-albums-by": "title",
"sort-media-by": "date",
"sort-media-direction": "desc",
"home-album-name": "Accueil",
"theme-path": "/input/thumbsup/theme-flow/theme",
"title": "Photos...",
"embed-exif": true,
"locale": "fr",
"footer": "bruno@clicclac.info"
}
```
<u>Fichier de configuration du thème</u> (theme_options.json):
```bash
{
sliderInterval: 500
}
```
Pour lancer **thumbsup**:
```bash
bruno@DS916:/volume1/photo/thumbsup $ ./thumbsup.sh
```
```bash
$ nano thumbsup.sh
```
```bash
#/bin/bash -e
sudo docker run -t \
-v /volume1/photo:/input:ro \
-v /volume1/web:/output \
thumbsupgallery/thumbsup:latest \
thumbsup --config "/input/thumbsup/config.json"
echo "Changing forder permission /volume1/web/gallery/ ..."
# files/folders in /gallery/public don't have permissions, so we change them to 755
sudo chmod -R 755 /volume1/web/gallery/
echo "Go to https://clicclac.synology.me/gallery/"
echo ""
```
<u>Problème:</u> à chaque fois que l'on lance le script, un nouveau container thumbsupgallery est crée.
On va donc crée un <u>container thumbsupgallery</u> et on lui donne un nom (<u>thumbsup2.15</u>):
```bash
sudo docker run --name thumbsup2.15 -t -v /volume1/photo:/input:ro -v /volume1/web:/output thumbsupgallery/thumbsup:latest thumbsup --config "/input/thumbsup/config.json"
```
Par la suite, pour mettre à jour la galerie, on se contentera de relancer le <u>container thumbsup2.15</u>:
```bash
$ nano thumbsup_update.sh
```
```bash
#/bin/bash -e
# Ne pas oublier l'option -i (attach the containers STDIN)
sudo docker start -i thumbsup2.15
echo ""
echo "Changing forder permission /volume1/web/gallery/ ..."
# files/folders in /gallery/public don't have permissions, so we change them to 755
sudo chmod -R 755 /volume1/web/gallery/
echo "Go to https://clicclac.synology.me/gallery/"
echo ""
```
Pour re-lancer **thumbsup** et mettre à jour la galerie:
```bash
bruno@DS916:/volume1/photo/thumbsup $ ./thumbsup_update.sh
```
Quand on crée la galerie sur /volume1/web/gallery, il y a un problème avec le thème: les éléments du dossier <u>public</u> (theme-flow/theme/public) <u>n'ont pas les bonnes permissions</u>, d'où des <u>erreurs 403</u> sur les fichiers js/css... Il faut donc corriger les permissions:
```bash
$ sudo chmod -R 755 /volume1/web/gallery/
```
#### Galerie (/volume1/web/gallery):
Le dossier export est dans le root du serveur web:
```bash
bruno@DS916:/volume1/web $ ls -la
drwxr-xr-x 1 bruno users 164 Mar 14 21:12 gallery
bruno@DS916:/volume1/web $ cd gallery/
drwxr-xr-x 1 bruno users 164 Mar 14 21:12 .
drwxrwxrwx 1 root root 406 Mar 14 11:27 ..
-rwxr-xr-x 1 root root 41664 Mar 15 09:35 Arbres.html
-rwxr-xr-x 1 root root 6458 Mar 15 09:35 Champignons.html
-rwxr-xr-x 1 root root 56283 Mar 15 09:35 Fleurs.html
-rwxr-xr-x 1 root root 8021 Mar 15 09:35 index.html
drwxr-xr-x 1 root root 48 Mar 14 11:30 media
drwxr-xr-x 1 root root 196 Mar 15 09:35 public
-rwxr-xr-x 1 root root 1019904 Mar 14 21:12 thumbsup.db
-rwxr-xr-x 1 root root 750 Mar 14 18:19 thumbsup.log
```
## emby

View File

@@ -199,9 +199,6 @@ All snaps up to date.
$ snap refresh --time
timer: 00:00~24:00/4
last: today at 08:55 CET
next: today at 14:11 CET$ snap refresh --time
timer: 00:00~24:00/4
last: today at 08:55 CET
next: today at 14:11 CET
```

View File

@@ -6,83 +6,59 @@
### Nano ([https://www.nano-editor.org/](https://www.nano-editor.org/))
CTRL + A : Permet d'aller au début de la ligne
CTRL + E : Permet d'aller à la fin de la ligne
CTRL + Y : Permet de remonter de page en page
CTRL + V : Permet de descendre de page en page
| Lignes | |
| ------------------------------------------------------------ | -------- |
| aller au début de la ligne | CTRL + A |
| aller à la fin de la ligne | CTRL + E |
| remonter de page en page | CTRL + Y |
| descendre de page en page | CTRL + V |
| se rendre au n° de ligne indiqué | CTRL + _ |
| savoir à quel n° de ligne / colonne / caractère se trouve votre curseu | CTRL + C |
CTRL + _ : Permet de se rendre au n° de ligne indiqué
CTRL + C : Permet de savoir à quel n° de ligne / colonne / caractère se trouve votre curseur
| Couper / coller | |
| ----------------------------------------------------------- | -------- |
| supprimer le caractère sous le curseur | CTRL + D |
| coupe le texte depuis le curseur jusqu'à la fin du fichier | Meta - T |
| supprimer une ligne complète (comme la commande dd sous Vi) | CTRL + K |
| coller une ligne | CTRL + U |
CTRL + W : Permet de faire une [recherche](https://korben.info/recherche-2)
| Divers | |
| ------------------------------------------------------ | -------- |
| faire une [recherche](https://korben.info/recherche-2) | CTRL + W |
| sauvegarder votre fichier | CTRL + O |
| quitter nano | CTRL + X |
| afficher l'aide | CTRL + G |
| masquer / afficher l'aide-mémoire | Meta - X |
CTRL + D : Permet de supprimer le caractère sous le curseur
Meta - T : Coupe le texte depuis le curseur jusqu'à la fin du fichier
| | |
| ---------------------------------- | ------------ |
| déplacer le curseur vers le haut | CTRL + P |
| déplacer le curseur vers le bas | CTRL + N |
| déplacer le curseur vers la droite | CTRL + F |
| déplacer le curseur vers la gauche | CTRL + B |
| se déplacer d'un mot en avant | CTRL + Space |
| se déplacer d'un mot en arrière | Meta - Space |
| sauter au début du paragraphe | Meta - ( |
| sauter à la fin du paragraphe | Meta - ) |
| sauter au début du fichier | Meta - \ |
| sauter à la fin du fichier | Meta - / |
CTRL + K : Permet de supprimer une ligne complète (comme la commande dd sous Vi)
CTRL + U : Coller
CTRL + O : Permet de sauvegarder votre fichier
CTRL + X : Permet de quitter nano
CTRL + G : Affiche l'aide
Meta - X : Masquer / afficher l'aide-mémoire
CTRL + P : déplace le curseur vers le haut
CTRL + N : déplace le curseur vers le bas
CTRL + F : déplace le curseur vers la droite
CTRL + B : déplace le curseur vers la gauche
CTRL + Space : se déplace d'un mot en avant
Meta - Space : se déplace d'un mot en arrière
Meta - ( : saute au début du paragraphe
Meta - ) : saute à la fin du paragraphe
Meta - \ : saute au début du fichier
Meta - / : saute à la fin du fichier
Meta - U : annuler
Meta - E : redo
Meta - A : marquer (début)
Meta - 6 (shift) : copier
| | |
| ----------------------- | ---------------- |
| annuler la modification | Meta - U |
| redo | Meta - E |
| marquer (début) | Meta - A |
| copier | Meta - 6 (shift) |
@@ -114,6 +90,8 @@ CTRL + _ : aller à la ligne xx
Meta sur macOS: ESC puis <touche>
> iTerm2: Profifes -> Edit -> Keys -> Left Option key = Esc+
#### Copier / couper / coller sous nano

View File

@@ -5,13 +5,13 @@
Créer une archive tar: **tar -cvf**
```bash
root@DiskStation:~ # tar -cvf archive.tar .profile .bashrc test-dossier/
$ tar -cvf archive.tar .profile .bashrc test-dossier/
```
Afficher le contenu de l'archive sans l'extraire: **tar -tf**
```bash
root@DiskStation:~ # tar -tf archive.tar
$ tar -tf archive.tar
.profile
.bashrc
test-dossier/
@@ -21,9 +21,9 @@ test-dossier/test-copy-scp.txt
Ajouter un fichier à l'archive: **tar -rvf**
```bash
root@DiskStation:~ # tar -rvf archive.tar .bash_history
$ tar -rvf archive.tar .bash_history
root@DiskStation:~ # tar -tf archive.tar
$ tar -tf archive.tar
.profile
.bashrc
test-dossier/
@@ -34,7 +34,7 @@ test-dossier/test-copy-scp.txt
Extraire les fichiers de l'archive: **tar -xvf**
```bash
root@DiskStation:~ # tar -xvf archive.tar
$ tar -xvf archive.tar
```
@@ -44,7 +44,7 @@ root@DiskStation:~ # tar -xvf archive.tar
Extraire les fichiers de l'archive: **tar zxvf**
```bash
root@DiskStation:~ # tar zxvf archive.tgz
$ tar zxvf archive.tgz
```
@@ -54,18 +54,18 @@ root@DiskStation:~ # tar zxvf archive.tgz
Compresser avec gzip:
```bash
root@DiskStation:~ # gzip archive.tar
$ gzip archive.tar
root@DiskStation:~ # ls
$ ls
archive.tar.gz
```
Decompresser avec gunzip:
```bash
root@DiskStation:~ # gunzip archive.tar.gz
$ gunzip archive.tar.gz
root@DiskStation:~ # ls
$ ls
archive.tar
```
@@ -78,18 +78,18 @@ Voir le contenu de l'archive avec zcat:
Compresser avec bzip2:
```bash
root@DiskStation:~ # bzip2 archive.tar
$ bzip2 archive.tar
root@DiskStation:~ # ls
$ ls
archive.tar.bz2
```
Decompresser avec bunzip2:
```bash
root@DiskStation:~ # bunzip2 archive.tar.bz2
$ bunzip2 archive.tar.bz2
root@DiskStation:~ # ls archive.tar
$ ls archive.tar
```
@@ -99,7 +99,7 @@ root@DiskStation:~ # ls archive.tar
Compresser avec zip:
```bash
bruno@DS916:~ $ zip -r scripts.zip scripts/
$ zip -r scripts.zip scripts/
adding: scripts/ (stored 0%)
adding: scripts/@eaDir/ (stored 0%)
adding: scripts/@eaDir/ffmpeg@SynoResource (deflated 84%)
@@ -114,13 +114,13 @@ bruno@DS916:~ $ zip -r scripts.zip scripts/
Exclure les fichiers ressources invisibles (“*MACOSX” “.*Filename” “.ds store”):
```bash
bruno@DS916:~ $ zip -r -X scripts.zip scripts/
$ zip -r -X scripts.zip scripts/
```
Décompresser avec zip:
```bash
bruno@DS916:~/test $ unzip scripts.zip
$ unzip scripts.zip
Archive: scripts.zip
creating: scripts/
creating: scripts/@eaDir/
@@ -133,6 +133,46 @@ Archive: scripts.zip
inflating: scripts/ffmpeg-convertMP4v5.sh
```
Voir le contenu d'une archive:
```bash
$ unzip -l vegas.zip
Archive: vegas.zip
Length Date Time Name
--------- ---------- ----- ----
0 10-30-2018 13:43 overlays/
15520 10-30-2018 13:43 vegas.css
23957 10-30-2018 13:43 vegas.js
9459 10-30-2018 13:43 vegas.min.css
16251 10-30-2018 13:43 vegas.min.css.map
10383 10-30-2018 13:43 vegas.min.js
36089 10-30-2018 13:43 vegas.min.js.map
100 10-30-2018 13:43 overlays/01.png
100 10-30-2018 13:43 overlays/02.png
98 10-30-2018 13:43 overlays/03.png
100 10-30-2018 13:43 overlays/04.png
102 10-30-2018 13:43 overlays/05.png
100 10-30-2018 13:43 overlays/06.png
104 10-30-2018 13:43 overlays/07.png
106 10-30-2018 13:43 overlays/08.png
118 10-30-2018 13:43 overlays/09.png
--------- -------
112587 16 files
```
Extraire dans un dossier différent:
```bash
$ unzip -l vegas.zip -d $HOME/Desktop
```
Dézipper une archive protégée:
```bash
$ unzip -P password vegas.zip
```
#### dmg (macOS)
@@ -140,7 +180,7 @@ Archive: scripts.zip
Créer:
```bash
bruno@SilverBook:~$ hdiutil create -format UDZO -srcfolder hubiC/ hubic.dmg
$ hdiutil create -format UDZO -srcfolder hubiC/ hubic.dmg
.........
created: /Users/bruno/hubic.dmg
```
@@ -156,7 +196,7 @@ Différents formats d'image:
Monter:
```bash
bruno@SilverBook:~$ hdiutil attach hubic.dmg
$ hdiutil attach hubic.dmg
Calcul de la somme de contrôle de Protective Master Boot Record (MBR : 0)
Protective Master Boot Record (MBR : : vérifiée CRC32 $DC586CEA
Calcul de la somme de contrôle de GPT Header (Primary GPT Header : 1)
@@ -182,7 +222,7 @@ vérifiée CRC32 $BE421D06
Voir:
```bash
bruno@SilverBook:~$ ls -lah /Volumes/hubiC/
$ ls -lah /Volumes/hubiC/
total 8
drwxr-xr-x 11 bruno staff 442B 12 aoû 12:05 .
drwxr-xr-x@ 6 root wheel 204B 12 aoû 12:07 ..
@@ -198,7 +238,7 @@ drwxr-xr-x 9 bruno staff 306B 6 aoû 17:39 scripts plex 1.0xx
Ejecter:
```bash
bruno@SilverBook:~$ hdiutil eject /Volumes/hubiC/
$ hdiutil eject /Volumes/hubiC/
"disk3" unmounted.
"disk3" ejected.
```
@@ -210,32 +250,32 @@ bruno@SilverBook:~$ hdiutil eject /Volumes/hubiC/
Archiver et compresser en gzip: **tar -zcvf**
```bash
root@DiskStation:~ # tar -zcvf archive.tar.gz .bashrc .profile test-dossier/
$ tar -zcvf archive.tar.gz .bashrc .profile test-dossier/
.bashrc
.profile
test-dossier/
test-dossier/test-copy-scp.txt
root@DiskStation:~ # ls
$ ls
archive.tar.gz
```
Voir le contenu de l'archive gzip: **tar -ztf**
```bash
root@DiskStation:~ # tar -ztf archive.tar.bz2
$ tar -ztf archive.tar.bz2
```
Décompresser: **tar -xzvf**
```bash
root@DiskStation:~ # tar -xzvf archive.tar.gz
$ tar -xzvf archive.tar.gz
.bashrc
.profile
test-dossier/
test-dossier/test-copy-scp.txt
root@DiskStation:~ # ls -la
$ ls -la
drwxr-xr-x 3 root root 4096 Aug 6 07:45 .
drwx—— 8 root root 4096 Aug 6 07:18 ..
-rw-rr 1 root root 953 Aug 5 11:04 .bashrc
@@ -244,7 +284,7 @@ drwx—— 8 root root 4096 Aug 6 07:18 ..
drwxr-xr-x 2 root root 4096 Aug 6 07:04 test-dossier
# décompresser dans un dossier cible
root@DiskStation:~ # tar -xzvf archive.tar.gz -C /tmp/
$ tar -xzvf archive.tar.gz -C /tmp/
```
@@ -254,8 +294,8 @@ root@DiskStation:~ # tar -xzvf archive.tar.gz -C /tmp/
Décompresser: **tar -xf (+ v pour mode verbose)**
```bash
root@DS916:/volume1/web/_archives# tar -xf nextcloud-11.0.2.tar.bz2
root@DS916:/volume1/web/_archives# ls -la
$ tar -xf nextcloud-11.0.2.tar.bz2
$ ls -la
total 137156
@@ -273,19 +313,19 @@ drwxr-xr-x 1 nobody 65534 414 Feb 26 20:44 nextcloud
Extrait le fichier README de l'archive automysqlbackup-v3.0_rc6.tar.gz
```bash
bruno@SilverBook:~/Downloads$ tar --extract --file=automysqlbackup-v3.0_rc6.tar.gz README
$ tar --extract --file=automysqlbackup-v3.0_rc6.tar.gz README
```
Extrait le fichier book.enchant.html du dossier php-chunked-xhtml de l'archive php*manual*fr.tar.gz
```bash
bruno@SilverBook:~/Downloads$ tar --extract --file=php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html
$ tar --extract --file=php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html
```
Extraire plusieurs fichiers d'archive:
```bash
bruno@SilverBook:~/Downloads$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html php-chunked-xhtml/function.mysql-connect.html
$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/book.enchant.html php-chunked-xhtml/function.mysql-connect.html
```
@@ -295,15 +335,24 @@ bruno@SilverBook:~/Downloads$ tar xvf php_manual_fr.tar.gz php-chunked-xhtml/boo
Connaitre la liste des fichiers de l'archive:
```bash
bruno@SilverBook:~/Downloads$ unzip -l zenphoto-zenphoto-1.4.14.zip
$ unzip -l zenphoto-zenphoto-1.4.14.zip
```
Extraire des fichiers de l'archive:
```bash
bruno@SilverBook:~/Downloads$ unzip zenphoto-zenphoto-1.4.14.zip zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
$ unzip zenphoto-zenphoto-1.4.14.zip zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
Archive: zenphoto-zenphoto-1.4.14.zip
4c21854e7a7950ec8d9644a959da019d9781d36c
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/tinymce4/skins/lightgray/img/anchor.gif
inflating: zenphoto-zenphoto-1.4.14/zp-core/zp-extensions/zenpage/zenpage.css
```
```
Dézipper tous les fichiers d'un dossier:
```bash
$ unzip '.zip'
```

View File

@@ -1,4 +1,4 @@
# grep
# interpègrep
@@ -7,21 +7,53 @@ La commande **grep** permet de rechercher une chaîne de caractères dans un fic
Options:
```bash
-i (ignore case) insensible à la casse
-v affiche les lignes ne contenant pas la chaîne
-c (count) compte le nombre de lignes contenant la chaîne
-n (number) chaque ligne contenant la chaîne est numérotée
-x ligne correspondant exactement à la chaîne
-l affiche le nom des fichiers qui contiennent la chaîne
-C (context) fait figurer les deux lignes qui précèdent et suivent la ligne où figure le mot recherché
-Ax (after) affiche les x lignes qui suivent la ligne où figure le mot recherché
-Bx (before) affiche les x lignes qui précèdent la ligne où figure le mot recherché
-r (recursif)
-w mot exact
-E, --extended-regexp interprète la PATTERN comme Expression Régulière Etendue
-F, --fixed-strings interprète la PATTERN comme chaine
-G, --basic-regexp interprète la PATTERN comme chaine Expression Régulière Basique
-P, --perl-regexp interprète la PATTERN comme Expression Régulière PERL (PCRE)
```
```bash
-i, --ignore-case insensible à la casse
-v affiche les lignes ne contenant pas la chaîne
-w, --word-regexp recherche le mot correspondant exactement à la chaîne
-x, --line-regexp recherche ligne correspondant exactement à la chaîne
```
```bash
-c, --count compte le nombre de lignes contenant le fichier / chaîne (associé à -v)
--color (never|always|auto) met en couleur les concordances
-l, --files-with-matches affiche le nom des fichiers qui contiennent la chaîne
-m NUM, --max-count NUM stoppe la lecture du fichier après avoir trouvé NUM lignes
```
```bash
-n, --line-number chaque ligne contenant la chaîne est numérotée
```
```bash
-C NUM, --context=NUM fait figurer les NUM lignes qui précèdent et suivent la ligne où figure le mot recherché
-A NUM, --after-context=NUM affiche les NUM lignes qui suivent la ligne où figure le mot recherché
-B NUM, --before-context=NUM affiche les NUM lignes qui précèdent la ligne où figure le mot recherché
-r (recursif)
```
```bash
```
<u>Chercher dans un dossier (récursif)</u>:
```bash

148
docs/Linux/pushd-popd.md Normal file
View File

@@ -0,0 +1,148 @@
# pushd / popd
### pushd:
```bash
~ master* ⇡
pushd /usr/local/bin
/usr/local/bin ~
/usr/local/bin
pushd /etc
/etc /usr/local/bin ~
/etc
pushd /Users/bruno/Documents
~/Documents /etc /usr/local/bin ~
~/Documents master* ⇡
pushd /Users/bruno/Music
~/Music ~/Documents /etc /usr/local/bin ~
```
### dirs:
```bash
~/Music master* ⇡
dirs -l -v
0 /Users/bruno/Music
1 /Users/bruno/Documents
2 /etc
3 /usr/local/bin
4 /Users/bruno
```
### naviguer avec pushd:
```bash
~/Music master* ⇡
dirs -l -v
0 /Users/bruno/Music
1 /Users/bruno/Documents
2 /etc
3 /usr/local/bin
4 /Users/bruno
# On avance de 2 répertoires dans la pile 0.1.2 (en partant du haut) => /etc
~/Music master* ⇡
pushd +2
/etc /usr/local/bin ~ ~/Music ~/Documents
# On avance de 1 répertoire dans la pile 0.1 (en partant du bas) => ~/Music
/etc
pushd -1
~/Music ~/Documents /etc /usr/local/bin ~
~/Music master* ⇡
dirs -l -v
0 /Users/bruno/Music
1 /Users/bruno/Documents
2 /etc
3 /usr/local/bin
4 /Users/bruno
```
### popd:
Sans argument, supprime le 1er répertoire de la pile, et va au suivant.
```bash
/etc
dirs -l -v
0 /etc
1 /usr/local/bin
2 /Users/bruno
3 /Users/bruno/Music
4 /Users/bruno/Documents
/etc
popd
/usr/local/bin ~ ~/Music ~/Documents
/usr/local/bin
dirs -l -v
0 /usr/local/bin
1 /Users/bruno
2 /Users/bruno/Music
3 /Users/bruno/Documents
```
Option -n (?????)
```bash
/usr/local/bin
dirs -l -v
0 /usr/local/bin
1 /Users/bruno
2 /Users/bruno/Music
3 /Users/bruno/Documents
/usr/local/bin
popd -n
/usr/local/bin ~ ~/Music ~/Documents
/usr/local/bin
dirs -l -v
0 /usr/local/bin
1 /Users/bruno
2 /Users/bruno/Music
3 /Users/bruno/Documents
```
popd +1 (supprime en partant du haut de la pile 0..1)
```
dirs -l -v
0 /usr/local/bin
1 /Users/bruno
2 /Users/bruno/Music
3 /Users/bruno/Documents
/usr/local/bin
popd +1
/usr/local/bin ~/Music ~/Documents
```
popd -1 (supprime en partant du bas de la pile 0..1)
```bash
/usr/local/bin
dirs -l -v
0 /usr/local/bin
1 /Users/bruno/Music
2 /Users/bruno/Documents
/usr/local/bin
popd -2
~/Music ~/Documents
```

View File

@@ -671,4 +671,9 @@ Ajouter une ligne tout à la fin:
```bash
$ sed -i '$a ---------------' test.txt
```
```
https://wiki.maxcorp.org/sed/

View File

@@ -85,7 +85,7 @@ https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/loggi
Afficher les logs:
```bash
```lo
tail -f /var/www/vhosts/maboiteverte.fr/httpdocs/nextcloud/nextcloud.log
```
@@ -103,6 +103,15 @@ Configuration:
Problèemes de synchro
Plesk -> Wordpress -> maboiteverte.fr -> Vérifier la sécurité:
Décocher:
- Bloquer l'accès aux fichiers potentiellement sensibles
-
[Nextcloud sur NAS Synology](../Synology/nextcloud.md)
[Installer Nextcloud en ligne de commande](../Divers/nextcloud.md)

440
docs/Raspberry/Argon-one.md Normal file
View File

@@ -0,0 +1,440 @@
# RPi 4 et boitier Argon One M.2 (avec SSD M.2)
https://www.argon40.com/argon-one-m-2-case-for-raspberry-pi-4.html
Le boitier accepte les SSD M.2 (Key-B ou Key-B&M)
### Installer Raspberry Pi OS sur la MicroSD:
Télécharger [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/)
```
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-01-12/2021-01-11-raspios-buster-armhf-full.zip
```
Copier Raspberry Pi OS sur la MicroSD avec [Etcher](https://www.balena.io/etcher/)
Booter sur la MicroSD.
Mettre à jour l'OS et le firmware:
```bash
$ sudo apt update
$ sudo apt full-upgrade
$ sudo rpi-update
```
Redémarrer le Raspberry.
Installer le dernier bootloader;
```bash
$ sudo rpi-eeprom-update -d -a
```
Redémarrer le Raspberry.
### Configurer le boot du Raspberry Pi:
Ouvrir **raspi-config**:
```bash
$ sudo raspi-config
```
1. Choisir **Advanded Options** puis Enter
2. Choisir **Bootloader Version** puis Enter
3. Choisir **Latest** (Use the latest version boot ROM software) puis Enter
4. Choisir **Non** pour utiliser Latest boot ROM
5. Choisir **Advanded Options** puis Enter
6. Choisir **Boot Order** puis Enter
7. Choisir **USB Boot** (si une carte SD est présente, le Raspberry démarrera sur la carte SD) puis Enter
### Copier la carte SD sur le disque SSD:
1. Lancer **SD Card Copier** depuis le menu <u>Démarrer</u>, section <u>Accessoires</u>.
2. Choisir la <u>carte SD</u> pour **Copy From Device**.
3. Choisir le <u>SSD</u> pour **Copy to Device**.
4. Cliquer sur **Start**.
5. La copie dure une dizaine de minutes...
6. **Eteindre** le Raspberry.
7. **Retirer la carte SD**.
8. **Redémarrer** le Raspberry qui boote sur le SSD.
### Outils Argon:
Installer Bouton Power et contrôle ventilo:
```bash
$ curl https://download.argon40.com/argon1.sh | bash
```
Fonctions Bouton Power:
| Argon One Pi 4 State | Action | Function |
| -------------------- | ------------------ | ------------------- |
| OFF | Appui court | Démarrer |
| ON | Appui long (>= 3s) | Arrêter et éteindre |
| ON | Appui court (< 3s) | rien |
| ON | Double tap | Reboot |
| ON | Appui long (>= 5s) | Forcer l'arrêt |
Vitesse ventilo:
| CPU Temp | Puissance ventilo |
| -------- | ----------------- |
| 55° C | 10% |
| 60° C | 55% |
| 65° C | 100% |
Pour configurer:
```bash
$ argonone-config
```
Désinstaller:
```bash
$ argonone-uninstall
```
#### [Mise à l'heure:](heure.md)
#### Installer le correcteur orthographique français:
```bash
$ sudo apt-get install myspell-fr
```
### Installer des logiciels:
Gestionnaire de mot-de-passe: KeepassXC (keepassxc-2.3.4)
### Clé SSH:
#### Clé une clé SSH:
```bash
$ ssh-keygen -t rsa -b 4096 -C "Clé sur Raspberry4"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/pi/.ssh/id_rsa):
Created directory '/home/pi/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/pi/.ssh/id_rsa.
Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:6TzjtL9Q31LwOwRAXMLyR2OEO+fYNlc5ccyux4zvhGo Clé sur Raspberry4
The key's randomart image is:
+---[RSA 4096]----+
| +++o o |
| . +o+ .+|
| o +o. .+|
| .+ o+ oo|
| S .B +*.|
| o ...=++o+|
| B .oo=o.|
| o = Eo o.|
| o.oo. ..|
```
#### Répertoire `~/.ssh`
```bash
pi@framboise:~/.ssh $ ls -la
total 28
drwx------ 2 pi pi 4096 févr. 4 14:35 .
drwxr-xr-x 33 pi pi 4096 févr. 9 13:46 ..
-rw------- 1 pi pi 846 juin 1 2019 authorized_keys
-rw-r--r-- 1 pi pi 369 févr. 4 14:41 config
-rw------- 1 pi pi 1675 févr. 4 2019 id_rsa
-rw-r--r-- 1 pi pi 394 févr. 4 2019 id_rsa.pub
-rw-r--r-- 1 pi pi 1776 févr. 4 14:49 known_hosts
```
#### Copier la clé publique ssh sur le serveur distant:
```bash
$ ssh-copy-id -i ~/.ssh/id_rsa.pub bruno@maboiteverte.fr
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/pi/.ssh/id_rsa.pub"
The authenticity of host 'maboiteverte.fr (212.227.191.167)' can't be established.
ECDSA key fingerprint is SHA256:iw66SSVTlEmiXO4kayKS1lHPbrTb5IT3CJtu9c4U7V4.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'bruno@maboiteverte.fr'"
and check to make sure that only the key(s) you wanted were added.
```
#### 1ere connection sans mot-de-passe:
```bash
$ ssh 'bruno@maboiteverte.fr'
Enter passphrase for key '/home/pi/.ssh/id_rsa':
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-96-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
https://ubuntu.com/livepatch
New release '20.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sat Feb 20 16:57:19 2021 from 86.209.226.200
bruno@localhost:~$
```
#### Créer le ssh-agent:
```bash
$ eval $(ssh-agent -s)
Agent pid 3551
```
#### Ajouter la clé ssh au ssh-agent:
```bash
$ ssh-add
Enter passphrase for /home/pi/.ssh/id_rsa:
Identity added: /home/pi/.ssh/id_rsa (Clé sur Raspberry4)
```
#### Pour retirer la clé privée
```bash
$ kill PROCESSID
```
### Configurer le serveur ssh:
```bash
$ sudo nano /etc/ssh/sshd_config
# Ajouter:
Protocol 2
Port 36722
PasswordAuthentication no
PermitEmptyPasswords no
X11Forwarding no
ClientAliveInterval 1500
MaxAuthTries 3
PermitRootLogin no
```
#### Utiliser le protocole ssh version 2:
```bash
Protocol 2
ssh -1 -p '36722' 'pi@raspberrypi4.local'
SSH protocol v.1 is no longer supported
```
#### Durée de vie de la connexion:
```bash
ClientAliveInterval 1500 # seconds
```
#### Connexion par clés uniquement:
```bash
PasswordAuthentication no
```
#### Limiter le nombre d'essais (mauvais mot-de-passe)
```bash
MaxAuthTries 3
```
#### Désactiver la connection en root:
```bash
PermitRootLogin prohibit-password # connection root avec clé ssh uniquement
PermitRootLogin no # connection root interdite
```
#### N'autoriser qu'une seule IP à se connecter:
```bash
ListenAddress 192.168.1.2
```
#### N'autoriser que certains utilisateurs:
```bash
AllowUsers user1 user2
```
#### Redémarrer le service ssh:
```bash
$ sudo service ssh restart
```
#### Si pas besoin de SSH, il faut le désactiver:
```bash
$ sudo systemctl stop sshd
$ sudo systemctl disable sshd
```
### Node:
```bash
# Par défaut (Raspi OS)
$ node -v
v10.24.0
```
#### Installer nvm:
```bash
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
# est ajouté au .bashrc:
export NVM_DIR="$HOME/.config/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 bash_completion
```
#### Installer node:
```bash
$ nvm install --lts=fermium
Installing with latest version of LTS line: fermium
Downloading and installing node v14.16.0...
$ node -v
v14.16.0
```
### Samba:
#### Installer Samba:
```bash
$ sudo apt install samba samba-common-bin smbclient cifs-utils
```
#### Configurer:
```bash
$ sudo nano /etc/samba/smb.conf
# Ajouter dans[global] au début:
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = raspberrypi4
security = user
map to guest = bas user
dns proxy = no
# Ajouter le partage à la fin:
[shared]
comment = Dossier partage dans le dossier User
path = /home/pi/shared
writeable = Yes
create mask = 0777
directory mask = 0777
public = no
```
#### Créer un mot-de-passe Samba pour l'utilisateur pi:
```bash
$ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.
```
#### Redémarrer le service Samba:
```bash
$ sudo systemctl restart smbd
```
#### Vérifier l'état du service Samba:
```bash
$ sudo systemctl status smbd.service
● smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-03 18:33:53 CET; 6min ago
```
### Copier des fichiers:
#### scp:
```bash
# Copier des fichiers vers le Rpi4:
$ scp -P36722 requirements.txt pi@raspberrypi4.local:Desktop/
requirements.txt 100% 1215 417.8KB/s 00:00
# Copier des fichiers depuis le Rpi4:
$ scp -P36722 pi@raspberrypi4.local:Desktop/ex/hostname hostname
hostname 100% 13 4.0KB/s 00:00
```
#### sftp:
```bash
```
```bash
sudo tasksel
```

42
docs/Raspberry/cloud.md Normal file
View File

@@ -0,0 +1,42 @@
# Cloud
### Installer NextCloud:
https://help.nextcloud.com/t/nextcloud-client-for-raspberry-pi/27989/61
Récupérer les archives nécessaires:
```bash
$ wget http://ftp.br.debian.org/debian/pool/main/q/qtwebengine-opensource-src/libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ wget http://ftp.br.debian.org/debian/pool/main/q/qtwebengine-opensource-src/libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ wget http://ftp.br.debian.org/debian/pool/main/n/nextcloud-desktop/libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
$ wget http://ftp.br.debian.org/debian/pool/main/n/nextcloud-desktop/nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
```
Installer les paquets avec apt (méthode préférée):
```bash
$ sudo apt install /home/pi/Downloads/libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ sudo apt install /home/pi/Downloads/libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ sudo apt install /home/pi/Downloads/libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
$ sudo apt install /home/pi/Downloads/nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
```
ou avec dpkg:
```bash
$ sudo dpkg -i libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ sudo dpkg -i libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
$ sudo dpkg -i libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
$ sudo dpkg -i nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
# puis fixer les dépendances
$ sudo apt --fix-broken install
```
### Installer pCloud:

61
docs/Raspberry/heure.md Normal file
View File

@@ -0,0 +1,61 @@
# Mise à l'heure
#### Renseigner le ou les serveurs ntp ([Renater](https://services.renater.fr/ntp/serveurs_francais))([NTP Pool](https://www.pool.ntp.org/zone/fr)):
```bash
$ sudo nano -c /etc/systemd/timesyncd.conf
[Time]
Servers=ntp.midway.ovh 3.fr.pool.ntp.org
```
#### Activer le service de mise-à-jour automatique:
```bash
$ sudo timedatectl set-ntp true
```
#### Liste des fuseaux horaires:
```bash
$ timedatectl list-timezones
$ timedatectl list-timezones | grep Europe
```
#### Régler le fuseau horaire:
```bash
$ sudo timedatectl set-timezone Europe/Paris
```
#### Tester:
```bash
$ timedatectl
Local time: mar. 2017-08-08 09:12:58 CEST
Universal time: mar. 2017-08-08 07:12:58 UTC
RTC time: n/a
Time zone: Europe/Paris (CEST, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
```
#### Pour vérifier que la synchro est active:
```bash
$ sudo service systemd-timesyncd status
```
#### Réglage manuel:
```bash
$ sudo timedatectl set-ntp false
$ sudo timedatectl set-time 'A:M:J HH:mm:ss'
```

View File

@@ -0,0 +1,40 @@
https://help.nextcloud.com/t/nextcloud-client-for-raspberry-pi/27989/61
```bash
wget http://ftp.br.debian.org/debian/pool/main/q/qtwebengine-opensource-src/libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
wget http://ftp.br.debian.org/debian/pool/main/q/qtwebengine-opensource-src/libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
wget http://ftp.br.debian.org/debian/pool/main/n/nextcloud-desktop/libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
wget http://ftp.br.debian.org/debian/pool/main/n/nextcloud-desktop/nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
```
```bash
sudo dpkg -i libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
sudo dpkg -i libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
sudo dpkg -i libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
sudo dpkg -i nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
```
# fixer les dépendances
```bash
sudo apt --fix-broken install
```
```bash
sudo apt install /home/pi/Downloads/libqt5webenginecore5_5.11.3+dfsg-2+deb10u1_armhf.deb
sudo apt install /home/pi/Downloads/libqt5webenginewidgets5_5.11.3+dfsg-2+deb10u1_armhf.deb
sudo apt install /home/pi/Downloads/libnextcloudsync0_2.5.1-3+deb10u1_armhf.deb
sudo apt install /home/pi/Downloads/nextcloud-desktop_2.5.1-3+deb10u1_armhf.deb
```

16
docs/Raspberry/python.md Normal file
View File

@@ -0,0 +1,16 @@
# Python
```bash
# 09/02/2021
pi@framboise:~/Downloads $ python -V
Python 2.7.16
pi@framboise:~/Downloads $ python3 -V
Python 3.7.3
```

215
docs/Raspberry/rclone.md Normal file
View File

@@ -0,0 +1,215 @@
# Rclone
### Installation
```bash
$ sudo apt rclone
```
Mais cette version n'est pas jour.
```bash
$ wget https://downloads.rclone.org/rclone-current-linux-arm.zip
$ unzip -j -d rclone-temp rclone-current-linux-arm.zip
$ sudo mv ~/rclone-temp/rclone /usr/bin/rclone
$ sudo chown root: /usr/bin/rclone
$ sudo mv ~/rclone-temp/rclone.1 /usr/share/man/man1/rclone.1
$ rm ~/rclone-current-linux-arm.zip
$ rm -rf ~/rclone-temp
```
#### Rclone config:
#### rclone config
```bash
$ rclone config
.../...
Current remotes:
Name Type
==== ====
pCloud_RPi pcloud
```
#### rclone config show
```bash
$ rclone config show
[pCloud_RPi]
type = pcloud
hostname = api.pcloud.com
token = {"access_token":"dWUiZDnONSzyJXpmZcvngG7ZyPNPY6dCoef3qtmBY2dgYY9WKYQk","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}
```
#### rclone config file
```bash
$ rclone config file
Configuration file is stored at:
/home/pi/.config/rclone/rclone.conf
```
### Rclone ls:
```bash
$ rclone ls pCloud_RPi:Linux
6148 .DS_Store
73 .~lock.Linux Apps.ods#
14882 Linux Apps.ods
6040 python -apt.txt
```
### Rclone sync:
```bash
$ rclone sync $HOME/pCloud/RPi4 pCloud_RPi:Linux/RPi4
```
### Rclone ls:
```bash
# lsd (list directory)
$ rclone lsd pCloud_RPi:Linux/RPi4
-1 2021-02-27 10:51:56 -1 scripts
#ls (list files)
$ rclone ls pCloud_RPi:Linux/RPi4
163 cmdline.txt
2432 scripts/config
#lsl (lifst files with size and date)
$ rclone lsl pCloud_RPi:Linux/RPi4
163 2021-02-24 18:22:25.000000000 cmdline.txt
2432 2021-02-06 17:57:30.000000000 scripts/config
```
### Rclone mkdir:
```bash
$ rclone lsd pCloud_RPi:Linux/RPi4
-1 2021-02-27 10:51:56 -1 scripts
$ rclone mkdir pCloud_RPi:Linux/RPi4/Backup
$ rclone lsd pCloud_RPi:Linux/RPi4
-1 2021-02-27 10:57:33 -1 Backup
-1 2021-02-27 10:51:56 -1 scripts
```
### Rclone move:
```bash
$ rclone lsl pCloud_RPi:Linux/RPi4
163 2021-02-24 18:22:25.000000000 cmdline.txt
2432 2021-02-06 17:57:30.000000000 Backup/config
$ rclone move pCloud_RPi:Linux/RPi4/cmdline.txt pCloud_RPi:Linux/RPi4/scripts
$ rclone lsl pCloud_RPi:Linux/RPi4
163 2021-02-24 18:22:25.000000000 scripts/cmdline.txt
2432 2021-02-06 17:57:30.000000000 Backup/config
```
### Rclone GUI:
#### rclone rcd --rc-web-gui
```bash
$ rclone rcd --rc-web-gui
2021/02/27 11:29:47 NOTICE: Web GUI exists. Update skipped.
2021/02/27 11:29:47 NOTICE: Serving Web GUI
2021/02/27 11:29:47 NOTICE: Serving remote control on http://localhost:5572/
```
### Rclone mount:
```bash
$ mkdir $HOME/pCloud-drive
$ rclone --vfs-cache-mode writes mount pCloud_RPi: $HOME/pCloud-drive &
[1] 26815
$ cd pCloud-drive/
total 410497
-rw-r--r-- 1 pi pi 165 nov. 25 17:55 '~$IP.xlsx'
-rw-r--r-- 1 pi pi 165 nov. 25 20:59 '~$Machines.xlsx'
-rw-r--r-- 1 pi pi 129652 sept. 4 2019 2019-09-03_Cerf_2534.jpg
-rw-r--r-- 1 pi pi 43137006 oct. 9 2019 2019-10-09_Chevrillard_6337.CR3
```
```bash
$ df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/root 110G 6,9G 97G 7% /
devtmpfs 1,8G 0 1,8G 0% /dev
tmpfs 1,9G 93M 1,8G 5% /dev/shm
tmpfs 1,9G 9,0M 1,9G 1% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/sda1 253M 49M 204M 20% /boot
tmpfs 383M 16K 383M 1% /run/user/1000
pCloud_RPi: 2,0T 31G 2,0T 2% /home/pi/pCloud-drive
$ mount | grep rclone
pCloud_RPi: on /home/pi/pCloud-drive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
```
#### Montage automatique avec la crontab:
```bash
$ nano mount-pcloud.sh
# Ajouter:
#!/bin/bash
/usr/bin/rclone --vfs-cache-mode writes mount pCloud_RPi: $HOME/pCloud-drive &
$ chmod +x mount-pcloud.sh
```
Ajouter le script à la crontab:
```bash
crontab -e (ou crontab -e -u UserName)
@reboot sh /username/scripts/mount-pcloud.sh
```
#### Démonter le disque pCloud:
```bash
$ fusermount -u /home/pi/pCloud-drive
# Si le disque est occupé, il faut forcer le démontage:
$ fusermount -uz /home/pi/pCloud-drive
```
https://devsrealm.com/cloud-computing/ubuntu/mounting-and-unmounting-cloud-storage-with-rclone-in-linux/

View File

@@ -18,6 +18,13 @@ network={
}
```
```bash
# Recharger les nouvelles configurations
$ wpa_cli -i wlan0 reconfigure
```
#### Encoder le mot de passe:
```bash
@@ -49,7 +56,7 @@ source-directory /etc/network/interfaces.d
#### Adresses IP:
```bash
$ ip -4 addr | grep global
$ ip -4 addr | grep inet
inet 192.168.1.254/24 brd 192.168.1.255 scope global eth0
inet 192.168.1.21/24 brd 192.168.1.255 scope global wlan0
```
@@ -82,6 +89,38 @@ $ ls /sys/class/net
eth0 lo wlan0
```
```bash
$ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:55:56:e0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Boucle locale)
RX packets 375 bytes 32464 (31.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 375 bytes 32464 (31.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.251 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::e55e:a7fc:915f:fb98 prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:55:56:e1 txqueuelen 1000 (Ethernet)
RX packets 91361 bytes 29942853 (28.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22382 bytes 3480690 (3.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
#### Mettre en IP fixe:
```bash
@@ -90,16 +129,51 @@ $ sudo nano /etc/dhcpcd.conf
# à rajouter à la fin du fichier:
interface eth0
static ip_address=192.168.1.254/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8
static ip_address=192.168.2.252/24
static routers=192.168.2.1
static domain_name_servers=8.8.8.8 8.8.4.4
interface wlan0
static ip_address=192.168.1.253/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8
static ip_address=192.168.2.251/24
static routers=192.168.2.1
static domain_name_servers=8.8.8.8 8.8.4.4
```
#### Modifier le hostname:
```bash
$ sudo raspbi-config
# 1 System Options puis S4 Hostname
```
```bash
$ sudo nano /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi4
```
puis
```bash
$ sudo nano /etc/hostname
raspberrypi4
```
#### Redémarrer le service réseau:
```bash
$ service networking restart
```
#### VNC:
*VNC Server (Pi):*
@@ -115,7 +189,7 @@ Menu → Options:
- Utilisateur standart: Mot de passe
*VNC Viewer (Mac):*

View File

@@ -0,0 +1,10 @@
# Services
| | |
| -------------------------- | ----------------------------- |
| sudo service dhcpcd status | Activer le daemon client DHCP |
| | |
| | |

View File

@@ -39,4 +39,42 @@ cat /proc/cpuinfo
Revision : 0003
```
Voir le modèle correspondant à la révision [ici](https://elinux.org/RPi_HardwareHistory).
Voir le modèle correspondant à la révision [ici](https://elinux.org/RPi_HardwareHistory).
### Lancer un programme au démarrage:
Il faut éditer le fichier `/etc/rc.local`
```bash
sudo nano /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
'/home/pi/Documents/scripts/bashrc -> Nextcloud.sh &'
exit 0
```
Le programme doit être mis avant la ligne exit 0.
Le programme (sans GUI) sera exécuté par root avant que X démarre, les chemins doivent être absolus.

21
docs/Synology/crontab.md Normal file
View File

@@ -0,0 +1,21 @@
# crontab
Ouvrir la crontab:
```bash
bruno@DS916:~ $ sudo -i
Password:
root@DS916:~# nano /etc/crontab
```
Redémarrer le service cron:
```bash
root@DS916:~# synoservice -restart crond
```

View File

@@ -508,7 +508,23 @@ You are already using composer version 1.7.1 (stable channel).
Utiliser `--unsafe-perm`
```bash
sudo npm install -g thumbsup --unsafe-perm
$ sudo npm install -g thumbsup --unsafe-perm
```
ou
```bash
# Erreur EACCES /opt/tmp
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
$ nvm install --lts=fermium
$ npm config set prefix '~/.npm-packages'
$ npm config set tmp '/tmp'
$ npm -g install npm
$ npm -g install thumbsup
```

185
docs/macos/GPG.md Normal file
View File

@@ -0,0 +1,185 @@
# GPG
#### Créer une clé GPG:
### Liste des clés:
Clés publiques:
```bash
$ gpg2 -list-keys
/Users/bruno/.gnupg/pubring.kbx
-------------------------------
pub dsa2048 2010-08-19 [SC] [expires: 2024-05-11]
85E38F69046B44C1EC9FXXXXXXXXXXXXXXXXXXXX
uid [ unknown] GPGTools Team <team@gpgtools.org>
uid [ unknown] [jpeg image of size 6329]
sub rsa4096 2014-04-08 [S] [expires: 2024-05-11]
sub rsa4096 2020-05-11 [E] [expires: 2024-05-11]
pub dsa3072 2017-07-29 [SC] [revoked: 2019-08-16]
C20F2E7CA759A312FC54XXXXXXXXXXXXXXXXXXXX
uid [ revoked] Bruno Pesenti <bruno@clicclac.info>
pub rsa4096 2019-08-16 [SC] [expires: 2025-08-16]
2D5E6C772EC115C821BDXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Bruno Pesenti <bruno@clicclac.info>
sub rsa4096 2019-08-16 [E] [expires: 2025-08-16]
pub rsa4096 2019-08-16 [SC] [expires: 2024-08-16]
995EBFA715B43A5EADA3XXXXXXXXXXXXXXXXXXXX
uid [ultimate] Bruno Pesenti <bruno.pesenti@orange.fr>
sub rsa4096 2019-08-16 [E] [expires: 2024-08-16]
```
Clés privées:
```bash
$ gpg --list-secret-keys
/Users/bruno/.gnupg/pubring.kbx
-------------------------------
sec rsa4096 2017-07-29 [SC] [revoked: 2019-08-16]
6DF29A830B9A7EE0130DXXXXXXXXXXXXXXXXXXXX
uid [ revoked] Bruno Pesenti <bruno.pesenti@orange.fr>
sec dsa3072 2017-07-29 [SC] [revoked: 2019-08-16]
C20F2E7CA759A312FC54XXXXXXXXXXXXXXXXXXXX
uid [ revoked] Bruno Pesenti <bruno@clicclac.info>
sec rsa4096 2019-08-16 [SC] [expires: 2025-08-16]
2D5E6C772EC115C821BDXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Bruno Pesenti <bruno@clicclac.info>
ssb rsa4096 2019-08-16 [E] [expires: 2025-08-16]
sec rsa4096 2019-08-16 [SC] [expires: 2024-08-16]
995EBFA715B43A5EADA3XXXXXXXXXXXXXXXXXXXX
uid [ultimate] Bruno Pesenti <bruno.pesenti@orange.fr>
ssb rsa4096 2019-08-16 [E] [expires: 2024-08-16]
```
### Encrypter un fichier (--encrypt):
```bash
$ gpg2 --homedir=~/.gnupg --recipient bruno.pesenti@orange.fr --encrypt $HOME/.my.cnf
```
```bash
$ gpg2 --output $HOME/Desktop/.password.txt.gpg --recipient bruno.pesenti@orange.fr --encrypt $HOME/.password.txt
```
Le fichier `.password.txt` est destiné à *bruno.pesenti@orange.fr*.
On l'a **encrypté** avec <u>la clé publique</u> de *bruno.pesenti@orange.fr*. Ce dernier le **décryptera** avec <u>sa clé privée</u>.
Si *bruno.pesenti@orange.fr* veut vous envoyer un fichier crypté, il l'encryptera avec votre clé publique, et vous le décripterez avec votre clé privée.
### Décrypter un fichier (--decrypt):
```bash
$ gpg2 --homedir=~/.gnupg --output /Users/bruno/Desktop/.my.cnf --decrypt .my.cnf.gpg
gpg: encrypted with 4096-bit RSA key, ID 31C7659DE3F8009D, created 2019-08-16
"Bruno Pesenti <bruno.pesenti@orange.fr>"
```
### Encrypter plusieurs fichiers (--multifile --encrypt):
```bash
~/Downloads/pdf master* ⇡
$ ls | gpg2 --multifile --encrypt --recipient bruno.pesenti@orange.fr
~/Downloads/pdf master* ⇡ 15s
$ ls -la
total 889052
-rw-r--r-- 1 bruno staff 2810014 Dec 24 2019 'Data Munging with Perl.pdf'
-rw-r--r-- 1 bruno staff 1349061 Feb 25 15:28 'Data Munging with Perl.pdf.gpg'
-rw-r--r-- 1 bruno staff 335834 Dec 24 2019 'Lerning perl the hars way.pdf'
-rw-r--r-- 1 bruno staff 298644 Feb 25 15:28 'Lerning perl the hars way.pdf.gpg'
```
### Décrypter plusieurs fichiers (--multifile --decrypt):
```bash
$ ls | gpg2 --multifile --decrypt
gpg: Data Munging with Perl.pdf: unknown suffix
gpg: encrypted with 4096-bit RSA key, ID 31C7659DE3F8009D, created 2019-08-16
"Bruno Pesenti <bruno.pesenti@orange.fr>"
gpg: Lerning perl the hars way.pdf: unknown suffix
gpg: encrypted with 4096-bit RSA key, ID 31C7659DE3F8009D, created 2019-08-16
"Bruno Pesenti <bruno.pesenti@orange.fr>"
```
### Vérification:
```bash
$ file .my.cnf.gpg
.my.cnf.gpg: PGP RSA encrypted session key - keyid: 31C7659D E3F8009D RSA (Encrypt or Sign) 4096b .
```
### Encrypter un fichier (--symmetric):
```bash
$ gpg2 --output $HOME/Desktop/.password.txt.gpg --symmetric $HOME/.password.txt
```
### Encrypter un dossier(gpgtar --encrypt):
```bash
$ gpgtar --encrypt --output .gnupgp.zip -r bruno.pesenti@orange.fr .gnupg
gpgtar: skipping unsupported file '.gnupg/S.gpg-agent.extra'
gpgtar: skipping unsupported file '.gnupg/S.gpg-agent.ssh'
gpgtar: skipping unsupported file '.gnupg/S.dirmngr'
gpgtar: skipping unsupported file '.gnupg/S.gpg-agent'
gpgtar: skipping unsupported file '.gnupg/S.gpg-agent.browser'
```
### Décrypter un dossier(gpgtar --decrypt):
```bash
$ gpgtar --decrypt .gnupgp.zip
gpgtar: gpg: encrypted with 4096-bit RSA key, ID 31C7659DE3F8009D, created 2019-08-16
gpgtar: gpg: "Bruno Pesenti <bruno.pesenti@orange.fr>"
```
### Supprimer 'Overwrite' quand on ré-encrypte un même fichier:
```bash
$ gpg2 --output $HOME/Desktop/.password.txt.gpg --recipient bruno.pesenti@orange.fr --encrypt $HOME/.password.txt
File '/Users/bruno/Desktop/.password.txt.gpg' exists. Overwrite? (y/N) y
```
Ajouter les options batch et yes
```bash
$ cat gpg.conf
auto-key-retrieve
no-emit-version
default-key 995EBFA715B43A5EADA3XXXXXXXXXXXXXXXXXXXX
batch
yes
```

View File

@@ -64,7 +64,7 @@ export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
Relancer le script d'installation
```bash
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
```
@@ -235,6 +235,7 @@ https://medium.com/@danielzen/using-nvm-with-webstorm-or-other-ide-d7d374a84eb1
```bash
$ export NVM_SYMLINK_CURRENT=true
# choisir le dernier lts
$ nvm use --lts
Now using node v14.15.1 (npm v6.14.9)

View File

@@ -113,6 +113,14 @@ lrwxr-xr-x 1 bruno staff 6 15 mar 07:29 python3 -> python
Mettre-à-jour `pip` et `setuptools`:
```bash
(tuto-virtuel-env) bruno@SilverBook:~/venv/tuto-virtuel-env/bin$ pip3 install -U pip setuptools
```
Installer un module avec `pip`:
```bash