Skip to content

Instantly share code, notes, and snippets.

View MarceauKa's full-sized avatar
🚀
Working hard!

Marceau Casals MarceauKa

🚀
Working hard!
View GitHub Profile
@MarceauKa
MarceauKa / The Matrix.md
Last active July 2, 2019 18:34
The Matrix
@MarceauKa
MarceauKa / movies2sheet.php
Created June 25, 2019 13:20
Movies 2 sheet - Transform a folder with movies in a sheet with meta infos (files must be : "name YEAR.extension")
<?php
$config = [
'path' => './',
'ffmpeg' => '/usr/local/bin/ffmpeg',
'output' => 'movies2sheet.csv',
'col_separator' => ',',
'line_separator' => "\n",
];
@MarceauKa
MarceauKa / blade.php
Last active March 29, 2019 13:22
Laravel Blade Errors
<?php
Blade::directive('errormessage', function ($expression) {
return '<?php if ($errors->has(' . $expression . ')): echo \'<span class="help-block">\'.$errors->first(' . $expression . ').\'</span>\'; endif; ?>';
});
Blade::directive('errorexists', function ($expression) {
return '<?= $errors->has(' . $expression . ') ? " has-error" : ""; ?>';
});
@MarceauKa
MarceauKa / phonenumber.php
Created August 11, 2017 09:58
Validation RegEx téléphone en PHP
<?php
$regex = "/^((?:\+?33|0)(?:[6-7]{1})(?:[\-\s\.]{0,}[0-9]{2})+)$/im";
$subjects = [
'0601020304',
'+33601020304',
'33601020304',
'06.01.02.-.03.04',
'06-01---02-03-04',
@MarceauKa
MarceauKa / backup.sh
Created March 25, 2015 12:10
Script de Backup site web
#!/bin/sh
THE_IP="94.23.215.123";
THE_DATE=`date +%Y%m%d`;
THE_PATH="/home/saves/[mon-dossier]/files/";
ssh root@${THE_IP} 'mysqldump -u"[Utilisateur MySQL]" -p"[Mot de passe MySQL]" [Base MySQL] | gzip > /[Chemin distant]/database.sql.gz'
scp root@${THE_IP}:/[Chemin distant]/database.sql.gz ${THE_PATH}database_${THE_DATE}.sql.gz
ssh root@${THE_IP} 'rm /[Chemin distant]/database.sql.gz'