MaJ du 04-02-2021

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

View File

@@ -6,7 +6,7 @@ Plusieurs solutions pour installer des applications dans Mint:
#### Gestionnaire de logiciels
#### Logithèque
@@ -38,10 +38,29 @@ sudo snap install <package>
#### Appimage
-Télécharger l'application
- Télécharger l'application et la déplacer dans `/opt`.
-La rendre exécutable `$ chmod a+x app*.AppImage`
- La rendre exécutable `$ chmod a+x app*.AppImage`
-La lancer `$ ./Subsurface*.AppImage
- La lancer `$ ./Subsurface*.AppImage
https://github.com/TheAssassin/AppImageLauncher
#### Installer depuis les source
#### Installer depuis Git
#### Editeur de menu
Pour accéder à l'éditeur de menu:
- Clic--droit sur le Menu
- Cliquer sur Configurer, puis sur l'onglet Menu
- Cliquer sur 'Ouvrir l'éditeur de menu'
https://github.com/TheAssassin/AppImageLauncher

View File

@@ -164,7 +164,7 @@ server {
Donner les droits à Nginx pour le dossuier root:
Donner les droits à Nginx pour le dossier root:
```bash
$ sudo chown -R www-data:www-data /home/bruno/Sites

View File

View File

@@ -0,0 +1,12 @@
# Sonos
[Alexa](alexa.md)
[Sonos One](one.md)
[My Media Library](myMedia.md)

View File

@@ -0,0 +1,155 @@
# myMedia for Alexa
### Installation comme Image Docker sur un NAS Synology
1. Se connecter au NAS comme administrateur.
2. Lancer Docker.
3. Cliquer sur **Registre** dans la barre latérale.
4. Dans la barre de recherche, entrer *'mymediaforalexa'* et cliquer sur **Rechercher**.
5. Clic-droit sur *bizmodeller/mymediaforalexa-adm64* (pour un DS916+) et choisir **Télécharger cette image**.
6. Une fois l'image est téléchargée, cliquer sur **Image** dans la barre latérale.
7. Choisir *bizmodeller/mymediaforalexa-adm64* et cliquer sur le bouton **Lancer**.
8. Dans **Paramètres généraux**, <u>décocher</u>:
1. Exécuter le conteneur à l'aide de privilèges élevés
2. Activer la limitation des ressources
puis cliquer sur **Paramètres avancés**.
9. Dans **Paramètres avancés**, <u>cocher</u>:
1. Activer le **redémarrage automatique**.
2. Créer un raccourci sur le bureau. Page Web `https://clicclac.synology.me:52051`
puis cliquer sur **Volume**.
10. Dans **Volume**:
1. Cliquer sur **Ajouter un dossier**, puis sélectionner le dossier *docker*
2. Cliquer sur **Créer dossier**: *mymediaforalexa* `\docker\mymediaforalex`
3. Cliquer sur **Créer dossier**: *datadir* `\docker\mymediaforalex\datadir`
4. Cliquer sur **Sélectionner**.
5. Dans **Chemin d'accès**, entrer `/datadir`comme point de montage. S'assurer que **Lecture seule** <u>n'est pas</u> coché.
6. Cliquer sur **Ajouter un dossier**, puis sélectionner le dossier qui contient les fichiers musicaux `\music`
7. Dans **Chemin d'accès**, entrer `/medialibrary` comme point de montage. S'assurer que **Lecture seule** <u>est</u> coché.
puis cliquer sur **Réseau**.
11. Dans **Réseau**: ne rien changer (bridge), puis cliquer sur **Paramètres des ports**.
12. Dans **Paramètres des ports**:
1. Sous Port local, remplacer Local par la même valeur que le Port du container:
2. 52050 Local Port :fa-arrow-right: 52050 Container Port (TCP)
3. 52051 Local Port :fa-arrow-right: 52051 Container Port (TCP)
puis cliquer sur **Liens**.
13. Dans **Liens**:
* Pas de changement
14. Dans **Environnement**:
* Pas de changement
15. Cliquer sur **Appliquer**, puis **Suivant**.
16. Dans **Résumé**, s'assurer que **Exécuter ce conteneur lorsque l'assistant a terminé** est coché, puis cliquer sur **Appliquer**.
17. Cliquer sur **Conteneur** dans la barre latérale. Le conteneur *bizmodeller/mymediaforalexa-adm64* doit être lancé.
18. Dans le **Panneau de configuration**, aller dans **Sécurité** puis **Pare-feu**: s'assurer que les ports *tcp/52050* et *tcp/52051* soient ouverts.
19. Dans le **Panneau de configuration**, aller dans **Portail des applications** puis **Proxy inversé**:
1. Cliquer sur **Créer**. Puis dans l'onglet **Général**,
2. Dans **Description**, entrer *mymediaforalexa*.
3. Dans **Source**:
| Protocole | https |
| --------------------------- | -------------------- |
| Nom d'hôte | clicclac.synology.me |
| Port | 52052 |
| Activer HSTS | coché |
| Activer HTTP/2 | coché |
| Activer le contrôle d'accès | décoché |
4. Dans **Destination**:
| Protocole | http |
| ---------- | --------- |
| Nom d'hôte | localhost |
| Port | 52051 |
20. *mymediaforalexa* est alors accessible à [https:\\clicclac.synology.me:52052]()
21. Quand *mymediaforalexa* est exécuté dans un container docker en mode bridge, it will likely automatically detect the docker host IP address *incorrectly*. This will cause your alexa devices to be unable to play songs from your mymediaforalexa.
22. Il faut se connecter à *mymediaforalexa* et cliquer sur **Settings**:
1. Aller à **Listening IP Address** :
2. Cliquer sur **Set** et mettre **Override IP Address** sur **On**.
3. Entrer l'IP locale du serveur: `192.168.1.7`
4. Aller à **Enable access outside of local network**:
5. Sélectionner **Enable via Firewall NAT**
6. Aller à **Admin Account Password** :
7. Mettre **Require password for My Media web console** sur On.
8. Entrer un mot de passe. Le login est toujours *'admin'*
23. Dans la livebox, créer une règle NAT:
| Application | Port interne | Port externe | Protocole |
| -------------- | ------------ | ------------ | --------- |
| mymedialibrary | 52050 | 52052 | TCP |
D'après https://forum.bizmodeller.com/viewtopic.php?f=13&p=4820
#### Pour supprimer le mot de passe:
1. Arrêter le container (ou arrêter le service)
2. Dans le fichier préférences (`\docker\mymediaforalex\datadir\Preferences.xml`), supprimer la ligne `<PasswordHash>.... </PasswordHash>`et redémarrer le container. Se connecter avec <u>admin/admin</u> et supprimer le mot de passe.
## Commandes pour écouter sa musique sur Amazon Alexa
| | |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| Alexa, demande à My Media de jouer lalbum *The Wall* | Joue *In the flesh* |
| Alexa, demande à My Media de jouer la piste *Mother* | Joue *Mother* (pas forcément de l'album The Wall) |
| Alexa, demande à My Media de jouer ma Playlist | |
| Alexa, demande à My Media de jouer de la musique Folk | Joue *The Sicked Bed of Cuchulainn* par *The Pogues* |
| Alexa, demande à My Media de jouer de la musique de *Pink Floyd* | Joue un titre des *Pink Floyd* |
| Alexa, demande à My Media ce qui joue | My Media joue actuellement *The Sicked Bed of Cuchulainn* par *The Pogues* |
| Alexa, précédent | |
| Alexa, suivant | |
| Alexa, arrête | |
| Alexa, demande à My Media quel est mon serveur courant | Votre serveur My Media actif est *bizmodeller-mymediaforalexa-amd641* |
| Alexa, demande à My Media de changer de serveur | |
| Alexa, demande à My Media de jouer en boucle | |
| Alexa, demande à My Media de jouer en mode aléatoire | |
| Alexa, demande à My Media de jouer ma [playlist] Playlist | |
| | |
| | |
| | |
| | |
| | |
| | |

49
docs/Divers/Sonos/one.md Normal file
View File

@@ -0,0 +1,49 @@
# Sonos One
Sonos OS : S2
### Bibliothèque musicale
Paramètres :fa-arrow-right: Système :fa-arrow-right: Bibliothèque musicale :fa-arrow-right: Configurer bibliothèque musicale
+ Ajouter un dossier musical partagé
1. Chemin: `//DS916/music`
2. Utilisateur
3. Mot de passe
!!! warning "Attention"
Le Sonos ne gère que les partages SMB v1.
### Services
https://github.com/pascalopitz/unoffical-sonos-controller-for-linux Unofficial Sonos Controller for Linux
https://github.com/janbar/noson-app A fast and smart SONOS controller for Linux platforms.
https://github.com/airsonic/airsonic
https://github.com/nfarina/homebridge-sonos turn Sonos speakers on and off using Siri and/or a HomeKit enabled iOS app.
https://github.com/duncan3dc/sonos A PHP library for interacting with [Sonos](http://www.sonos.com/) speakers.
https://github.com/ebaauw/homebridge-zp Homebridge plugin for Sonos Zone Players
https://github.com/Villarrealized/sonos-web Sonos Web is a browser based controller for your [Sonos](https://www.sonos.com/system) sound system.
https://github.com/dbilgili/Ses Sonos speaker controller for macOS

View File

@@ -0,0 +1,728 @@
# soco-cli
https://github.com/avantrec/soco-cli
### Installation
On crée un environnement virtuel:
```bash
~/Documents/venv master* ⇡
python3 -m venv soco-cli
```
On l'active:
```bash
~/Documents/venv master* ⇡
source soco-cli/bin/activate
```
On met à jour pip et setuptools:
```bash
~/Documents/venv/soco-cli/bin master* ⇡
soco-cli pip3 install -U pip setuptools
```
On installe soco-cli:
```bash
~/Documents/venv/soco-cli/bin master* ⇡ 10s
soco-cli pip3 install -U soco-cli
```
soco et soco-cli sont disponibles, ainsi que leurs alias sonos et sonos-discover.
```bash
~/Documents/venv/soco-cli master* ⇡
soco-cli ls bin
Activate.ps1 easy_install python sonos-discover
activate easy_install-3.8 python3 tabulate
activate.csh pip soco
activate.fish pip3 soco-discover
chardetect pip3.8 sonos
```
On peut linker sonos dans /usr/local/bin pour avoir la commande directement
```bash
~/Documents/venv master* ⇡
ln -s /Users/bruno/Documents/venv/soco-cli/bin/sonos /usr/local/bin
```
et créer un alias pour sonos-discover dans .zshrc ou .bashrc
```bash
alias sonos-discover="/Users/bruno/Documents/venv/soco-cli/bin/sonos-discover -t 256 -n 1.0 -m 24"
```
### Commande **sonos-discover**
Permet de découvrir les appareils Sonos sur le réseau:
```bash
sonos-discover -t 256 -n 1.0 -m 24
Networks searched: [IPv4Network('192.168.1.0/24')]
Sonos Household: Sonos_MmiahLD8Lavgm9ypGrX1Zx99sy
Room/Zone Name IP Address Device Model Visibility SW Version
---------------- ------------ -------------- ------------ ------------
Salon 192.168.1.17 One Visible 12.1
1 Sonos Household(s) found
1 Sonos device(s) found
Saved speaker data at: /Users/bruno/.soco-cli/speakers_v2.pickle
```
### Commande **sonos** (ou **soco**)
```bash
$ sonos <enceinte> <commande>
```
#### Enceintes et Système Sonos Info:
Afficher les alarmes:
```
sonos Salon alarms
Speaker Start Time Duration Title Volume Enabled Play Mode Recurrence Include Grouped
--------- ------------ ---------- ------- -------- --------- ----------- ------------ -----------------
Salon 06:00 01:00 Unknown 25 Yes SHUFFLE WEEKDAYS No
```
Infos sur l'enceinte (IP, version...)
```bash
sonos Salon info
balance = (100, 100)
bass = 0
cross_fade = False
display_version = 12.1
grouped_or_paired = False
hardware_version = 1.26.1.7-2.2
household_id = Sonos_MmiahLD8Lavgm9ypGrX1Zx99sy
ip_address = 192.168.1.17
is_coordinator = True
is_playing_line_in = False
is_playing_radio = True
is_playing_tv = False
is_soundbar = False
is_visible = True
loudness = True
mac_address = 48-A6-B8-F0-26-62
model_name = Sonos One
model_number = S18
mute = True
night_mode = None
player_icon = /img/icon-S18.png
player_name = Salon
serial_number = 48-A6-B8-F0-26-62:G
software_version = 60.3-81140
state = PLAYING
status_light = True
title = franceinter-midfi.mp3?ID=76zqey582k
treble = 0
uid = RINCON_48A6B8F0266201400
volume = 21
zone_name = Salon
```
Afficher tous les groupes du système Sonos:
```bash
sonos Salon groups
[Salon] : Salon (192.168.1.17)
```
Liste des partages:
```bash
sonos Salon shares
1: //DS916/music
# shares, libraries
```
Tableau d'info sur toutes les enceintes du système:
```bash
sonos Salon sysinfo
Report generated on: 2020-11-01 12:08 UTC (Sunday)
Zone Name IP Address Visible CoOrd CoOrd IP Vol. Mute State Model Name Model No. HW Version SW Version
----------- ------------ --------- ------- ---------- ------ ------ ------- ------------ ----------- ------------ -----------------
Salon 192.168.1.17 Yes Yes 21 True PLAYING One S18 1.26.1.7-2.2 60.3-81140 (12.1)
Sonos model numbers present: S18.
Device counts: 1 total Sonos device(s), 1 unique model(s).
```
#### Radios:
On peut jouer des radios en les ajoutant aux Favoris Sonos
```bash
sonos Salon play_fav "france inter"
# play_fav, play_favourite, pf
```
ou en les ajoutant à la playlist "My Radio Stations" de Tune-In
```bash
sonos Salon play_favourite_radio_station "france inter"
# play_favourite_radio_station, pfrs
```
Liste des radios favorites:
```bash
sonos Salon favourite_radio_stations
1: France Inter 95.9 (Émissions-débats France)
2: K6 FM 101.6 (Musique Locale)
3: RTL 104.2 (Monde)
# favourite_radio_stations, frs, lfrs
```
#### Favoris et playlists:
Afficher les Favoris Sonos:
```bash
sonos Salon list_favs
1: France Inter 95.9 (Émissions-débats France)
2: K6 FM 101.6 (Musique Locale)
3: Les Introuvables
4: RTL 104.2 (Monde)
5: Rire et Chansons 91.8 (Comédie)
6: Shaka Ponk
7: franceinfo 101.2 (Émissions-débats France)
```
Afficher toutes les pistes de toutes les playlist Sonos:
```bash
sonos Salon list_all_playlist_tracks
Sonos Playlist: plex 1
======================
1: Artist: Renaud | Album: Boucan d'enfer | Title: Docteur Renaud Mister Renaud
2: Artist: Renaud | Album: Boucan d'enfer | Title: Petit pede
```
Afficher les playlist Sonos:
```bash
sonos Salon list_playlists
1: plex 1
# list_playlists, playlists, lp
```
#### Musiques:
Liste des albums:
```bash
sonos Salon list_albums
Sonos Music Library Albums
===========================
1: Album: ¡Dos! | Artist: Green Day
2: Album: "Portrait d'artiste" | Artist: Lynda Lemay
3: Album: (No Reason To Cry) | Artist: Eric Clapton
4: Album: 10 | Artist: Stranglers
5: Album: 100th Window | Artist: Massive Attack
...
# list_albums, albums
```
Liste des artistes:
```bash
sonos Salon list_artists
Sonos Music Library Artists
============================
1: AaRON
2: Aaron Copland
3: Adam - C de Roquemaure
4: Adele
5: Afro-Cuban Project
# list_artists, artists
```
Rechercher un artiste:
```bash
sonos Salon search_artists pink
Sonos Music Library Albums including Artist: Pink Floyd
=======================================================
1: Album: A Momentary Lapse Of Reason | Artist: Pink Floyd
2: Album: A Saucerful of Secrets | Artist: Pink Floyd
3: Album: Animals | Artist: Pink Floyd
4: Album: Atom heart mother | Artist: Pink Floyd
5: Album: Echoes - The Best Of Pink Floyd | Artist: Pink Floyd
6: Album: Eclipse - Live in London | Artist: Pink Floyd
7: Album: Meddle | Artist: Pink Floyd
8: Album: Music From The Film More | Artist: Pink Floyd
9: Album: Obscured By Clouds | Artist: Pink Floyd
10: Album: The Best Of Pink Floyd - A Foot In The Door | Artist: Pink Floyd
11: Album: The Best Of Pink Floyd: A Foot In The Door (2011 Remastered Version) | Artist: Pink Floyd
12: Album: The Dark Side of the Moon | Artist: Pink Floyd
13: Album: The Division Bell | Artist: Pink Floyd
14: Album: The Final Cut | Artist: Pink Floyd
15: Album: The Later Years: 1987-2019 | Artist: Pink Floyd
16: Album: The Piper at the Gates of Dawn | Artist: Pink Floyd
17: Album: The Wall CD1 | Artist: Pink Floyd
18: Album: The Wall CD2 | Artist: Pink Floyd
19: Album: Ummagumma - Live Album | Artist: Pink Floyd
20: Album: Ummagumma - Studio Album | Artist: Pink Floyd
21: Album: Wish You Were Here | Artist: Pink Floyd
Sonos Music Library Albums including Artist: Pink Martini
=========================================================
1: Album: Sympathique | Artist: Pink Martini
Note: multiple artists found ... search not saved
# search_artists, sart
```
Rechercher un album:
```bash
sonos Salon search_albums "The Wall"
Sonos Music Library Album Search: The Wall
==========================================
1: Album: The Wall CD1 | Artist: Pink Floyd
2: Album: The Wall CD2 | Artist: Pink Floyd
# search_albums, salb
```
Rechercher dans la bibliothèque:
```bash
sonos Salon search_library "The Wall"
Sonos Music Library Album Search: The Wall
==========================================
1: Album: The Wall CD1 | Artist: Pink Floyd
2: Album: The Wall CD2 | Artist: Pink Floyd
Sonos Music Library Track Search: The Wall
==========================================
1: Artist: Music | Album: The Music | Title: The Walls Get Smaller
2: Artist: Dave Weckl | Album: Heads Up | Title: Against the Wall
3: Artist: Roger Waters | Album: | Title: Another Brick In The Wall
4: Artist: Pink Floyd | Album: Echoes - The Best Of Pink Floyd | Title: Another Brick In The Wall (Part 2)
5: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.1
6: Artist: Pink Floyd | Album: The Best Of Pink Floyd - A Foot In The Door | Title: Another Brick In The Wall Pt.2
7: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.2
8: Artist: Pink Floyd | Album: The Wall CD1 | Title: Another Brick In The Wall Pt.3
9: Artist: Green Day | Album: Revolution Radio | Title: Bouncing Off The Wall
10: Artist: Radiohead | Album: OK Computer | Title: Climbing Up the Walls
11: Artist: Collectif | Album: Pulp Fiction | Title: Flowers On The Wall / The Statler Brothers
12: Artist: Kaiser Chiefs | Album: The Future is Medieval | Title: Fly On The Wall
13: Artist: Pink Floyd | Album: The Wall CD2 | Title: Outside The Wall
# search_library, sl
```
Recherche une piste:
```bash
sonos Salon search_tracks "Keep the car running"
Sonos Music Library Track Search: Keep the car running
======================================================
1: Artist: Arcade Fire | Album: Neon Bible | Title: Keep the Car Running
# search_tracks, st
```
Afficher les pistes d'un album:
```bash
sonos Salon tracks_in_album "Neon bible"
Sonos Music Library Tracks in Album: Neon Bible
===============================================
1: Artist: Arcade Fire | Album: Neon Bible | Title: Black Mirror
2: Artist: Arcade Fire | Album: Neon Bible | Title: Keep the Car Running
3: Artist: Arcade Fire | Album: Neon Bible | Title: Neon Bible
4: Artist: Arcade Fire | Album: Neon Bible | Title: Intervention
5: Artist: Arcade Fire | Album: Neon Bible | Title: Black Wave/Bad Vibrations
6: Artist: Arcade Fire | Album: Neon Bible | Title: Ocean of Noise
7: Artist: Arcade Fire | Album: Neon Bible | Title: Well and the Lighthouse
8: Artist: Arcade Fire | Album: Neon Bible | Title: (Antichrist Television Blues)
9: Artist: Arcade Fire | Album: Neon Bible | Title: Windowsill
10: Artist: Arcade Fire | Album: Neon Bible | Title: No Cars Go
11: Artist: Arcade Fire | Album: Neon Bible | Title: My Body Is a Cage
# tracks_in_album, tia, lta
```
#### Volume et EQ:
Couper / remettre le son:
```bash
sonos Salon mute <on|off>
```
Retourner le niveau du volume:
```bash
sonos Salon volume
11
# volume 11/100
# volume, vol
```
Régler le niveau du volume:
```bash
sonos Salon volume 12
# volume réglé à 12/100
# volume, vol
```
#### Jouer:
Jouer une piste:
```bash
sonos Salon clear_queue : Salon queue_track "Black Mirror" : Salon play_from_queue 1
```
Jouer la prochaine piste:
```bash
sonos Salon queue_track "Intervention" next : Salon play
```
Aller à la piste suivante:
```bash
sonos Salon next
# next
```
Aller à la piste précédente:
```bash
sonos Salon previous
# previous, prev
```
Mettre en pause:
```bash
sonos Salon pause
sonos Salon pause_all
# Toutes les enceintes du groupe
```
Jouer:
```bash
sonos Salon play
# play, start
```
Arrêter:
```bash
sonos Salon stop
# stop
```
Met en veille dans <durée>:
```bash
sonos Salon sleep_timer 1.5m
sonos Salon sleep_timer 00:01:30
# sleep_timer, sleep <duration|off|cancel> (s/m/h)
# Met en veille dans 90s
```
Met en veille à <heure>:
```bash
sonos Salon sleep_at 17:52
# sleep_at
```
Info sur la piste jouée actuellement:
```bash
sonos Salon track
Album: Neon Bible
Artist: Arcade Fire
Duration: 0:04:19
Playlist_position: 1
Position: 0:01:39
Title: Intervention
# track
```
#### Queue:
Effacer la file d'attente:
```bash
sonos Salon clear_queue
# clear_queue, cq
```
Afficher les pistes dans la file d'attente:
```bash
sonos Salon list_queue
1: Artist: Francis Cabrel | Album: In Extremis | Title: Azincourt
2: Artist: Renaud | Album: Boucan d'enfer | Title: Baltique
3: Artist: Arcade Fire | Album: Neon Bible | Title: Windowsill
4: Artist: Arcade Fire | Album: Neon Bible | Title: Black Mirror
5: Artist: Renaud | Album: Boucan d'enfer | Title: Manhattan-Kaboul
# list_queue, lq, q
```
Jouer la file d'attente:
```bash
sonos Salon play_from_queue
# play_from_queue, pfq, pq
# joue la piste 1
```
Jouer une piste de la file:
```bash
sonos Salon play_from_queue 21
# play_from_queue, pfq, pq
# joue la piste 21
```
Afficher la piste en position 2 de la file:
```bash
sonos Salon list_queue 2
2: Artist: Francis Cabrel | Album: In Extremis | Title: Azincourt
# list_queue, lq,
```
Ajouter une piste à la file d'attente:
```bash
sonos Salon queue_track "Black Mirror"
1
sonos Salon queue_track "Manhattan-Kaboul"
2
# queue_track, qt
# retourne la position dans la file
```
```bash
sonos Salon queue_track "Azincourt" play_next
1
# la piste est mise en dernière position de la file => prochaine piste à être lue.
# play_next | next
```
Ajouter un album à la file d'attente:
```bash
sonos Salon queue_album "Wake Up And Smell The Coffee" play_next
8
# queue_album, qa <play_next|next>
```
Sauver la file d'attente comme playlist Sonos:
```bash
sonos Salon save_queue "Ma playlist"
# save_queue, sq, create_playlist_from_queue
```
Supprimer la piste courante de la file:
```bash
sonos Salon remove_current_track_from_queue
# remove_current_track_from_queue, rltfq
# la piste est retirée de la file, la piste suivante est jouée
```
Supprimer des pistes de la file:
```bash
# range
sonos Salon remove_from_queue 15-17
# séquence
sonos Salon remove_from_queue 3,9
#piste
sonos Salon remove_from_queue 14
# remove_from_queue, rfq, rq
```
#### Divers:
Chainer 2 commandes:
```bash
sonos Salon volume 10 : Salon play
# avec le séparateur ' : '
```
Insérer des délais:
```bash
sonos Salon play : wait 3m : Salon stop
# wait <duration> (10s, 30m, 1.5h, 2:30, 0:1:25)
sonos Salon play : wait_until 18:35:00 : Salon stop
# wait_until <time> (HH:MM, HH:MM:SS)
```
Attendre que la lecture ait démarré / stoppé:
```bash
sonos Salon wait_stop : Salon volume 15
# attend que la lecture s'arrête puis règle le volume à 15
sonos Salon wait_start : Salon volume 13
# attend que la lecture démarre (appui sur le bouton >|| ) puis règle le volume à 13
```
Attendre arrêté pendant <durée>:
```bash
sonos Salon wait_stopped_for 30m : Salon play
# wait_stopped_for, wsf <duration>
```
Boucles:
```bash
loop
loop <iterations>
loop_for <duration>
loop_until <time>
loop_to_start
```
Conditions:
```bash
sonos Salon if_stopped volume 15
# Ajuste le volume à 15 seulement quand Salon sera arrêté.
sonos Salon if_playing volume 15
# Ajuste le volume à 15 seulement si Salon joue.
```
| | |
| ---- | ----------------------------------- |
| sfi | sonos Salon play_fav "france inter" |
| | |
| ss | sonos Salon stop |

94
docs/Divers/adobe.md Normal file
View File

@@ -0,0 +1,94 @@
# Adobe CC_Offline_Package_Generator
https://github.com/chriswayg/CC-Offline-Package-Generator
https://gist.github.com/ayyybe/a5f01c6f40020f9a7bc4939beeb2df1d
On crée un environnement virtuel:
```bash
~/Documents/venv master* ⇡
python3 -m venv cc
~/Documents/venv master* ⇡
cc/bin/pip3 install -U pip setuptools
~/Documents/venv master* ⇡
cc/bin/pip3 install -U requests tqdm
```
On télécharge le scrypt Python:
```bash
~/Documents/venv/cc master* ⇡
wget https://gist.github.com/ayyybe/a5f01c6f40020f9a7bc4939beeb2df1d/raw/6e82a23d381059a345cdf77fc29595ef11985d31/ccdl.py
```
On peut exécuter le programme:
```bash
~/Documents/venv/cc master* ⇡
/Users/bruno/Documents/venv/cc/bin/python3 /Users/bruno/Documents/venv/cc/ccdl.py
=================================
= Adobe macOS Package Generator =
========= 0.1.2-hotfix1 =========
Downloading products.xml
```
On crée un script pour lancer le script Python avec un lien dans /Applications:
```bash
~/Documents/venv/cc master* ⇡
nano ccdl.command
```
```bash
#!/usr/bin/env bash
/Users/bruno/Documents/venv/cc/bin/python3 /Users/bruno/Documents/venv/cc/ccdl.py
```
```bash
~/Documents/venv/cc master* ⇡
ln -s /Users/bruno/Documents/venv/cc/ccdl.command /Applications/Adobe\ CC_Offline_Package_Generator
```
Un script qui réalise tout cela:
```bash
#!/usr/bin/env bash
venv_path=$HOME/Documents/venv/
folder=adobeCC
# Virtual environnment
cd $venv_path
python3 -m venv $folder
$folder/bin/pip3 install -U pip setuptools
$folder/bin/pip3 install -U requests tqdm
cd $venv_path$folder
# dl gist
wget https://gist.github.com/ayyybe/a5f01c6f40020f9a7bc4939beeb2df1d/raw/6e82a23d381059a345cdf77fc29595ef11985d31/ccdl.py
# Launch script
echo "#!/usr/bin/env bash" > $folder.command
echo "$venv_path$folder/bin/python3 $venv_path$folder/ccdl.py" > $folder.command
chmod +x $folder.command
# Link in /Applications
ln -s "$venv_path$folder/$folder.command" "/Applications/Adobe CC_Offline_Package_Generator"
```

View File

@@ -99,3 +99,42 @@ echo -e "\e[1;34m $dd $dh $dm $ds \e[0m"
END_COMMENT
```
Créer une playlist .m3u:
```bash
$ ~/Music/Shaka Ponk - Apelogies/CD1 master*
# Musepack(mpc) Monkey's Audio(ape) WavPack(wv) Apple alac(m4a)
printf "#EXTM3U\n" > playlist.m3u
ls -1v | grep -E '.mp3|.mp4|.m4a|.aac|.alac|.flac|.ogg|.mpc|.ape|.wma|.wav' >> playlist.m3u
#EXTM3U
01. ————————THE GREATEST TITS.mp3
02. Hombre Que Soy (2020).mp3
03. I'm Picky (2020).mp3
04. Sex Ball (2020).mp3
05. Smells Like Teen Spirit (2020).mp3
06. Hell'o (2020).mp3
07. French Touch Puta Madre (2020).mp3
08. My Name Is Stain.mp3
09. Wanna Get Free (2020).mp3
10. Story o' My Lf (2020).mp3
11. Let's Bang (2020).mp3
12. Fonk Me (2020).mp3
13. Mysterious Ways.mp3
14. How We Kill Stars (2020).mp3
15. Do (Unplugged).mp3
16. Body Cult (2020).mp3
17. Palabra Mi Amor (2020).mp3
```
```bash
printf "#EXTM3U\n" > playlist.m3u
find . -name '*.mp3' | sort >> playlist.m3u
```
```bash
for i in {1..5}; do printf "#EXTM3U\n" > ${i}star.m3u; find . -type f -exec grep -i -l --text "rating.$i" '{}' \; >> ${i}star.m3u; done
```

View File

@@ -0,0 +1,87 @@
# direnv
https://direnv.net
### Installation:
```bash
$ brew install direnv
```
Ajouter à la fin du `.bashrc`
```bash
eval "$(direnv hook bash)"
```
ou du `.zshrc`
```bash
eval "$(direnv hook zsh)"
```
### Utilisation:
Création de la variable d'environnement dans le fichier `.envrc`:
```bash
~/Documents/Scripts/bash master*
echo export PASSWORD="34diK=[6]Zui" > .envrc
direnv: error /Users/bruno/Documents/Scripts/bash/.envrc is blocked. Run `direnv allow` to approve its content
```
Il faut autoriser l'utilisation du fichier `.envrc`:
```bash
~/Documents/Scripts/bash master*
direnv allow .
direnv: loading ~/Documents/Scripts/bash/.envrc
direnv: export +PASSWORD
```
La variable PASSWORD est disponible dans le répertoire bash:
```bash
~/Documents/Scripts/bash master* 13s
echo ${PASSWORD}
34diK=[6]Zui
```
mais plus en dehors:
```bash
~/Documents/Scripts/bash master*
cd ..
direnv: unloading
~/Documents/Scripts master*
echo ${PASSWORD}
```
Création du script:
```bash
#!/bin/bash
...
BKP_PASS="${PASSWORD}"
...
```
Lancer le script:
```bash
~/Documents/Scripts master* 2m 0s
cd bash && ./backup_mysql.sh
direnv: loading ~/Documents/Scripts/bash/.envrc
direnv: export +PASSWORD
# la variable PASSWORD est dispo.
```

View File

@@ -26,6 +26,17 @@ i=0; i=$(expr $i + 1) user 0m5.464s
#### Beep:
Jouer un beep:
```bash
echo -en "\007"
echo -en '\a'
```
#### [Chaine de caractères:](strings.md)
##### Concaténer une chaine:
@@ -64,6 +75,34 @@ Le répertoire courant est /Users/bruno
#### Supprimer les lignes vides:
```bash
$ echo "$l"
1: Amazing Blues
2: France Inter 95.9 (Émissions-débats France)
3: K6 FM 101.6 (Musique Locale)
4: RTL 104.2 (Monde)
5: Radio Classique 105.8 (Classique)
6: Rire et Chansons 91.8 (Comédie)
$ echo "$l" | awk 'NF'
$ echo "$l" | sed '/^$/d'
$ echo "$l" | grep .
$ echo "$l" | grep -v '^$'
1: Amazing Blues
2: France Inter 95.9 (Émissions-débats France)
3: K6 FM 101.6 (Musique Locale)
4: RTL 104.2 (Monde)
5: Radio Classique 105.8 (Classique)
6: Rire et Chansons 91.8 (Comédie)
```
#### [Tableaux:](tableaux.md)
Déclarer un tableau associatif:

View File

@@ -125,6 +125,14 @@ Cabc
$ echo ${string:(-4)}
Cabc
$ echo -n $string | tail -c 4
# Filename / extension
filename=$(basename "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"
```
@@ -158,3 +166,75 @@ ABC123ABC
http://tldp.org/LDP/abs/html/string-manipulation.html
#### Majuscule / Capitalize:
```bash
string=bonjour
# 1ere lettre en majuscule (Bash 4)
echo ${string^}
Bonjour
# Met en majuscule toute la chaine (Bash 4)
echo ${string^^}
BONJOUR
echo $string | tr '[:lower:]' '[:upper:]'
echo $string | tr '[a-z]' '[A-Z]'
BONJOUR
```
#### Parcourrir une variable multi-ligne:
```bash
dependencies=$(echo "CairoSVG,setuptools" | xargs pipdeptree -r -p )
```
```bash
while IFS= read -r line; do
echo "${line}"
done <<< "$dependencies"
# IFS= requis pour afficher les espaces en début de ligne
```
#### Regex:
[[ STRING =~ REGEX ]]
Chaine commençant par:
```bash
# String est une url ?
if [[ $string =~ ^http ]]
```
Chaine se terminant par:
```bash
# String est un fichier .mp3 ?
if [[ $string =~ .mp3$ ]]
```
Adresse IP:
```bash
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
```
Email:
```bash
if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
```

View File

@@ -0,0 +1,250 @@
# Applications
linuxserver/pixapop (eol)
photoshow (nok)
Own photo (nok)
## Photonix Photo Manager
https://github.com/damianmoore/photonix
```bash
bruno@DS916:/volume1/docker/photoprism $ nano docker-compose.yml
bruno@DS916:/volume1/docker/photoprism $ sudo docker-compose stop photoprism
Password:
Stopping photoprism_photoprism_1 ... done
bruno@DS916:/volume1/docker/photoprism $ sudo docker-compose up -d --no-deps photoprism
Recreating photoprism_photoprism_1 ... done
bruno@DS916:/volume1/docker/photoprism $ nano docker-compose.yml
# index les fichiers sans les importer
bruno@DS916:/volume1/docker/photoprism $ sudo docker-compose exec photoprism photoprism index
```
## Lychee
https://github.com/LycheeOrg/Lychee
https://lycheeorg.github.io/docs/distributions.html
https://github.com/LycheeOrg/Lychee/releases
```bash
bruno@DS916:/volume1/web/Lychee/public/uploads/import/Pano $ cd ..
drwxr-xr-x 1 http http 28 Nov 12 09:13 .
drwxr-xr-x 1 http http 56 Oct 9 13:15 ..
drwxr-xr-x 1 root root 674 Nov 12 09:21 Pano
-rw-r--r-- 1 http http 0 Oct 9 13:15 index.html
```
Yes, just create a Symbolic Link and allow your apache configuration to follow them. At website.com root `ln -s Lychee/public pics` and you will get exactly what you want: `website.com/pics`
https://github.com/GustavePate/lycheesync
## PiGallery2
https://github.com/bpatrik/pigallery2
`docker-compose.yml`
```yaml
version: '3'
services:
pigallery2:
image: bpatrik/pigallery2:latest
container_name: pigallery2
environment:
- NODE_ENV=production
volumes:
- "./config:/app/data/config" # CHANGE ME
- "db-data:/app/data/db"
- "/volume1/photo:/app/data/images" # CHANGE ME
- "./tmp:/app/data/tmp" # CHANGE ME
ports:
- 35000:80
restart: always
volumes:
db-data:
```
## piwigo
https://piwigo.org
https://pwgdemo.kuther.net
https://fr.piwigo.com/blog/2020/03/12/bootstrap-darkroom-nouveau-theme-piwigo-com/
`docker-compose.yml`
```yaml
version: "2.1"
services:
piwigo:
image: mathieuruellan/piwigo
container_name: piwigo2
environment:
- PUID=1026 ##change to your user id. It cannot be the root user
- PGID=100 ##change to your user group ID
- TZ=Europe/Paris
volumes:
- /volume1/docker/piwigo2/data/galleries:/var/www/galleries
- /volume1/docker/piwigo2/data/local:/var/www/local
- /volume1/docker/piwigo2/data/plugins:/var/www/plugins
- /volume1/docker/piwigo2/data/themes:/var/www/themes
- /volume1/docker/piwigo2/cache:/var/www/_data/i
- /volume1/docker/piwigo2/upload:/var/www/upload
- /var/log
- /volume1/docker/piwigo2/log:/var/log/apache2
ports:
- 8125:80
restart: unless-stopped
mariadb:
image: mariadb:latest
container_name: mysqlpiwigo2
environment:
- PUID=0 ##change to your user id. I use root since I am on a closed system
- PGID=0 ##change to your user group ID. Again I use root since I am on a closed system
- MYSQL_ROOT_PASSWORD=xxx ##set a password
- TZ=Europe/Paris
- MYSQL_DATABASE=piwigo
- MYSQL_USER=piwigo
- MYSQL_PASSWORD=xxx
volumes:
- /volume1/docker/piwigo2/mysql/:/var/lib/mysql
ports:
- 3306:3306
restart: unless-stopped
```
Une fois le container crée et exécuté, on ouvre le navigateur sur la page http://ds916.local:8125. La page d'installation de Piwigo doit s'afficher.
<u>Base de donnée:</u> remplir les champs comme ceux du docker-compose.yml, section mariadb. Pour host, il faut connaître l'IP du serveur bdd:
```bash
sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
CONTAINER ID NAMES
700a2cd00cba mysqlpiwigo2
sudo docker container exec 700a2cd00cba hostname -I
172.18.0.3
```
<u>Administration:</u> remplir les champs, puis cliquer sur **Démarrer l'installation**.
## thumbsup
https://thumbsup.github.io
https://github.com/thumbsup/thumbsup
Sur le NAS Synology, impossible d'installer thumbsup avec nvm (erreur à la compilation de `better_sqlite3`).
Il faut passer par **Docker**:
```bash
bruno@DS916:/volume1/docker/thumbsup $ l
drwxrwxrwx 1 bruno users 52 Nov 15 10:52 input
-rwxrwxrwx 1 bruno users 171 Nov 15 09:34 install2.sh
drwxrwxrwx 1 bruno users 0 Nov 15 10:38 output
drwxrwxrwx 1 bruno users 140 Nov 15 11:10 website
```
`/volume1/docker/thumbsup/install2.sh`
```bash
#/bin/bash -e
docker run \
-v /volume1/photo/Flore:/input:ro \
-v `pwd`/website:/output \
thumbsupgallery/thumbsup:latest \
thumbsup --config /input/config.json
```
Le fichier `config.json` est placé à la racine du dossier source de photos:
```bash
bruno@DS916:/volume1/photo/Flore $ l
drwxrwxrwx 1 bruno PhotoSta 1706 Nov 15 2016 Arbres
drwxrwxrwx 1 bruno PhotoSta 136 Mar 8 2016 Champignons
drwxrwxrwx 1 bruno PhotoSta 2592 Nov 15 2016 Fleurs
-rwxrwxrwx 1 bruno users 78 Nov 15 11:08 config.json
```
`/volume1/photo/Flore/config.json`
```bash
{
"input": "/input",
"output": "/output",
"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": "flow",
"title": "Photos...",
"embed-exif": true,
"locale": "fr"
}
```
Pour lancer **thumbsup**:
```bash
bruno@DS916:/volume1/docker/thumbsup $ sudo ./install2.sh
2020-11-15T11:03:51.737Z thumbsup:info
2020-11-15T11:03:51.783Z thumbsup:info ┌───────────────────────────────────┐
2020-11-15T11:03:51.783Z thumbsup:info │ │
2020-11-15T11:03:51.783Z thumbsup:info │ Gallery generated successfully! │
2020-11-15T11:03:51.783Z thumbsup:info │ 4 albums, 82 photos, 0 videos │
2020-11-15T11:03:51.783Z thumbsup:info │ │
2020-11-15T11:03:51.783Z thumbsup:info └───────────────────────────────────┘
2020-11-15T11:03:51.783Z thumbsup:info
```
Pour accèder à la galerie depuis le serveur web, on crée un lien symbolique:
```bash
bruno@DS916:/volume1/docker/thumbsup $ ln -s /volume1/docker/thumbsup/website/ /volume1/web/thumbsup
```
La galerie est alors accessible depuis http://192.168.1.7/thumbsup/index.html.
## emby
https://github.com/mickael-kerjean/filestash/wiki/Release-0.2:-Photo-Management
https://juicebox.net

View File

@@ -0,0 +1,716 @@
# docker
https://docs.docker.com/
### Containers installés:
#### Synology Docker GUI:
| Container | Image | Version | Date DL |
| ---------------------------------- | ------------------------------------------- | ------- | ------- |
| bizmodeller-mymediaforalexa-amd641 | bizmodeller/mymediaforalexa-amd64:1.3.135.0 | | |
| homebridge | oznu/homebridge:latest | | |
| hoobs | hoobs/hoobs:latest | | |
| photonix | damianmoore/photonix:latest | | |
| PiHole | pihole/pihole:latest | | |
| f | linuxserver/photoshow:latest | | |
#### Portainer:
| Container | Image | Version | Date DL |
| --------- | ----- | ------- | ------- |
| | | | |
| | | | |
Portainer et Watchtower sont installés depuis le terminal (voir plus bas).
Docker
bruno@DS916:/volume1/homes/bruno $ docker --version
Docker version 18.09.8, build bfed4f5
bruno@DS916:/volume1/homes/bruno $ docker-compose --version
docker-compose version 1.24.0, build 0aa59064
Update docker-compose
https://www.smarthomebeginner.com/synology-docker-media-server/
## id
```bash
bruno@DS916:~ $ id
uid=1026(bruno) gid=100(users) groups=100(users),101(administrators)
```
```bash
id
uid=501(bruno) gid=20(staff) groups=20(staff),12(everyone)...
id -u
501
id -g
20
```
## docker-compose
mkdir -p /volume1/docker/personal/ghost/ghost
chown 1000:1000 /volume1/docker/personal/ghost/ghost
Créer un fichier **docker-compose.yml** dans **/volume1/docker/personal/ghost**
(pas de TAB)
```
/volume1/docker/personal/ghost $ sudo docker-compose up -d
```
Le container doit alors apparaitre dans Synology DSM Docker
```bash
$ docker-compose stop photoprism
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
$ sudo docker-compose stop photoprism
Password:
Stopping photoprism_photoprism_1 ... done
```
## MAJ
Pour mettre à jour le container, supprimer le container dans la GUI et relancer `docker-compose up -d`
```
/volume1/docker/personal/ghost $ sudo docker-compose pull
/volume1/docker/personal/ghost $ sudo docker-compose up -d
```
```
docker-compose up --force-recreate --build -d
```
http://tonylawrence.com/posts/unix/synology/free-your-synology-ports/
Arreter un container:
docker-compose down
## Containers:
**Liste des containers qui tournent:**
```bash
docker ps (Docker <1.13)
docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
4c66e278fd6d gitlab/gitlab-ce:latest "/assets/wrapper" 9 months ago Up 2 hours (unhealthy) 0.0.0.0:922->22/tcp, 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp gitlab
```
```bash
docker container ls --format 'table {{.Names}}\t{{.Status}}'
NAMES STATUS
watchtower Up 38 minutes
portainer Up 2 hours
photonix Up 20 hours
homebridge Up 2 days
bizmodeller-mymediaforalexa-amd641 Up 13 days
PiHole Up 3 weeks (healthy)
docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\t{{.Networks}}\t{{.Mounts}}"
CONTAINER ID IMAGE COMMAND CREATED AT STATUS PORTS NAMES NETWORKS MOUNTS
18fba7e277be portainer/portainer-ce "/portainer" 2020-11-09 22:22:47 +0100 CET Up 15 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp portainer bridge portainer_data,/run/host-serv…
```
**Liste des containers stoppés:**
```bash
docker ps --filter "status=exited"
docker container ls -f "status=exited"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 50 minutes ago photonix
23c90981855b redis:3.2.8 "docker-entrypoint.s…" About an hour ago Exited (0) 50 minutes ago photonix-redis
d2b481b91f10 portainer/portainer "/portainer" 9 months ago Exited (2) 9 months ago magical_pare
9763d849e8b1 portainer/portainer "/portainer" 9 months ago Exited (255) 9 months ago 0.0.0.0:9000->9000/tcp affectionate_antonelli
```
**Liste de tous les containers:**
```bash
docker ps --all
docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
842cbbada398 damianmoore/photonix:latest "/bin/sh -c ./system…" About an hour ago Exited (137) 54 minutes ago photonix
104f0c7e80a1 postgres:11.1-alpine "docker-entrypoint.s…" About an hour ago Up About an hour 5432/tcp photonix-postgres
23c90981855b redis:3.2.8 "docker-entrypoint.s…" About an hour ago Exited (0) 54 minutes ago photonix-redis
4c66e278fd6d gitlab/gitlab-ce:latest "/assets/wrapper" 9 months ago Up 2 hours (unhealthy) 0.0.0.0:922->22/tcp, 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp gitlab
d2b481b91f10 portainer/portainer "/portainer" 9 months ago Exited (2) 9 months ago magical_pare
9763d849e8b1 portainer/portainer "/portainer" 9 months ago Exited (255) 9 months ago 0.0.0.0:9000->9000/tcp affectionate_antonelli
```
**Liste des ID des containers qui tournent:**
```bash
docker ps -q
docker container ls -q
104f0c7e80a1
4c66e278fd6d
```
**Stopper un container:**
```bash
docker stop gitlab
docker stop 4c66e278fd6d
```
**Stopper tous les containers:**
```bash
docker container stop $(docker container ls -aq)
```
**Stopper tous les containers associés à une image:**
```bash
docker ps -q --filter ancestor=IMAGE_NAME | xargs docker stop
```
**Supprimer un container:**
```bash
docker container rm d2b481b91f10 9763d849e8b1
d2b481b91f10
9763d849e8b1
```
```bash
sudo docker rm b5576f445729
Error response from daemon: You cannot remove a running container b5576f44572913f1154e429b2bc84f84e696f4006adbaf8c2fb44f9dc1ff013a. Stop the container before attempting removal or force remove
$ sudo docker rm b5576f445729 --force
b5576f445729
```
**Supprimer tous les containers:**
```bash
docker container rm $(docker container ls -aq)
```
**Exécuter une commande dans un container:**
```
sudo docker container ls --format 'table {{.ID}}\t{{.Names}}'
CONTAINER ID NAMES
700a2cd00cba lychee
sudo docker container exec 700a2cd00cba hostname
700a2cd00cba
sudo docker container exec 700a2cd00cba hostname -I
172.18.0.3
```
## Images:
**Liste des images:**
```bash
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
oznu/homebridge latest 3fa073f20624 4 days ago 625MB
hoobs/hoobs latest c35c2f7222f3 4 days ago 558MB
linuxserver/photoshow latest fd8dc782b92c 8 days ago 214MB
damianmoore/photonix latest 79aeacedba12 2 weeks ago 825MB
portainer/portainer-ce latest a0a227bf03dd 2 months ago 196MB
bizmodeller/mymediaforalexa-amd64 1.3.135.0 298c7bdbf981 2 months ago 111MB
pihole/pihole latest 4642d275ab73 3 months ago 296MB
v2tec/watchtower latest 3069a9fb302a 2 years ago 9.49MB
```
Changer le [format de la sortie](https://docs.docker.com/engine/reference/commandline/images/#format-the-output):
```
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}"
REPOSITORY TAG IMAGE ID CREATED AT SIZE
oznu/homebridge latest 3fa073f20624 2020-11-06 07:05:24 +0100 CET 625MB
hoobs/hoobs latest c35c2f7222f3 2020-11-05 15:17:26 +0100 CET 558MB
linuxserver/photoshow latest fd8dc782b92c 2020-11-02 11:12:54 +0100 CET 214MB
damianmoore/photonix latest 79aeacedba12 2020-10-24 10:06:20 +0200 CEST 825MB
portainer/portainer-ce latest a0a227bf03dd 2020-08-31 11:04:47 +0200 CEST 196MB
bizmodeller/mymediaforalexa-amd64 1.3.135.0 298c7bdbf981 2020-08-18 22:00:10 +0200 CEST 111MB
pihole/pihole latest 4642d275ab73 2020-08-10 04:45:33 +0200 CEST 296MB
v2tec/watchtower latest 3069a9fb302a 2018-03-02 16:09:26 +0100 CET 9.49MB
```
Pour avoir ce format par défaut, ajouter `"imagesFormat": "table {{.Repository}}\\t{{.Tag}}\\t{{.ID}}\\t{{.Size}}\\t{{.CreatedAt}}"` dans le `~/.docker/config.json`
Sur une connection ssh: `ssh foo@bar docker images --format "$(jq .imagesFormat < ~/.docker/config.json)"`
**Supprimer une image:**
```bash
docker image rm 75835a67d134
```
**Supprimer toutes les images non référencées par un container existant:**
```bash
docker image prune -a
```
Infos sur une image:
```bash
docker image inspect 79aeacedba12
[
{
"Id": "sha256:79aeacedba12f180af279aa030c7a64a0b2a9dc428a1dc1c4c074caafa05426d",
"RepoTags": [
"damianmoore/photonix:latest"
],
"RepoDigests": [
"damianmoore/photonix@sha256:ae3ab04f67eadfaaf58da125665b198bca02e3d0ec6025b9cb379969de610a2c"
],
"Parent": "",
"Comment": "",
"Created": "2020-10-24T08:06:20.266765865Z",
# Date de création d'une image:
docker image inspect 79aeacedba12 | grep 'Created'
"Created": "2020-10-24T08:06:20.266765865Z",
```
## Volumes:
**Liste des volumes:**
```bash
docker volume ls
DRIVER VOLUME NAME
local 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
local 9d1fbf38c96c6474e159d512ff218c67ff7307c42f46cb01724358db854f3dd9
local 1057b3bf15c1adb34f50614c098ab821d39fb14b234ffc996dd84ad36778bc1d
local e9fa91a626cb4ed70e273272d0865717a2d74343a5c644459c34f5914e9f0ecb
local portainer_data
```
**Supprimer un volume:**
```
docker volume rm 4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
4a0cb49ef186f5b6b920cb783e9c7a3d80065d13575dbe956a0875451490e009
```
**Supprimer tous les volumes inutilisés:**
```
docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
```
## Réseaux:
**Liste des réseaux:**
```
docker network ls
NETWORK ID NAME DRIVER SCOPE
cb8db3bfdaa8 bridge bridge local
5a1ec0a7d634 host host local
51e54153c11f none null local
b43d3ebd9c3f photonix_default bridge local
a522745b92b7 pixapop_default bridge local
```
**Supprimer tous les réseaux inutilisés:**
```
docker network prune
```
**Supprimer tous les réseaux crées il y a plus de 12h:**
```
docker network prune --filter "until=12h"
WARNING! This will remove all custom networks not used by at least one container.
Are you sure you want to continue? [y/N] y
```
## Stats:
```bash
docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDSCONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
18fba7e277be portainer 0.00% 11.86MiB / 1.941GiB 0.60% 773kB / 6.04MB 287kB / 3.53MB 12
```
## Prune:
```bash
sudo docker system prune
Password:
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
b73a0a237e53a686d8d11cedb66677a7b2681b43701a12f9bdc36a4bd35b1302
042c7b1cbd3986267a395915d88974a04eccc4baec0ecaa8dcab517db39fedc3
abd5940cc1127fb0cb9038ce179ef35c12fd5816ece403429b52f99f81c5b28f
146e06c1be5b7d1385326e04880d01e2e1a3a090d4db86f9c2120b75844aa952
Deleted Networks:
data_export
pixapop_default
Total reclaimed space: 242.4MB
```
## Info:
```bash
bruno@DS916:/volume1/docker/photoshow2 $ sudo docker info
Password:
Containers: 6
Running: 5
Paused: 0
Stopped: 1
Images: 7
Server Version: 18.09.8
Storage Driver: btrfs
Logging Driver: db
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs db fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 0cf16177dbb234350dc27dd2bbd1d7cebd098108
runc version: 6cc9d3f2cd512eeb3d548e2f6b75bcdebc779d4d
init version: e01de58 (expected: fec3683)
Security Options:
apparmor
Kernel Version: 3.10.105
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.872GiB
Name: DS916
ID: TBHV:43JW:H65O:Y25A:ML34:P52M:ZNPT:ASUK:GBMY:73Y5:2GMW:42RL
Docker Root Dir: /volume1/@docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
```
Ou sont stockés les images et containers:
| | |
| ---------------------- | ------------------------------------------------------------ |
| Ubuntu, Debian, Fedora | /var/lib/docker/ |
| Windows | C:\ProgramData\DockerDesktop |
| macOS | ~/Library/Containers/com.docker.docker/Data/vms/0/ |
| Synology DSM | root@DS916:/volume1/@docker/image/btrfs/imagedb/content/sha256 |
```bash
root@DS916:/volume1/@docker/image/btrfs/imagedb/content/sha256# ls
298c7bdbf9810c612242d697ba093a16d2d6d14ba2b2de6b0b9bba4f2a7903b1 4642d275ab7382c208b5ba81f78b672166833fca2f5e3085b93904099f167e47 c35c2f7222f372a2d0b26c7dbab566af74cbbb057bf5632103978063ad8423d8
3069a9fb302acfc664970a4cdb962b9915f15aeb089b6216f17edcd29d5dfc80 79aeacedba12f180af279aa030c7a64a0b2a9dc428a1dc1c4c074caafa05426d fd8dc782b92cf0bdfa4d35ab3b857f1ffdb6ea7c6bb77c7436d7ca458038042c
3fa073f206248faf2c4cc11108386ec1d3d3070fc120b0d781d2d9985d88681e a0a227bf03ddc8b88bbb74b1b84a8a7220c8fa95b122cbde2a7444f32dc30659
```
```bash
root@DS916:/volume1/@docker/image/btrfs/imagedb/content/sha256# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
oznu/homebridge latest 3fa073f20624 4 days ago 625MB
hoobs/hoobs latest c35c2f7222f3 4 days ago 558MB
linuxserver/photoshow latest fd8dc782b92c 8 days ago 214MB
damianmoore/photonix latest 79aeacedba12 2 weeks ago 825MB
portainer/portainer-ce latest a0a227bf03dd 2 months ago 196MB
bizmodeller/mymediaforalexa-amd64 1.3.135.0 298c7bdbf981 2 months ago 111MB
pihole/pihole latest 4642d275ab73 3 months ago 296MB
v2tec/watchtower latest 3069a9fb302a 2 years ago 9.49MB
```
Ports exposés par tous les containers:
```bash
$ sudo docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a
CONTAINER ID NAMES PORTS
8ccdd13f4c96 portainer
c893138cd738 pihole
3fa2cd3a0f35 lychee_db 3306/tcp
17517d71273d photonix 0.0.0.0:8888->80/tcp
4ed16c697cec photoprism_photoprism_1 0.0.0.0:2342->2342/tcp
21cfbfda061f homebridge
91345de863d2 lychee 0.0.0.0:90->80/tcp
b99364278d8f photonix-postgres
0e7770c37073 photonix-redis
c3e247ccfebd pigallery2 0.0.0.0:35000->80/tcp
d98f08308f24 Watchtower 8080/tcp
5dbb7fd0d513 hoobs
b47b4299cc38 bizmodeller-mymediaforalexa-amd641 0.0.0.0:52050-52051->52050-52051/tcp
```
## Portainer:
**Installer Portainer (macOS):**
```bash
~/Documents/docker master* ⇡
docker volume create portainer_data
portainer_data
~/Documents/docker master* ⇡
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Unable to find image 'portainer/portainer-ce:latest' locally
latest: Pulling from portainer/portainer-ce
d1e017099d17: Already exists
b0718b1ef1b0: Pull complete
Digest: sha256:0ab9d25e9ac7b663a51afc6853875b2055d8812fcaf677d0013eba32d0bf0e0d
Status: Downloaded newer image for portainer/portainer-ce:latest
18fba7e277beac21a46145c294737c95fe2b3c33f2097a66980127a295b27bb3
```
**Installer Portainer (Synology DSM):**
```bash
$ mkdir /volume1/docker/portainer
$ cd /volume1/docker/portainer
bruno@DS916:/volume1/docker/portainer $ sudo docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /volume1/docker/portainer:/data portainer/portainer-ce
```
Un container n'est plus visible dans la GUI Synology si il a été modifié dans Portainer.
De même, tout container crée dans Portainer n'est pas visible dans la GUI Synology.
**Télécharger une image:**
Dans Portainer -> Images -> Pull image, entrer le nom de l'image (linuxserver/sonarr par ex) trouvé sur [DockerHub](https://hub.docker.com/r/linuxserver/sonarr).
**Créer un nouveau container:**
Dans Portainer -> Containers -> Image, entrer le nom de l'image (linuxserver/sonarr par ex) trouvé sur [DockerHub](https://hub.docker.com/r/linuxserver/sonarr).
**Manual network port publishing** :
host 8989 - container 8989
host 9898 - container 9898
## Watchtower:
```
# v2tec/watchtower non maintenu
# containrrr/watchtower maintenu
```
**Installer Watchtower (Synology DSM):**
```bash
bruno@DS916:~ $ sudo docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower
```
https://www.nas-forum.com/forum/topic/63740-tuto-mise-à-jour-automatique-des-containers-docker/
```bash
docker run -d \
--name Watchtower \
-e TZ=Europe/Paris \
-e WATCHTOWER_CLEANUP=true \
-e WATCHTOWER_DEBUG=true \
-e WATCHTOWER_INCLUDE_STOPPED=true \
-e WATCHTOWER_REVIVE_STOPPED=true \
-e WATCHTOWER_POLL_INTERVAL=3600 \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower
# efface les anciennes images quand de nouvelles sont téléchargées
# inclus les containers arrêtés et les réactive si ils ont été mis à jour
# active le loging verbeux
# cherche les mises à jour 1x par heure
```
```bash
docker run -d \
--name Watchtower \
-e TZ=Europe/Paris \
-e WATCHTOWER_CLEANUP=true \
-e WATCHTOWER_DEBUG=true \
-e WATCHTOWER_INCLUDE_STOPPED=true \
-e WATCHTOWER_REVIVE_STOPPED=true \
-e WATCHTOWER_SCHEDULE="0 0 * * * *" \
-e WATCHTOWER_ROLLING_RESTART=true \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower
WATCHTOWER_NOTIFICATIONS_LEVEL=debug
- WATCHTOWER_NOTIFICATIONS=email
- WATCHTOWER_NOTIFICATION_EMAIL_FROM=user@free.fr
- WATCHTOWER_NOTIFICATION_EMAIL_TO=user@free.fr
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.free.fr
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=user
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=MdP mail free
- WATCHTOWER_NOTIFICATION_EMAIL_DELAY=2
WATCHTOWER_NOTIFICATIONS_LEVEL=debug
WATCHTOWER_ROLLING_RESTART
WATCHTOWER_SCHEDULE="0 0 4 * * *"
WATCHTOWER_SCHEDULE="0 0 * * * *"
Field name | Mandatory? | Allowed values | Allowed special characters
---------- | ---------- | -------------- | --------------------------
Seconds | Yes | 0-59 | * / , -
Minutes | Yes | 0-59 | * / , -
Hours | Yes | 0-23 | * / , -
Day of month | Yes | 1-31 | * / , - ?
Month | Yes | 1-12 or JAN-DEC | * / , -
Day of week | Yes | 0-6 or SUN-SAT | * / , - ?
```
```
Entry | Description | Equivalent To
----- | ----------- | -------------
@yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *
@monthly | Run once a month, midnight, first of month | 0 0 0 1 * *
@weekly | Run once a week, midnight between Sat/Sun | 0 0 0 * * 0
@daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *
@hourly | Run once an hour, beginning of hour | 0 0 * * * *
```
```
docker top
docker service ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
docker node ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
docker config ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
```
```
If you're using the Synology web ui for Docker, pull latest stable, stop, rename, create new, start
Happy with the new version? Delete the prior container version. Done. The longest part (for me) of doing a container upgrade is pulling & unpacking the updated container image.
```
```
This is how I update my containers on Synology Docker;
Open the Docker package.
Go to the Registry, and search for the image.
Click download, and choose the 'latest' tag
This will download the latest image and overwrite the existing older image.
Stop the container that was built on the old image.
Highlight it and select the Clear action.
Restart the container and it will be built from the new image.
This assumes that you've correctly mapped your container /config directory to the local volume, so all the config will be used by the updated image.
```
web based interface to monitor your Docker container logs live
docker run -d \
--name dozzle \
--volume=/var/run/docker.sock:/var/run/docker.sock \
-p 8888:8080 \
amir20/dozzle:latest
### Applications:
Docstation (Mac/Win/Linux)
https://github.com/DockStation/dockstation/releases
Docker compose UI (container)
https://github.com/francescou/docker-compose-ui
Ouroboros (! stopped)
https://github.com/pyouroboros/ouroboros

View File

@@ -1,5 +1,41 @@
# git
[Git Cheatsheet](http://ndpsoftware.com/git-cheatsheet.html#loc=workspace;)
### Démarrage:
Les fichiers peuvent avoir 3 états:
1. <u>Validé</u> signifie que les données sont stockées en sécurité dans votre base de données locale.
2. <u>Modifié</u> signifie que vous avez modifié le fichier mais qu'il n'a pas encore été validé en base.
3. <u>Indexé</u> signifie que vous avez marqué un fichier modifié dans sa version actuelle pour qu'il fasse partie du prochain instantané du projet.
Ce qui induit les 3 sections d'un projet git:
1. Le <u>répertoire Git</u> (dépôt local) est l'endroit où Git stocke les méta-données et la base de données des objets de votre projet. C'est la partie la plus importante de Git, et c'est ce qui est copié lorsque vous clonez un dépôt depuis un autre ordinateur.
2. Le <u>répertoire de travail</u> (working copy) est une extraction unique d'une version du projet. Ces fichiers sont extraits depuis la base de données compressée dans le répertoire Git et placés sur le disque pour pouvoir être utilisés ou modifiés.
3. La <u>zone d'index</u> (stage) est un simple fichier, généralement situé dans le répertoire Git, qui stocke les informations concernant ce qui fera partie du prochain instantané.
| | |
| ---- | ---- |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
### Créer un repo git
Sur le serveur (DS916), aller dans le dossier Repo:
@@ -41,22 +77,6 @@ ssh:dsm916/volume1/Repositories/shell_scripts.git
### Démarrage:
Les fichiers peuvent avoir 3 états:
1. <u>Validé</u> signifie que les données sont stockées en sécurité dans votre base de données locale.
2. <u>Modifié</u> signifie que vous avez modifié le fichier mais qu'il n'a pas encore été validé en base.
3. <u>Indexé</u> signifie que vous avez marqué un fichier modifié dans sa version actuelle pour qu'il fasse partie du prochain instantané du projet.
Ce qui induit les 3 sections d'un projey git:
1. Le <u>répertoire Git</u> est l'endroit où Git stocke les méta-données et la base de données des objets de votre projet. C'est la partie la plus importante de Git, et c'est ce qui est copié lorsque vous clonez un dépôt depuis un autre ordinateur.
2. Le <u>répertoire de travail</u> (working copy) est une extraction unique d'une version du projet. Ces fichiers sont extraits depuis la base de données compressée dans le répertoire Git et placés sur le disque pour pouvoir être utilisés ou modifiés.
3. La <u>zone d'index</u> est un simple fichier, généralement situé dans le répertoire Git, qui stocke les informations concernant ce qui fera partie du prochain instantané.
#### Fichier de config:
Pour l'utilisateur: `~/.gitconfig`
@@ -89,6 +109,16 @@ $ man git-<verbe>
$ git help config
```
#### Débugger:
```bash
$ GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push KYMSU_github master
18:10:42.888454 git.c:444 trace: built-in: git push KYMSU_github master
18:10:42.890608 run-command.c:663 trace: run_command: GIT_DIR=.git git remote-https KYMSU_github https://github.com/Bruno21/kymsu.git
18:10:42.927675 git.c:729 trace: exec: git-remote-https KYMSU_github https://github.com/Bruno21/kymsu.git
.../...
```
### Démarrer un dépôt Git:
@@ -373,7 +403,85 @@ $ git status
https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git
https://linuxize.com/post/undo-last-git-commit/
https://delicious-insights.com/fr/articles/git-reset/
```bash
git commit -m "2eme commit"
[master e589db5] 2eme commit
1 file changed, 1 insertion(+)
git status
On branch master
nothing to commit, working tree clean
```
**git reset --soft**
`HEAD~1` est une variable qui pointe sur le précédent commit. La branche courrante est reculée d'un commit/
```bash
git status
On branch master
nothing to commit, working tree clean
git reset --soft HEAD~1
git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.pl
```
La copie de travail n'est pas modifiée. On voit que l'étât du fichier est à *'non-commited'*.
**git reset --mixed (ou git reset)**
```bash
git status
On branch master
nothing to commit, working tree clean
git reset --mixed HEAD~1
Unstaged changes after reset:
M hello.pl
git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: hello.pl
no changes added to commit (use "git add" and/or "git commit -a")
```
La copie de travail n'est pas modifiée. On voit que l'étât du fichier est à *'not commited'* mais aussi à *'not staged for commit'*.
**git reset --hard**
```bash
git status
On branch master
nothing to commit, working tree clean
git reset --hard HEAD~1
HEAD is now at 06fb45e 1er commit
git status
On branch master
nothing to commit, working tree clean
```
<u>La copie de travail a été modifiée</u> (les modifs sont perdues).
@@ -435,6 +543,34 @@ GIT_SSL_NO_VERIFY=true git remote add origin ssh://bruno@192.168.1.7:42666/volum
$ git remote set-url origin git@gitea.maboiteverte.fr:bruno/yuzu-child_mbv.git
```
#### Erreur au push (après M-à-J Git lfs)
```bash
$ git push KYMSU_github master
ERROR: Authentication error: Authentication required: You must have push access to verify locks
error: failed to push some refs to 'https://github.com/Bruno21/kymsu.git'
# Correction:
$ git remote -v
KYMSU_github https://Bruno21@github.com/Bruno21/kymsu.git (fetch)
KYMSU_github https://Bruno21@github.com/Bruno21/kymsu.git (push)
dsm916 bruno@dsm916e:/volume1/Repositories/kymsu_dsm.git (fetch)
dsm916 bruno@dsm916e:/volume1/Repositories/kymsu_dsm.git (push)
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (fetch)
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (push)
$ git remote set-url KYMSU_github https://github.com/Bruno21/kymsu.git
$ git remote -v
KYMSU_github https://github.com/Bruno21/kymsu.git (fetch)
KYMSU_github https://github.com/Bruno21/kymsu.git (push)
dsm916 bruno@dsm916e:/volume1/Repositories/kymsu_dsm.git (fetch)
dsm916 bruno@dsm916e:/volume1/Repositories/kymsu_dsm.git (push)
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (fetch)
mbv git@gitea.maboiteverte.fr:shell/kymsu_mbv.git (push)
```
### Etiquettes:
@@ -577,6 +713,21 @@ $ git branch --no-merged # Branches qui contiennent des travaux qui n'ont pas e
#### Suivi des branches
```bash
$ git branch -v
* dyn 6551679 [ahead 3] volume +/-
main e3fc8b6 [ahead 1] soco-cli-gui.sh
$ git branch -vv
* dyn 6551679 [main: ahead 3] volume +/- # branche dyn
main e3fc8b6 [mbv/main: ahead 1] soco-cli-gui.sh # branche main
```
#### Passer d'une branche à l'autre
```bash
@@ -618,6 +769,12 @@ Avec la commande rebase, vous prenez toutes les modifications qui ont été vali
### Pull request:
https://blog.zenika.com/2017/01/24/pull-request-demystifie/
#### => [Session de travail avec git](git-session.md) <=
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=

18
docs/Divers/homebridge.md Normal file
View File

@@ -0,0 +1,18 @@
# Homebridge
[Homebridge](https://github.com/homebridge/homebridge)
[Liste des Plug-ins](https://www.npmjs.com/search?q=homebridge-plugin&ranking=popularity)
[homebridge-alexa](https://www.npmjs.com/package/homebridge-alexa)
[homebridge-sonos](https://www.npmjs.com/package/homebridge-sonos)
[homebridge-plex](https://www.npmjs.com/package/homebridge-plex)
[meross & alexa](https://www.meross.com/faq/43.html#/)

View File

@@ -6,8 +6,12 @@
[git](git/index.md)
Homebridge
[plex](plex.md)
Routeur rt-ac88u
[Vider le cache DNS](Vider_cache_DNS.md)
[wp-cli](wp-cli/index.md)

View File

@@ -92,6 +92,12 @@ The default cipher for encrypting files. Currently AES-128-CFB and AES-256-CFB a
</VirtualHost>
```
; preload
https://hstspreload.org/
The hint "Limitations for Android-User: change to “ssl_ecdh_curve prime256v1;” instead of “ssl_ecdh_curve secp384r1;” " by Carsten Rieger on https://www.c-rieger.de/nextcloud-installation-guide/#c04 fixed the problem.
```bash

View File

@@ -0,0 +1,180 @@
# Asus
### Activer SSH et les scripts JFFS:
1. Aller à **Administration** puis onglet **Système**.
2. Activer **Enable JFFS custom scripts and configs**.
3. Option USB Mode, choisir **USB 2.0**.
4. Activer **Enable SSH sur LAN**.
5. Changer le port SSH (entre 49152 et 65535).
6. Activer **Autoriser la connexion par mot de passe**.
7. Activer **Enable SSH Brute Force Protection**.
8. **Appliquer**.
#### Effacer le cache DNS
```bash
$ ssh bruno@192.168.2.1 -p 26397 -v
$ killall -1 dnsmasq
```
Autre solution: redémarrer le routeur.
#### Ajouter des entrées DNS
Activer la partition JFFS dans les paramètres.
The idea of JFFS is to create a partition stored inside the router's flash storage to put scripts in. If you disable JFFS, it will disable the partition, meaning the firmware will no longer be able to access your config file at boot time to merge it with the main config file.
```bash
$ ssh bruno@192.168.2.1 -p 26397 -v
$ nano /jffs/configs/dnsmasq.conf.add
# ajouter la ligne "address=/clicclac.synology.me/192.168.2.7"
$ service restart_dnsmasq
```
### Dnsmasq:
Configuration:
```bash
$ nano /etc/dnsmasq.conf
```
Vérifier la configuration:
```bash
$ dnsmasq --test
```
Vérifier la résolution DNS:
```bash
$ dig clicclac.synology.me +short
90.62.226.41
```
```bash
dig clicclac.synology.me
; <<>> DiG 9.10.6 <<>> clicclac.synology.me
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4051
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;clicclac.synology.me. IN A
;; ANSWER SECTION:
clicclac.synology.me. 171 IN A 90.62.226.41
;; Query time: 4 msec
;; SERVER: 172.20.10.1#53(172.20.10.1)
;; WHEN: Thu Nov 26 13:20:21 CET 2020
;; MSG SIZE rcvd: 65
```
Bloquer un domain:
Ajouter dans le dnsmasq.conf:
```bash
address=/blocked.example/
address=/another.blocked.example/
```
ou dans un fichier séparé `/etc/dnsmasq.d/blocklist.conf`:
```bash
conf-file=/etc/dnsmasq.d/blocklist.conf
# ou
conf-dir=/etc/dnsmasq.d/,*.conf
```
### amtm
[amtm](https://diversion.ch/amtm.html) est une GUI qui permet d'installer des scripts dans les routeurs Asus fonctionnant sous le firmware [Asuswrt-Merlin](https://www.asuswrt-merlin.net) (depuis la v384.15, amtm est installé d'office) ([forum](https://www.snbforums.com/threads/amtm-the-asuswrt-merlin-terminal-menu.42415/page-124)).
Préparation:
1. Formater une clé USB au format ext.
2. Insérer la clé dans le port USB du routeur.
3. Se connecter au routeur en ssh.
4. Entrer **amtm** ou **/jffs/scripts/amtm** pour ouvrir **amtm**.
5. Avec la commander **fd**, formatter la clé au format **ext4**, avec un **label** (routeur). Le routeur redémarre.
Installer [Diversion](https://diversion.ch/diversion/diversion.html) (AD Blocker)
1. Se connecter au routeur en ssh.
2. Entrer **amtm** ou **/jffs/scripts/amtm** pour ouvrir **amtm**.
3. Taper **i** pour voir les scripts disponibles.
4. Taper **1** pour installer Diversion
```bash
amtm 3.1.8 FW by thelonelycoder
RT-AC88U (armv7l) FW-384.19 @ 192.168.2.1
The Asuswrt-Merlin Terminal Menu
1 open Diversion v4.1.12
2 install Skynet - the Router Firewall
3 install FlexQoS - Flexible QoS Enhancement
3d install FreshJR QOS - Adaptive QOS (deprecated)
```
Modules installés:
- Skynet (nécessite un fichier swap de 2 Go):
- LED Control: éteint les LED de 21h30 à 7h
#### AsusWRT-Merlin
[Forum](https://www.snbforums.com/forums/asuswrt-merlin.42/)
[Custom config files](https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-config-files)
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-config-files
https://www.drazzib.com/docs/admin/dnsmasq.html
https://wiki.archlinux.org/index.php/Dnsmasq
Asus-wrt vs Asus-Merlin:
https://www.snbforums.com/threads/dnsmasq-conf-add-without-custom-firmware.43244/
https://www.snbforums.com/threads/how-to-use-dnsmasq-conf-add.8785/

View File

@@ -158,4 +158,84 @@ Occurence suivante:
CTRL + W puis Retour
CTRL + C pour sortir du mode recherche
CTRL + C pour sortir du mode recherche
#### Créer un backup du fichier que l'on édite (-B, ):
```bash
$ nano -B wordpress4.sql
-rw-r--r-- 1 bruno staff 600655 Dec 1 08:54 wordpress4.sql
-rw-r--r-- 1 bruno staff 600648 Dec 31 2017 wordpress4.sql~
```
#### No wrap (-w, --nowrap):
```bash
$ nano -w wordpress4.sql
```
#### Configuration:
Colorisation de la syntaxe: les fichiers de configurations sont là: `~/.nanosyntax` (homebrew) et `/usr/local/share/nano/` (macOS).
Ajouter un fichier de configuration:
```bash
$ nano ~/.nanosyntax/yaml.nanorc
```
et y copier:
```nanorc
# Supports `YAML` files
syntax "YAML" "\.ya?ml$"
header "^(---|===)" "%YAML"
## Keys
color magenta "^\s*[\$A-Za-z0-9_-]+\:"
color brightmagenta "^\s*@[\$A-Za-z0-9_-]+\:"
## Values
color white ":\s.+$"
## Booleans
icolor brightcyan " (y|yes|n|no|true|false|on|off)$"
## Numbers
color brightred " [[:digit:]]+(\.[[:digit:]]+)?"
## Arrays
color red "\[" "\]" ":\s+[|>]" "^\s*- "
## Reserved
color green "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
## Comments
color brightwhite "#.*$"
## Errors
color ,red ":\w.+$"
color ,red ":'.+$"
color ,red ":".+$"
color ,red "\s+$"
## Non closed quote
color ,red "['\"][^['\"]]*$"
## Closed quotes
color yellow "['\"].*['\"]"
## Equal sign
color brightgreen ":( |$)"
```
Ajouter ce fichier au fichier de configuration `.nanorc`
```
## yml
include "~/.nanosyntax/yml.nanorc"
```

83
docs/Linux/bat.md Normal file
View File

@@ -0,0 +1,83 @@
# bat
Remplaçant de cat
https://github.com/sharkdp/bat
Installation:
```bash
$ brew install bat
$ brew install fzf
```
Créer le fichier de configuration:
```bash
$ bat --generate-config-file
```
Editer la configuration:
```bash
$ nano /Users/bruno/.config/bat/config
```
Prévisualiser les thèmes:
```bash
$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"
```
Tail et bat:
```bash
$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
STDIN
1 [Fri Nov 27 16:15:38.788043 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
2 [Fri Nov 27 16:22:54.224576 2020] [mpm_prefork:notice] [pid 10014] AH00173: SIGHUP received. Attempting to restart
3 [Fri Nov 27 16:22:54.278764 2020] [mpm_prefork:notice] [pid 10014] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1h PHP/8.0.0 configured -- resuming normal operations
4 [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
```
Find et bat:
```bash
$ find /usr -name error_log -exec bat {} +
-rw-r--r-- 1 root wheel 0 Oct 18 2019 rmtab
File: /usr/local/var/log/httpd/error_log
1 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using SilverBook.local. Set the 'ServerName' directive globally to suppress this message
2 [Tue Aug 06 11:06:14.901395 2019] [mpm_prefork:notice] [pid 51047] AH00163: Apache/2.4.39 (Unix) configured -- resuming normal operations
3 [Tue Aug 06 11:06:14.904904 2019] [core:notice] [pid 51047] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
```
Man pages:
```bash
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
man 2 select
```
## bat-extras
https://github.com/eth-p/bat-extras/blob/master/README.md#installation
```bash
$ brew install eth-p/software/bat-extras
```
[batman](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)
[batgrep](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)
[batwatch](https://github.com/eth-p/bat-extras/blob/master/doc/batwatch.md)
[batdiff](https://github.com/eth-p/bat-extras/blob/master/doc/batdiff.md)

118
docs/Linux/compare.md Normal file
View File

@@ -0,0 +1,118 @@
# Comparer 2 fichiers:
### diff:
Voir les différences:
```bash
$ diff php73.ini php74.ini
11a12
> upload_max_filesize = 32M
16c17
< extension_dir = /usr/local/lib/php73/modules
---
> extension_dir = /usr/local/lib/php74/modules
38c39
< upload_max_filesize = 32M
---
```
Comparaison côte à côte:
```bash
$ diff -y php73.ini php74.ini
[core] [core]
sendmail_path = /usr/bin/ssmtp -t sendmail_path = /usr/bin/ssmtp -t
ignore_repeated_source = 0 ignore_repeated_source = 0
xmlrpc_error_number = 0 xmlrpc_error_number = 0
memory_limit = 128M memory_limit = 128M
output_buffering = 4096 output_buffering = 4096
auto_globals_jit = 1 auto_globals_jit = 1
include_path = .:/usr/share/pear include_path = .:/usr/share/pear
log_errors = On log_errors = On
allow_url_fopen = 1 allow_url_fopen = 1
enable_dl = Off enable_dl = Off
> upload_max_filesize = 32M
enable_post_data_reading = 1 enable_post_data_reading = 1
ignore_user_abort = 0 ignore_user_abort = 0
display_startup_errors = 0 display_startup_errors = 0
sys_temp_dir = /var/services/tmp sys_temp_dir = /var/services/tmp
extension_dir = /usr/local/lib/php73/modules | extension_dir = /usr/local/lib/php74/modules
```
Comparaison côte à côte (largeur limitée à 70 colonnes):
```bash
$ diff -y -W 70 php73.ini php74.ini
[core] [core]
sendmail_path = /usr/bin/ssmtp sendmail_path = /usr/bin/ssmtp
ignore_repeated_source = 0 ignore_repeated_source = 0
xmlrpc_error_number = 0 xmlrpc_error_number = 0
memory_limit = 128M memory_limit = 128M
output_buffering = 4096 output_buffering = 4096
auto_globals_jit = 1 auto_globals_jit = 1
include_path = .:/usr/share/pe include_path = .:/usr/share/pe
log_errors = On log_errors = On
allow_url_fopen = 1 allow_url_fopen = 1
enable_dl = Off enable_dl = Off
> upload_max_filesize = 32M
enable_post_data_reading = 1 enable_post_data_reading = 1
```
Juste savoir si les 2 fichiers diffèrent:
```bash
$ diff -q php73.ini php74.ini
Files php73.ini and php74.ini differ
```
On peut supprimer les lignes identiques (`--suppress-common-lines`):
```bash
$ diff -y -W 70 --suppress-common-lines php73.ini php74.ini
> upload_max_filesize = 32M
extension_dir = /usr/local/lib | extension_dir = /usr/local/lib
upload_max_filesize = 32M | unserialize_max_depth = 4096
> zend.exception_ignore_args = 0
> [gd]
> gd.jpeg_ignore_warning = 1
>
[gd] | [session]
gd.jpeg_ignore_warning = 1 | session.cookie_samesite =
```
Colordiff peut comparer 2 dossiers:
```bash
$ diff -rq photonix photoprism
Only in photonix: .DS_Store
Only in photonix: data
Files photonix/docker-compose.yml and photoprism/docker-compose.yml differ
```
### colordiff:
### diffmerge (GUI):
```bash
diffmerge config.json config.json.bak
```

View File

@@ -32,6 +32,12 @@ fi
if [ "$choice" == "72" ]; then echo "sphp 72"; elif [ "$choice" == "73" ]; then echo "sphp 73"; fi
```
### Ternaire
```bash
[ "$nb" -gt 1 ] && echo -e "condition ok" || echo -e "condition nok"
```
### if imbriqué
@@ -86,6 +92,22 @@ fi
#### -fichier
Si le répertoire *<u>directory</u>* existe
```bash
if [ -d directory ]; then
if [ -d ~/.kde ]; then
```
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
```bash
if [ -f regularfile ]; then
if [ -f ~/.bashrc ]; then
```
Si le fichier *<u>existingfile</u>* existe
```bash
@@ -112,22 +134,6 @@ if [ -c characterspecialfile ]; then
if [ -c /dev/dsp ]; then
```
Si le répertoire *<u>directory</u>* existe
```bash
if [ -d directory ]; then
if [ -d ~/.kde ]; then
```
Si le fichier *<u>regularfile</u> (ni un blockspecialfile, ni un characterspecialfile, ni un directory)* existe
```bash
if [ -f regularfile ]; then
if [ -f ~/.bashrc ]; then
```
Si le fichier *<u>sgidfile</u> (set-group-ID)* existe
```bash
@@ -445,3 +451,24 @@ Si NUM 1 est <u>inférieur ou égal à</u> (( NUM1 <= NUM2 ))
if (( NUM1 <= NUM2 )); then
```
#### -test si la variable est un entier/decimal/chaine:
```bash
#!/bin/bash
read -p "Type a number or a string: " input
if [[ $input =~ ^[+-]?[0-9]+$ ]]; then
echo "Input is an integer."
elif [[ $input =~ ^[+-]?[0-9]+\.$ ]]; then
echo "Input is a string."
elif [[ $input =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then
echo "Input is a float."
else
echo "Input is a string."
fi
```

50
docs/Linux/cron.md Normal file
View File

@@ -0,0 +1,50 @@
# cron
```bash
* * * * * command(s)
^ ^ ^ ^ ^
| | | | | allowed values
| | | | | -------
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
```
| | | |
| -------- | -------------------- | ----------------------------------------------- |
| @yearly | 0 0 1 1 * | Tous les 1er janvier à midi |
| @monthly | 0 0 1 * * | Tous les 1er du mois à minuit |
| @weekly | 0 0 * * 0 | Tous les dimanches à minuit |
| @daily | 0 0 * * * | Tous les jours à minuit |
| @hourly | 0 * * * * | Toutes les heures |
| @reboot | | Au démarrage de l'ordinateur |
| | 0 15 * * 1-5 command | Tous les jours à 15h du lundi au vendredi |
| | 00 08-16 * * * | Toutes les jours, toutes les heures de 8h à 16h |
| | 0 7 1-7 * 1 | Le 1er lundi de chaque mois à 7h |
| | 15 9 1,15 * * | Le 1er et le 15 du mois à 9h15 |
| | */15 * * * * | Toutes les 15 mn |
#### La commande crontab:
- `crontab -e`: édite ou crée le fichier crontab.
- `crontab -l`: affiche le fichier crontab.
- `crontab -r`: supprime le fichier crontab (directement).
- `crontab -i`: supprime le fichier crontab (prompt).
- `crontab -u <user> `: édite le fichier crontab d'un autre utilisateur.
Le fichier crontab s'ouvre dans l'éditeur spécifié par la variable d'environnement EDITOR (ou VISUAL).
https://linuxize.com/post/scheduling-cron-jobs-with-crontab/

125
docs/Linux/fd.md Normal file
View File

@@ -0,0 +1,125 @@
# fd
(alternative à [find](find.md)) (macOS / Linux / Windows)
```bash
$ brew install fd
```
```
choco install fd
```
Recherche un fichier dans le répertoire courant (et sous-dossiers):
```bash
~ master* ⇡
fd -H .zshrc
.zshrc
~/.config master* ⇡
fd -HI pip.conf
pip/pip.conf
```
Recherche dans un répertoire particulier:
```bash
~ master* ⇡
fd -HI 'id_*' .ssh
.ssh/id_ed25519
.ssh/id_ed25519.pub
.ssh/id_rsa
.ssh/id_rsa.pub
.ssh/id_rsa.zip
```
Recherche par regex:
```bash
~ master* ⇡ 4m 27s
fd -HI '^h.*.conf$' /etc
/etc/apache2/extra/httpd-autoindex.conf
/etc/apache2/extra/httpd-dav.conf
/etc/apache2/extra/httpd-default.conf
/etc/apache2/extra/httpd-info.conf
/etc/apache2/extra/httpd-languages.conf
/etc/apache2/extra/httpd-manual.conf
/etc/apache2/extra/httpd-mpm.conf
/etc/apache2/extra/httpd-multilang-errordoc.conf
/etc/apache2/extra/httpd-ssl.conf
/etc/apache2/extra/httpd-userdir.conf
/etc/apache2/extra/httpd-vhosts.conf
/etc/apache2/httpd.conf
...
```
https://docs.rs/regex/1.0.0/regex/#syntax
Fichiers se terminant par *'[0-9].jpg'*:
```bash
$ fd -HI '.*[0-9]\.jpg$' ~
$ find ~ -iname '*[0-9].jpg'
```
Sans arguments:
Option:
- --hidden: cherche dans les dossiers cachés
- --no-ignore:
- -x / --exec:
```bash
$ fd -h
fd 8.1.1
USAGE:
fd [FLAGS/OPTIONS] [<pattern>] [<path>...]
FLAGS:
-H, --hidden Search hidden files and directories
-I, --no-ignore Do not respect .(git|fd)ignore files
-s, --case-sensitive Case-sensitive search (default: smart case)
-i, --ignore-case Case-insensitive search (default: smart case)
-g, --glob Glob-based search (default: regular expression)
-a, --absolute-path Show absolute instead of relative paths
-l, --list-details Use a long listing format with file metadata
-L, --follow Follow symbolic links
-p, --full-path Search full path (default: file-/dirname only)
-0, --print0 Separate results by the null character
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-d, --max-depth <depth> Set maximum search depth (default: none)
-t, --type <filetype>... Filter by type: file (f), directory (d), symlink (l),
executable (x), empty (e), socket (s), pipe (p)
-e, --extension <ext>... Filter by file extension
-x, --exec <cmd> Execute a command for each search result
-X, --exec-batch <cmd> Execute a command with all search results at once
-E, --exclude <pattern>... Exclude entries that match the given glob pattern
-c, --color <when> When to use colors: never, *auto*, always
-S, --size <size>... Limit results based on the size of files.
--changed-within <date|dur> Filter by file modification time (newer than)
--changed-before <date|dur> Filter by file modification time (older than)
-o, --owner <user:group> Filter by owning user and/or group
ARGS:
<pattern> the search pattern - a regular expression unless '--glob' is used (optional)
<path>... the root directory for the filesystem search (optional)
Note: `fd -h` prints a short and concise overview while `fd --help` gives all details.
```

View File

@@ -1,5 +1,7 @@
# find
(Voir aussi [fd](fd.md))
La commande **find** permet de retrouver des fichiers à partir de certains critères. Elle doit être utilisé avec l'option **-print**
@@ -21,16 +23,64 @@ Les <u>critères de recherche</u> sont les suivants :
#### Nom:
Recherche par <u>nom de fichier</u>:
```bash
find /usr -name toto -print
$ find /usr -name toto -print
find /usr -name " *.c " -print
$ find /usr -name " *.c " -print
# commence par un a ou A, suivi de quelque chose, et se termine par un chiffre compris entre 3 et 6
find . -name '[aA]*[3-6]' -print
$ find . -name '[aA]*[3-6]' -print
```
#### Taille:
Recherche suivant la <u>taille</u>:
```bash
# fichiers dont la taille dépasse 30ko
$ find / -size +30k -print
# fichiers dont la taille est comprise entre 30 et 100ko
$ find / -size +30k -size -100k
```
#### Opérateurs logiques:
Recherche en utilisant les <u>opérateurs logiques</u>:
```bash
# les fichiers n'appartenant pas à l'utilisateur olivierles fichiers n'appartenant pas à l'utilisateur olivier
$ find . ! -user olivier -print
# Recherche les fichiers dont le nom est a.out ou les fichiers se terminant par *.c (une condition OU l'autre).
$ find . \ ( -name a.out -o -name " *.c " \ ) -print
# Recherche des fichiers dont le nom est core et d'une taille supérieure à 1Mo (une condition ET l'autre).
$ find . \ (-name core -a size +2000 \ ) -print
```
#### Date:
Rechercher <u>le plus vieux</u> fichier:
```bash
$ find / -type f -printf '%T+ %p\n' | sort | head -n 1
```
Recherche suivant la <u>date de dernière modification</u>:
@@ -38,53 +88,69 @@ Recherche suivant la <u>date de dernière modification</u>:
```bash
# modifiés il y a 30 jours
find / -mtime 30 -print
$ find / -mtime 30 -print
# modifiés il y a 30 jours ou plus
find / -mtime +30 -print
$ find / -mtime +30 -print
# modifiés il y a 30 jours ou moins
find / -mtime 30 -print
$ find / -mtime 30 -print
# modifiés il y a plus de 50 jours et moins de 100
$ find / -mtime +50 mtime -100
# modifiés dans la dernière heure
$ find / -mmin -60
# accédées dans la dernière heure
$ find / -amin -60
```
```bash
find . -mtime +0 # find files modified greater than 24 hours ago
find . -mtime 0 # find files modified between now and 1 day ago (i.e., in the past 24 hours only)
find . -mtime -1 # find files modified less than 1 day ago (SAME AS -mtime 0)
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
$ find . -mtime +0 # find files modified greater than 24 hours ago
$ find . -mtime 0 # find files modified between now and 1 day ago (i.e., in the past 24 hours only)
$ find . -mtime -1 # find files modified less than 1 day ago (SAME AS -mtime 0)
$ find . -mtime 1 # find files modified between 24 and 48 hours ago
$ find . -mtime +1 # find files modified more than 48 hours ago
```
Rechercher <u>le plus vieux</u> fichier:
#### Permissions:
Rechercher des <u>permissions</u>:
```bash
find / -type f -printf '%T+ %p\n' | sort | head -n 1
$ find /volume1/@appstore/PHP7.4/etc -perm 644
/volume1/@appstore/PHP7.4/etc/php/conf.d/memcached.ini
/volume1/@appstore/PHP7.4/etc/php/conf.d/redis.ini
$ ls -la
-rw-r--r-- 1 root root 25 Sep 14 13:39 memcached.ini
-rw-r--r-- 1 root root 21 Sep 14 13:39 redis.ini
```
Recherche suivant la <u>taille</u>:
<u>Inverser</u> la recherche (!):
```bash
# fichiers dont la taille dépasse 30ko
find / -size +30k -print
$ find /volume1/@appstore/PHP7.4/etc ! -perm 644
/volume1/@appstore/PHP7.4/etc
/volume1/@appstore/PHP7.4/etc/php
/volume1/@appstore/PHP7.4/etc/php/conf.d
```
Recherche en utilisant les <u>opérateurs logiques</u>:
Rechercher les fichiers avec permission 777 et les modifiés en 644:
```bash
# les fichiers n'appartenant pas à l'utilisateur olivierles fichiers n'appartenant pas à l'utilisateur olivier
$ find / -type f -perm 0777 -print -exec chmod 644 {} \;
find . ! -user olivier -print
# Recherche les fichiers dont le nom est a.out ou les fichiers se terminant par *.c (une condition OU l'autre).
find . \ ( -name a.out -o -name " *.c " \ ) -print
# Recherche des fichiers dont le nom est core et d'une taille supérieure à 1Mo (une condition ET l'autre).
find . \ (-name core -a size +2000 \ ) -print
# idem pour les dossiers
$ find / -type d -perm 777 -print -exec chmod 755 {} \;
```
Recherche <u>combinée</u>:
@@ -92,53 +158,208 @@ Recherche <u>combinée</u>:
```bash
# les fichiers de l'utilisateur bruno dont les permissions sont 755
find / -type f -user bruno -perm 755 -print
$ find / -type f -user bruno -perm 755 -print
```
Rechercher les exécutables:
```bash
$ find /var/services/homes/bruno -perm /a=x
```
Rechercher les fichiers en lecture seule:
```bash
$ find /var/services/homes/bruno -perm /u=r
```
#### Regex:
Recherche avec <u>regex</u>:
```bash
# les images avec extentions jpg|gif|png|jpeg dans le dossier Users
# -E => macOS only ??
find -E /Users/bruno -regex ".*\.(jpg|gif|png|jpeg)"
$ find -E /Users/bruno -regex ".*\.(jpg|gif|png|jpeg)"
$ find -E $HOME/Music -regex ".*\.(mp3|flac)"
# non case-sensitive
find -E /Users/bruno -iregex ".*\.(jpg|gif|png|jpeg)"
$ find -E /Users/bruno -iregex ".*\.(jpg|gif|png|jpeg)"
# Linux / GNU find (macOS)
$ find $HOME/Music -regex ".*\.\(mp3\|flac\)"
$ gfind $HOME/Music -regex ".*\.\(mp3\|flac\)"
```
Commandes en option:
#### User / group:
```bash
$ find /home -user bruno
$ find /home -group http
```
#### Commandes en option:
```bash
# Recherche les fichiers toto et les efface.
find . -name toto -exec rm {}\ ;
$ find . -name toto -exec rm {}\ ;
# Pour avoir une demande de confirmation avant l'exécution de rm
find . -name toto -ok rm {}\ ;
$ find . -name toto -ok rm {}\ ;
```
Utilisation avec d'autres commandes:'
#### Utilisation avec d'autres commandes:'
```bash
# Recherche les fichiers normaux dans le répertoire courant, puis chercher le chaine toto dans ces fichiers.
find . -type f -print | xargs grep toto
$ find . -type f -print | xargs grep toto
# Recherche les fichiers toto et les efface après confimation (-p).
# idem -exec, " | xargs " ne crée qu'un seim processus.
find . -name toto | xargs -p rm
$ find . -name toto | xargs -p rm
```
Redirection des messages d'erreur:
#### Effacer tous les fichiers d'un dossier sauf un:
```bash
find / -name toto -print 2>/dev/null
$ find . -type f ! -name 'fichier-a-garder.tar.gz' -delete
```
#### Présentation de la sortie:
l'option -ls correspond à un 'ls -dils'
```bash
$ find /var/services/homes/bruno -name "*php*.ini" -ls
56408 72 -rwxrwxrwx 1 bruno users 72040 Nov 10 2017 /var/services/homes/bruno/Drive/Drive/Apache\ -\ PHP/Backup\ Silverbook/php.ini
364193 8 -rw-r--r-- 1 root root 8169 Nov 13 10:53 /var/services/homes/bruno/php74.ini
364195 8 -rw-r--r-- 1 root root 8145 Nov 13 10:55 /var/services/homes/bruno/php73.ini
```
#### printf
affiche le *format* indiqué sur la sortie standard
```bash
# taille en octet - nom
$ find /var/services/homes/bruno -name "*php*.ini" -printf '%s %p\n'
72040 /var/services/homes/bruno/Drive/Drive/Apache - PHP/Backup Silverbook/php.ini
8169 /var/services/homes/bruno/php74.ini
8145 /var/services/homes/bruno/php73.ini
# date - bits - user:group - taille en octet - nom
$ find /var/services/homes/bruno -name "*php*.ini" -printf "%t %M %u:%g %s %p\n"
Fri Nov 10 09:10:42.0000000000 2017 -rwxrwxrwx bruno:users 72040 9 /var/services/homes/bruno/Drive/Drive/Apache - PHP/Backup Silverbook/php.ini
Fri Nov 13 10:53:58.5922529060 2020 -rw-r--r-- root:root 8169 10 /var/services/homes/bruno/php74.ini
Fri Nov 13 10:55:50.7925348300 2020 -rw-r--r-- root:root 8145 10 /var/services/homes/bruno/php73.ini
```
| | |
| ---- | ------------------------------------------------------------ |
| %u | Nom du propriétaire du fichier |
| %g | Nom du groupe propriétaire du fichier |
| %s | Taille du fichier en octets |
| %k | Taille du fichier en ko |
| %p | Nom du fichier |
| | |
| %t | Date de dernière modification du fichier |
| %Tk | Date de dernière modification du fichier |
| %m | Bits d'autorisation d'accès au fichier (en octal)(644/755) |
| %M | Bits d'autorisation d'accès au fichier (symbole)(-rw-r--r--) |
#### fprintf *fichier* format
écrit le nom complet dans le *fichier*. Si *fichier* n'existe pas au démarrage de **find**, il est créé. S'il existe, il est écrasé.
#### Redirection des messages d'erreur:
```bash
$ find /volume1/@appstore/ -name "*php*.ini"
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
find: /volume1/@appstore/DNSServer/named/etc/key: Permission denied
find: /volume1/@appstore/DNSServer/named/usr/lib/ocf/lib: Permission denied
find: /volume1/@appstore/DNSServer/named/usr/lib/ocf/resource.d: Permission denied
find: /volume1/@appstore/DNSServer/named/usr/lib/heartbeat/plugins: Permission denied
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
/volume1/@appstore/PHP7.2/usr/local/etc/php72/cli/php.ini
find: /volume1/@appstore/Gitea/gitea/data: Permission denied
find: /volume1/@appstore/Gitea/gitea/.ssh: Permission denied
/volume1/@appstore/PHP7.3/misc/php-fpm.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/php.ini
/volume1/@appstore/WebStation/misc/php56.ini
/volume1/@appstore/WebStation/misc/php70.ini
/volume1/@appstore/phpMyAdmin/php_conf/phpMyAdmin.ini
/volume1/@appstore/PHP7.4/misc/php-fpm.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini
```
Tous les messages d'erreurs sont redirigés avec `2>/dev/null` vers la poubelle.
```bash
$ find /volume1/@appstore/ -name "*php*.ini" 2>/dev/null
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
/volume1/@appstore/PHP7.2/usr/local/etc/php72/cli/php.ini
/volume1/@appstore/PHP7.3/misc/php-fpm.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/php.ini
/volume1/@appstore/WebStation/misc/php56.ini
/volume1/@appstore/WebStation/misc/php70.ini
/volume1/@appstore/phpMyAdmin/php_conf/phpMyAdmin.ini
/volume1/@appstore/PHP7.4/misc/php-fpm.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini
```
C'est un peu plus propre.
Autre solution avec `grep -v "Permission denied"`, les autres messages d'erreurs restent affichés.
```bash
$ find / -name "*php*.ini" 2>&1 | grep -v "Permission denied"
/etc/php/php.ini
/volume1/@appstore/PHP7.0/usr/local/etc/php70/php.ini
/volume1/@appstore/PHP7.2/misc/php-fpm.ini
/volume1/@appstore/PHP7.2/usr/local/etc/php72/cli/php.ini
/volume1/@appstore/PHP7.3/misc/php-fpm.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/php.ini
/volume1/@appstore/WebStation/misc/php56.ini
/volume1/@appstore/WebStation/misc/php70.ini
/volume1/@appstore/phpMyAdmin/php_conf/phpMyAdmin.ini
/volume1/@appstore/PHP7.4/misc/php-fpm.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini
...
/volume1/@Entware/opt/etc/php.ini
/volume1/docker/piwigo/config/php/php-local.ini
/etc.defaults/php/php.ini
/opt/etc/php.ini
/usr/syno/etc/packages/WebStation/php70/php.ini
/usr/syno/etc/packages/WebStation/php56/php.ini
/usr/local/etc/php70/php.ini
/usr/local/etc/php73/cli/php.ini
/usr/local/etc/php74/cli/php.ini
/usr/local/etc/php72/cli/php.ini
/usr/local/etc/php72/cli/conf.d/phpMyAdmin.ini
find: /proc/24000/net: Invalid argument
```

View File

@@ -314,7 +314,7 @@ raspbian
#### Suprression de caractères:
#### Supression de caractères:
Commande:

View File

@@ -28,7 +28,7 @@
### Recharger la configuration:
#### Recharger la configuration:
```bash
$ source ~/.profile
@@ -38,4 +38,101 @@ ou
$ . ~/.profile
```
On peut aussi créer un alias: `alias rload=". ~/.profile"`
On peut aussi créer un alias: `alias rload=". ~/.profile"`
#### Historique:
```bash
history
4235* cd perl
4237* git reset
4238* git reset --hard
4239* kymsu2
4242* rm -rf .git
4244* git init
4246* cd
4247* cd Pictures/thumbsup
4248* nano config.json
4249* cd ..
4250* cd thumbsup
4252* 916e
4255 rm .DS_Store
4257 l
4258 nano LICENSE
4259 nano README.md
```
Exécuter une précédente commande (!):
```bash
!4231
916e
bruno@DS916:~ $
```
Executer la commande précédente (!!):
```bash
nano README.md
!!
nano README.md
```
Les 5 dernières commandes:
```
history -5
4253 pwd
4254 hostname
4255 history
4256 nano config.json
4257 history 5
```
Exécuter la dernière commande 'nano':
```bash
!nano
nano config.json
```
Voir la dernière commande 'nano (:p)':
```bash
!nano:p
nano config.json
```
#### "Reverse i" search:
Taper **Ctrl+R** puis 'ssh':
```bash
ssh dsm414
bck-i-search: ssh_
```
Taper à nouveau **Ctrl+R**:
```bash
git clone https://git.php.net/repository/pecl/networking/ssh2.git
bck-i-search: ssh_
```
Quand la bonne commande est trouvée, taper **Enter**. Sinon, taper Ctrl+G pour sortir.
<u>Commentaires interactifs:</u> ajouter #comment pour retrouver plus facilement une commande.
Pour zsh, activer cette fonction avec *setopt interactivecomments*.
```
setopt interactivecomments
ping 192.168.1.8 #nas
PING 192.168.1.8 (192.168.1.8): 56 data bytes
ping 192.168.1.8 #nas
bck-i-search: nas_
```

53
docs/MySQL/password.md Normal file
View File

@@ -0,0 +1,53 @@
# MySQL Password
### Rentrer automatiquement le mot de passe MySQL:
Stocker le mot de passe dans le `~/.my.cnf`.
```mysql
[client]
user=mysqlbackupuser
password=xxxxxxxx
```
```bash
$ mysql -e "SHOW DATABASES"
+--------------------+
| Database |
+--------------------+
| information_schema |
| mistral |
| mysql |
| npg |
| performance_schema |
| wordpress |
| zenphoto |
+--------------------+
```
### Avoir 1 mot de passe par base ou par host:
Dans le `~/.my.cnf`.
```mysql
[clienthost1] # Note: client + host1
user=myuser
password=mypass
database=dbname
host=server.location.com
```
```bash
$ mysql --defaults-group-suffix=host1
```
Bonus: créer un alias dans `.profile` (.zshrc...):
```bash
echo 'alias mysql_host1="mysql --defaults-group-suffix=host1"' >> ~/.profile
```

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>/Raspberry/headless.md</string>
<string>/Raspberry/backup.md</string>
<string>/macos/TouchID.md</string>
<string>/macos/ruby.md</string>
<string>/macos/Mail.md</string>
<string>/macos/logs.md</string>
<string>/macos/perl/installer.md</string>
<string>/macos/perl/perl.md</string>
<string>/index.md</string>
</array>
</plist>

View File

@@ -0,0 +1,22 @@
# Ports
| | | |
| ------------------------------------------------------------ | --------------------------- | ------ |
| mymediaforalexa | 52050 - 52051 | Docker |
| homebridge | Bridge: 51534<br />UI: 8581 | Docker |
| Hoobs | Bridge: 51826<br />UI: 8181 | Docker |
| [PiHole](https://mariushosting.com/how-to-install-pi-hole-on-your-synology-nas/) | 8090 | Docker |
| Lychee | 90 | |
| | | |
| | | |
| | | |
| | | |
https://mariushosting.com/synology-how-to-update-docker-image/

View File

@@ -187,9 +187,9 @@ drwxr-xr-x 17 root root 4096 Mar 9 01:15 ..
#### Redémarrer Apache:
`synoservice --restart pkgctl-WebStation`
`sudo synoservice --restart pkgctl-WebStation`
`synoservice --restart pkgctl-Apache2.2`
`sudo synoservice --restart pkgctl-Apache2.2`
service [pkgctl-Apache2.2] restart failed, synoerr=[0x2000]
@@ -425,6 +425,24 @@ Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
```bash
$ find /volume1/@appstore/PHP7.3 -name *.ini
/volume1/@appstore/PHP7.3/etc/php/conf.d/memcached.ini
/volume1/@appstore/PHP7.3/etc/php/conf.d/redis.ini
/volume1/@appstore/PHP7.3/misc/php-fpm.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/php.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/conf.d/extension.ini
$ find /volume1/@appstore/PHP7.4 -name *.ini
/volume1/@appstore/PHP7.4/etc/php/conf.d/memcached.ini
/volume1/@appstore/PHP7.4/etc/php/conf.d/redis.ini
/volume1/@appstore/PHP7.4/misc/php-fpm.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/conf.d/extension.ini
```
### Composer:
<u>Installation:</u>
@@ -485,6 +503,16 @@ You are already using composer version 1.7.1 (stable channel).
### Node.js
Utiliser `--unsafe-perm`
```bash
sudo npm install -g thumbsup --unsafe-perm
```
### Erreurs:
/bin/nano
@@ -501,3 +529,9 @@ sudo ln -s /lib/libncurses.so.5.9 /lib/libtinfo.so.5
https://help.synology.com/developer-guide/index.html
#### iTunes Server:
[MàJ pour Apple Music](https://supfiles.synology.com/fsdownload/cgMMujWfd/iTunes%20Server%201.5.3-2504%20Patch)

View File

@@ -273,3 +273,13 @@ Exécuter kymsu2.sh à distance:
bruno@silverbook:~$ ssh dsm916 ./kymsu/kymsu2.sh
```
#### Compiler dcraw.
Télécharger les [sources](https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/24922branch/evansport-source/), puis:
```bash
$ gcc -o dcraw -O4 dcraw.c -lm -DNO_JPEG -DNODEP
```

14
docs/Synology/php.md Normal file
View File

@@ -0,0 +1,14 @@
# PHP
Synology fournit plusieurs paquets PHP:
- PHP 5.6
- PHP 7.0 (necéssaire pour Photo Station)
- PHP 7.2
- PHP 7.3
- PHP 7.4

View File

@@ -64,6 +64,43 @@ $ pip3 install --user --upgrade setuptools
### Erreur à la création d'un environnement virtuel:
```bash
bruno@DS916:~/venv $ python -m venv lychee
Error: Command '['/volume1/homes/bruno/venv/lychee/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
```
Il faut le créer avec l'option `--without-pip`.
```bash
bruno@DS916:~/venv $ python3 -m venv --without-pip letchee
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ curl https://bootstrap.pypa.io/get-pip.py | python3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1842k 100 1842k 0 0 4757k 0 --:--:-- --:--:-- --:--:-- 4773k
Collecting pip
Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 3.1 MB/s
Collecting setuptools
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 15.3 MB/s
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.2.4 setuptools-50.3.2 wheel-0.35.1
(letchee) bruno@DS916:~/venv $ deactivate
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ l
```
```bash

129
docs/Synology/services.md Normal file
View File

@@ -0,0 +1,129 @@
# DSM Services
#### Commandes:
```bash
synoservicecfg --list
synoservice --status
synoservicecfg --stop <service>
synoservicecfg --hard-stop <service>
synoservicecfg --start <service>
synoservicecfg --hard-start <service>
synoservice --restart <service>
synoservicectl --restart <service>
```
#### Services:
```bash
DSM
apparmor
atalk
avahi
bluetoothd
bonjour
btacd
crond
cups-lpd
cupsd
dbus
dc-output
ddns
findhost
ftpd
ftpd-ssl
gcpd
heartbeat
hotplugd
iscsitrg
ldap-server
miniupnpd-handler
natpmpd
nfsd
nginx
nmbd
nslcd
ntpd-client
ntpd-server
pgsql
pkgctl-Apache2.4
pkgctl-AudioStation
pkgctl-CMS
pkgctl-CloudSync
pkgctl-DNSServer
pkgctl-Docker
pkgctl-DownloadStation
pkgctl-FileStation
pkgctl-Git
pkgctl-HyperBackup
pkgctl-Java8
pkgctl-LogCenter
pkgctl-MariaDB
pkgctl-MariaDB10
pkgctl-Node.js_v4
pkgctl-PEAR
pkgctl-PHP5.6
pkgctl-PHP7.0
pkgctl-Plex Media Server
pkgctl-StorageAnalyzer
pkgctl-TextEditor
pkgctl-VPNCenter
pkgctl-WebStation
pkgctl-adminer
pkgctl-domoticz
pkgctl-filebot
pkgctl-filebot-node
pkgctl-git
pkgctl-python
pkgctl-sickrage
pppoerelay
rsyncd
s2s_daemon
samba
scemd
sftp
snmp
ssdp
ssh-shell
support-remote-access
synoagentregisterd
synobackupd
synocacheclient
synocachepinfiletool
synocgid
synoconfd
synocontentextractd
synocrond
synogpoclient
synoindexd
synologrotate
synomkflvd
synomkthumbd
synomount
synoovs-db
synoovs-vswitch
synoperfeventd
synorelayd
synosnmpcd
synostoraged
synotifyd
synotunnel
synovpnclient
synowifid
syslog-acc
syslog-ng
syslog-notify
system
telnetd
tftp
upnpd
ups-net
ups-usb
usbipd
winbindd
```

View File

@@ -54,6 +54,8 @@ Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y
# Forcer la réinstallation: -f --force
```
#### [:octicons-link:](https://chocolatey.org/docs/commands-uninstall) Désinstaller un paquet `choco uninstall` (`cuninst`):

18
docs/Windows/firewall.md Normal file
View File

@@ -0,0 +1,18 @@
# Empêcher un programme d'accéder à internet
Créer une règle dans le Firewall Windows:
1. Presser les touches **Windows + R** pour ouvrir le dialogue Run.
2. Entrer **wf.msc** puis Enter pour ouvrir la fenêtre **Windows Firewall with Advanced Security.**
3. Cliquer sur **Outbound Rules** (à gauche de la fenêtre).
4. Cliquer sur **New Rule** (à droite de la fenêtre).
5. Choisir **Programm** dans **Rule Type**, puis cliquer sur Suivant.
6. Entrer le **chemin complet** du programme dans **Program**, puis cliquer sur Suivant.
7. Choisir **Block the connexion** dans **Action**, puis cliquer sur Suivant.
8. **Tout cocher** dans **Profile**, puis cliquer sur Suivant.
9. Donner un **nom** à la règle dans **Name**, puis cliquer sur Suivant.

View File

@@ -8,6 +8,8 @@
[Créer des clés ssh (pour Windows et WSL)](cles-ssh.md)
[Firewall Windows](firewall.md)
[PowerShell](PowerShell/index.md)
[systeminfo](systeminfo.md)

View File

@@ -294,3 +294,7 @@ $ uname --release
# 08-08-2020
```
https://devblogs.microsoft.com/commandline/access-linux-filesystems-in-windows-and-wsl-2/

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,10 @@
For full documentation visit [mkdocs.org](http://mkdocs.org).
Take me to [pookie](#some-heading)
Take me to [pookie](macos/python/pip.md#Environnement virtuel:)
## Installation:
@@ -97,6 +101,190 @@ scp -P42666 -r ./central_docs bruno@192.168.xxx.xxx:/volume1/web
## Admonitions:
### Note:
**Note simple:**
```markdown
!!! note ""
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo
purus auctor massa, nec semper lorem quam in massa.
```
!!! note ""
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
**Note avec titre:**
```markdown
!!! note "Phasellus posuere in sem ut cursus"
```
!!! note "Phasellus posuere in sem ut cursus"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
**Note sans titre:**
```markdown
!!! note ""
```
!!! note ""
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
**Note avec contenu:**
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa. ``` python def bubble_sort(items): for i in range(len(items)): for j in range(len(items) - 1 - i): if items[j] > items[j + 1]: items[j], items[j + 1] = items[j + 1], items[j] ``` Nunc eu odio eleifend, blandit leo a, volutpat sapien. Phasellus posuere in sem ut cursus. Nullam sit amet tincidunt ipsum, sit amet elementum turpis. Etiam ipsum quam, mattis in purus vitae, lacinia fermentum enim.
**Note collapsible ouverte:**
```markdown
??? note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
??? note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
**Note collapsible fermée:**
```markdown
???+ note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
???+ note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
### Type:
`abstract`, `summary`, `tldr`
```markdown
!!! abstract "Résumé"
```
!!! abstract "Résumé"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`info`, `todo`
```
!!! info "Info"
```
!!! info "Info"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`tip`, `hint`, `important`
```markdown
!!! tip "Tip"
```
!!! tip "Tip"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`success`, `check`, `done`
```markdown
!!! success "Succès"
```
!!! success "Succès"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`question`, `help`, `faq`
```markdown
!!! help "Aide"
```
!!! help "Aide"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`warning`, `caution`, `attention`
```markdown
!!! warning "Attention"
```
!!! warning "Attention"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`failure`, `fail`, `missing`
```markdown
!!! fail "Echec"
```
!!! fail "Echec"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`danger`, `error`
```markdown
!!! danger "Erreur"
```
!!! danger "Erreur"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`bug`
```markdown
!!! bug "Bug"
```
!!! bug "Bug"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`example`
```markdown
!!! example "Exemple"
```
!!! example "Exemple"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
`quote`, `cite`
```markdown
!!! quote "Citation"
```
!!! quote "Citation"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
## Font Awesome icons:
:fa-link: [http://bwmarrin.github.io/MkDocsPlus/](http://bwmarrin.github.io/MkDocsPlus/)
@@ -164,3 +352,11 @@ https://github.com/otsuarez/mkdocs_auth
/Users/bruno/Documents/venv/mkdocs/bin/pip3 install
### Some heading