Skip to content

Instantly share code, notes, and snippets.

View m1m1s1ku's full-sized avatar
🌀

Léonard. m1m1s1ku

🌀
View GitHub Profile
server {
listen 80;
server_name koel.ndd.tld;
return 301 https://koel.ndd.tld$request_uri;
}
server {
listen 443 ssl http2;
# Without HTTP2
#listen 443 ssl;
@m1m1s1ku
m1m1s1ku / keybase.md
Last active August 10, 2021 11:15
keybase.md

Keybase proof

I hereby claim:

  • I am ghostfly on github.
  • I am ghostfly (https://keybase.io/ghostfly) on keybase.
  • I have a public key ASDiysq3m4SVI4DJn28U-ZRZaEEE824LwCaI3WTQl7ykuwo

To claim this, I am signing this object:

@m1m1s1ku
m1m1s1ku / opti.php
Created November 13, 2016 00:34
Optimize jpg/png using PHP/Exec
<?php
exec("find /var/www/FOLDER/img/ -type f -name '*.jpg' -exec jpegoptim --strip-all {} \;");
exec("find /var/www/FOLDER/img/ -type f -name '*.JPG' -exec jpegoptim --strip-all {} \;"); // Sometimes, .jpg are.. .JPG
exec("find /var/www/FOLDER/img/ -type f -name '*.png' -exec optipng -o2 {} \;"); // Level 2, change to -o2 => -o7
mail('mail@mail.com', 'Server', 'Jpg/Png opti done');
?>
@m1m1s1ku
m1m1s1ku / contentTypeRename.php
Last active December 23, 2016 01:03
Rename blank filename with his contentType
<?php
echo "<h4>Ajout des extensions à un fichier via PHP</h4>";
function mime2ext($mime){
$all_mimes = '{"png":["image\/png","image\/x-png"],"bmp":["image\/bmp","image\/x-bmp","image\/x-bitmap","image\/x-xbitmap","image\/x-win-bitmap","image\/x-windows-bmp","image\/ms-bmp","image\/x-ms-bmp","application\/bmp","application\/x-bmp","application\/x-win-bitmap"],"gif":["image\/gif"],"jpeg":["image\/jpeg","image\/pjpeg"],"xspf":["application\/xspf+xml"],"vlc":["application\/videolan"],"wmv":["video\/x-ms-wmv","video\/x-ms-asf"],"au":["audio\/x-au"],"ac3":["audio\/ac3"],"flac":["audio\/x-flac"],"ogg":["audio\/ogg","video\/ogg","application\/ogg"],"kmz":["application\/vnd.google-earth.kmz"],"kml":["application\/vnd.google-earth.kml+xml"],"rtx":["text\/richtext"],"rtf":["text\/rtf"],"jar":["application\/java-archive","application\/x-java-application","application\/x-jar"],"zip":["application\/x-zip","application\/zip","application\/x-zip-compressed","application\/s-compressed","multipart\/x-zip"],"7zip":["applic
@m1m1s1ku
m1m1s1ku / install.md
Last active September 8, 2021 11:48
Install Apache (with SSL) + PHP 7.1 + MySQL (macOS Sierra)

Install Apache (with SSL) + PHP 7.1 + MySQL

Made for macOS Sierra 10.12.5 (tested on a fresh mac)

Install brew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Some tapping is needed :

  • $ brew tap homebrew/dupes
@m1m1s1ku
m1m1s1ku / casks.md
Last active July 9, 2017 02:19
Brew casks
  • atom
  • encryptr
  • firefox
  • flux
  • font-clear-sans
  • font-droid-sans
  • font-georgia
  • font-inconsolata
  • font-limelight
  • font-open-sans
@m1m1s1ku
m1m1s1ku / logBeauty.js
Last active July 25, 2017 01:41
Debug beautifully (log function pure js)
/**
* log(anything);
* Shorter
*/
log = function(){
return Function.prototype.bind.call(console.log, console, "🛠️");
}();
/**
* Debug beautifully
/**
* Get current user IP (in callback)
* @param {string} callback
*/
function getIp(callback){
var url = 'https://api.ipify.org/';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(this.readyState === XMLHttpRequest.DONE)
if(this.status === 200)
@m1m1s1ku
m1m1s1ku / imageproxyPhpBB.php
Last active August 26, 2017 13:07
Bulk change every (http posts) + (avatar / signature of phpbb users) by the same with https ! Thanks to https://developer.hootsuite.com/v1.0/docs/https-image-proxy
<?php
$imageProxy = "https://d1r1anxoiubeog.cloudfront.net/";
$dbname = "";
$user = "";
$pass = "";
$dsn = "mysql:host=localhost;dbname=".$dbname;
$usersToChange = getEveryUserWithHttpAvatar($pdo, $imageProxy);
$countUsers = count($usersToChange);
@m1m1s1ku
m1m1s1ku / deploy.js
Last active December 26, 2017 16:59
NodeDeploy
/**
- Config sample :
{
"login": "xxx",
"password": "xxx",
"port": 22,
"host": "miaow.com",
"currentMask": "/var/www/*",
"dest": "/var/www/",
"build": "build/es5-bundled"