diff --git a/docs/.DS_Store b/docs/.DS_Store
deleted file mode 100644
index 9b2e03b..0000000
Binary files a/docs/.DS_Store and /dev/null differ
diff --git a/docs/Divers/git/git.md b/docs/Divers/git/git.md
index 0c673f8..592579a 100644
--- a/docs/Divers/git/git.md
+++ b/docs/Divers/git/git.md
@@ -19,8 +19,8 @@ bruno@macbook-pro:~/ git init
bruno@macbook-pro:~/ git remote -v
-bruno@macbook-pro:~/ git remote add origin ssh:dsm916/volume1/Repositories/wp2012.git
-bruno@macbook-pro:~/ git remote add origin bruno@dsm916:/volume1/Repositories/wp2012.git
+#bruno@macbook-pro:~/ git remote add origin ssh:dsm916e/volume1/Repositories/wp2012.git
+bruno@macbook-pro:~/ git remote add origin bruno@dsm916e:/volume1/Repositories/wp2012.git
bruno@macbook-pro:~/ git add *
diff --git a/docs/Divers/wp-cli/ovh.md b/docs/Divers/wp-cli/ovh.md
new file mode 100644
index 0000000..6ec8cc7
--- /dev/null
+++ b/docs/Divers/wp-cli/ovh.md
@@ -0,0 +1,205 @@
+# Installer wp-cli sur un serveur ovh mutualisé
+
+
+
+
+
+Rappel: voici ce dont on a a accès lorsque que l'on se connecte en ssh:
+
+```bash
+myuser@ssh1.300gp.ha.ovh.net (php/7.1/production/stable) ~ $ l
+total 2855
+drwxr-xr-x+ 14 myuser users 22 sept. 15 12:44 .
+drwxr-xr-x 4 root root 80 sept. 17 05:46 ..
+-rw-------+ 1 myuser users 11671 sept. 17 06:24 .bash_history
+-rw-r--r--+ 1 myuser users 246 sept. 15 14:22 .bash_profile
+-rw-r--r--+ 1 myuser users 49 sept. 15 06:59 ._bashrc
+drwx---r-x+ 2 myuser users 2 oct. 15 2008 cgi-bin
+drwxr-xr-x+ 3 myuser users 6 sept. 15 06:52 .composer
+drwxr-xr-x+ 3 myuser users 3 août 3 2016 git
+-rw-r--r--+ 1 myuser users 447 mai 24 2003 LISEZ-MOI
+drwxr-xr-x+ 4 myuser users 4 août 25 06:30 opt
+-rw----r--+ 1 myuser users 104 janv. 1 2018 .ovhconfig
+-rw----r--+ 1 myuser users 23 janv. 13 2017 php.ini
+drwx---r-x+ 36 myuser users 38 oct. 15 2008 requetes
+drwx---r-x+ 2 myuser users 2 mai 24 2003 sessions
+drwx------+ 2 myuser users 4 sept. 15 05:40 .ssh
+drwxr-xr-x+ 5 myuser users 7 sept. 15 09:21 .wp-cli
+drwx---r-x+ 18 myuser users 39 sept. 17 05:57 www
+
+
+```
+
+
+
+### Composer
+
+On commence par [installer Composer](https://getcomposer.org/download/) (dans opt/bin):
+
+```bash
+$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+
+$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
+
+$ php composer-setup.php --install-dir=opt/bin
+
+$ php -r "unlink('composer-setup.php');"
+
+```
+
+On vérifie la version installée:
+
+```bash
+myuser@ssh2.300gp.ha.ovh.net (php/7.1/production/stable) ~ $ composer -V
+Composer version 1.7.2 2018-08-16 16:57:12
+```
+
+
+
+### wp-cli
+
+Pas moyen de télécharger directement wp-cli (Connection refused):
+
+```bash
+$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
+ % Total % Received % Xferd Average Speed Time Time Time Current
+ Dload Upload Total Spent Left Speed
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
+```
+
+Il faut d'abord le télécharger en local puis le renvoyer sur ovh.
+
+On le rend exécutable et on le déplace dans opt/bin.
+
+```bash
+$ chmod +x wp-cli.phar
+$ sudo mv wp-cli.phar opt/bin/wp
+```
+
+On vérifie que tout va bien avec `wp --info`
+
+On peut ajouter un fichier de configuration `config.yml` dans `~/.wp-cli/`
+
+```yaml
+path: ../www/wordpress
+url: https://clicclac.info/wordpress
+core config:
+ dbhost: db.mysql.db
+ dbname: dbwp
+ dbuser: userwp
+ dbpass: passwd
+```
+
+Finalement...
+
+```bash
+$ wp --info
+OS: Linux 4.14.61-ovh-vps-grsec-zfs-classid #1 SMP Tue Aug 7 02:27:59 CEST 2018 x86_64
+Shell: /bin/ovh_ssh
+PHP binary: /usr/local/php7.1/bin/php
+PHP version: 7.1.17
+php.ini used: /usr/local/php7.1/etc/php.ini
+WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
+WP-CLI vendor dir: phar://wp-cli.phar/vendor
+WP_CLI phar path: /home/myuser
+WP-CLI packages dir: /homez.65/myuser/.wp-cli/packages/
+WP-CLI global config: /homez.65/myuser/.wp-cli/config.yml
+WP-CLI project config:
+WP-CLI version: 2.0.1
+```
+
+
+
+Une fois wp-cli installé, on ne peut pas y rajouter de package. La connection est toujours refusée.
+
+```bash
+~/www/wordpress $ wp package install wp-cli/doctor-command
+
+Error: The "https://wp-cli.org/package-index/packages.json" file could not be downloaded: failed to open stream: Connection refused
+
+~/www/wordpress $ wp package install git@github.com:wp-cli/doctor-command.git
+
+Error: Failed to get url 'https://raw.githubusercontent.com/wp-cli/doctor-command/master/composer.json': cURL error 7: Failed to connect to raw.githubusercontent.com port 443: Connection refused.
+```
+
+Même juste afficher la liste des packages pose problème:
+
+```bash
+~/www/wordpress $ wp package list
+Warning: The "https://wp-cli.org/package-index/packages.json" file could not be downloaded: failed to open stream: Connection refused
++--------------------------+------------------+------------+--------+----------------+
+| name | authors | version | update | update_version |
++--------------------------+------------------+------------+--------+----------------+
+| trepmal/wp-revisions-cli | | dev-master | error | error |
+| wp-cli/doctor-command | Daniel Bachhuber | dev-master | none | |
++--------------------------+------------------+------------+--------+----------------+
+```
+
+
+
+
+
+L'astuce est de passer par un script php et la fonction shell_exec:
+
+```php
+$install = shell_exec('wp package install git@github.com:wp-cli/doctor-command.git 2>&1');
+```
+
+Pensez à bien renseigner les variables d'environnement au début du script.
+
+
+
+**install_wp_package.php**
+
+```php
+&1');
+echo "$ which composer: $composer";
+
+echo "
";
+
+$composer_v = shell_exec('composer -V 2>&1');
+echo "$ composer -V: $composer_v";
+
+echo "
";
+
+$wp = shell_exec('which wp 2>&1');
+echo "$ which wp: $wp";
+
+echo "
";
+
+$wp_info = shell_exec('wp --info 2>&1');
+echo "$ wp --info:
$wp_info"; + +$pwd = shell_exec('pwd'); +echo "$ pwd:
$pwd";
+
+echo "$output2";
+
+echo "$package_list"; + +#$install = shell_exec('wp package install git@github.com:wp-cli/doctor-command.git 2>&1'); +#$install = shell_exec('wp package install trepmal/wp-revisions-cli 2>&1'); +echo "
$install"; + +echo "Update all package $ wp package update" + +#$themes = shell_exec('wp theme list --path=wordpress 2>&1'); +#echo "$ wp theme list:
$themes"; + + +?> +``` + diff --git a/docs/Linux/for.md b/docs/Linux/for.md new file mode 100644 index 0000000..175c25f --- /dev/null +++ b/docs/Linux/for.md @@ -0,0 +1,40 @@ +# for + + + +#### 1ere syntaxe: + +```bash +bash for variable in liste_valeurs + do instruction(s) +done +``` + +#### 2eme syntaxe: + +```bash +for ((e1;e2;e3)) + do instruction(s) +done +``` + + + +### Exemples: + +Parcourir les arguments passés au script: + +```bash +for i in "$@" +do + echo "$i" +done +``` + + + +```bash +for ((i=0 ; 10 - $i ; i++)) + do echo $i +done +``` \ No newline at end of file diff --git a/docs/macos/node/node-js.md b/docs/macos/node/node-js.md index 8360f3f..85f8d94 100644 --- a/docs/macos/node/node-js.md +++ b/docs/macos/node/node-js.md @@ -40,7 +40,11 @@ $ nvm install 10 -### Version de npm: +### npm + +npm est un gestionnaire de paquets pour JavaScript automatiquement installé avec Node. + +#### Version de npm: ```bash # version: @@ -52,11 +56,11 @@ $ npm -v -### Update: +#### Update: ```bash -npm install npm@latest -g +$ npm install npm@latest -g $ brew install node @@ -67,7 +71,7 @@ https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-2-change-np -### Local: +#### Local: Installer npm packages localement => `/Users/bruno/Sites/node_modules` @@ -91,7 +95,7 @@ $ npm outdated | awk '{print $1}' | xargs npm update -### Global: +#### Global: Installer npm packages globalement => `/usr/local/lib/node_modules/` @@ -102,7 +106,7 @@ Installer npm packages globalement => `/usr/local/lib/node_modules/` -### Aller dans node_modules: +#### Aller dans node_modules: ```bash bruno@SilverBook:~$ cd Sites/node_modules/ @@ -118,7 +122,7 @@ puis -### Supprimer tous les modules: +#### Supprimer tous les modules: ```bash $ for package in `ls node_modules`; do npm uninstall $package; done; @@ -126,7 +130,7 @@ $ for package in `ls node_modules`; do npm uninstall $package; done; -### Maintenance: +#### Maintenance: ```bash $ npm doctor @@ -146,7 +150,7 @@ Verify cache contents verified 2159 tarballs -### Packages: +#### Packages: [Rechercher un package](https://npms.io) diff --git a/docs/macos/node/nvm.md b/docs/macos/node/nvm.md index 3a63e67..14335df 100644 --- a/docs/macos/node/nvm.md +++ b/docs/macos/node/nvm.md @@ -2,6 +2,14 @@ +nvm est un gestionnaire de version pour Node. + + + +### Installation + +#### Avec Homebrew: + Installer nvm: ```bash @@ -36,6 +44,25 @@ $ echo $NVM_DIR $ nvm --version ``` + + +#### Avec git (méthode officielle): + +```bash +$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash +``` + +Le script d'installation ajoute les lignes suivantes à votre profil (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). + +```bash +export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +``` + + + +### Utilisation + Installer NodeJS. ```bash diff --git a/docs/macos/python/python3.md b/docs/macos/python/python3.md index c9e9cbb..df74c14 100644 --- a/docs/macos/python/python3.md +++ b/docs/macos/python/python3.md @@ -46,6 +46,47 @@ $ python3 -m site --user-base +### idle: + +**idle** est l'éditeur par défaut de Python + +Pour le lancer depuis le shell: + +```bash +$ idle +``` + +[Python et tcl/tk versions](https://discussions.apple.com/thread/8066794) + +Python 3 utilise la bibliothèque Tcl/Tk fournie par macOS (8.5.9). + +Pour utiliser une version plus récente (8.6.8) de la bibliothèque : + +```bash +$ brew install tcl-tk +$ brew reinstall python3 --with-tcl-tk +``` + + + +#### jupyter: + +[jupyter](https://jupyter.org/) est une web application qui permet de créer et partager des documents contenant du live-code... + +Installer: + +```bash +$ pip3 install jupyter +``` + +Démarrer: + +```bash +$ jupyter notebook +``` + + + ### Modules: #### Mkdocs diff --git a/docs/macos/webserver/apache.md b/docs/macos/webserver/apache.md index 9e202c5..3a2cfba 100644 --- a/docs/macos/webserver/apache.md +++ b/docs/macos/webserver/apache.md @@ -55,6 +55,8 @@ $ bbedit /usr/local/etc/httpd/extra/httpd-vhosts.conf ### Virtual Hosts: +#### Redirection: + Editer le fichier *hosts*: ```bash @@ -78,6 +80,29 @@ Editer le fichier *httpd-vhosts.conf*: ``` +#### Redirection de port: + +wiki.js tourne sur localhost:3000 Pour le rendre disponible sur wiki.silverbook.local: + +Editer le fichier *hosts*: + +```bash +$ sudo nano /etc/hosts +127.0.0.1 silverbook.local +127.0.0.1 wiki.silverbook.local +``` + +Editer le fichier *httpd-vhosts.conf*: + +```http +