Skip to content

Instantly share code, notes, and snippets.

@spyesx
spyesx / ncu.sh
Last active September 1, 2016 12:26
node check updates
$ npm install node-check-updates
$ ncu -u
#if it doesn't work
$ ncu -a
@spyesx
spyesx / lines_counter.sh
Last active February 28, 2018 01:57
Count all the lines of code in a directory recursively
# https://explainshell.com/explain?cmd=find+.+-name+%27*.php%27+-o+-name+%27*.twig%27+%7C+xargs+wc+-l
find . -name '*.php' -o -name '*.twig' | xargs wc -l
@spyesx
spyesx / no_value_select.html
Created September 1, 2016 12:25
Select empty at the beginning without user to be able to select an empty value after the first change. Good for custom placeholder/label.
<select name="">
<option selected disabled hidden style="display: none;" value=""></option>
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
</select>
@spyesx
spyesx / disable_pingback_ping.php
Created September 2, 2016 09:36
Disable XML RPC Ping back to protect Wordpress from DDOS
<?php
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
} );
@spyesx
spyesx / Google_Guetzli.sh
Last active November 6, 2020 20:27
Google Guetzli encode to JPG images in bulk
# From : https://github.com/google/guetzli
# Install Guetzeli
brew install guetzli
# Install Guetzeli
cd /go/to/your/folder
# Bulk files
# Warning : make a copy before lauching it.
@spyesx
spyesx / Batch_resize_images.sh
Created April 30, 2017 08:23
Batch resize images
# sips -- scriptable image processing system
# https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html
sips -Z 3400 *.jpg
@spyesx
spyesx / mysql_dump_separate_files.sh
Last active February 28, 2018 01:56
Dumps all mysql databases in separate files
# Don't forget to replace **USER** and **PASS** twice.
# https://explainshell.com/explain?cmd=mysql+-s+-r+-u**USER**+-p**PASS**+-e+%27show+databases%27+-N+%7C+while+read+dbname%3B+do+mysqldump+-u**USER**+-p**PASS**+--complete-insert+--single-transaction+%22%24dbname%22+%3E+%22%24dbname%22.sql%3B+done
mysql -s -r -u**USER** -p**PASS** -e 'show databases' -N | while read dbname; do mysqldump -u**USER** -p**PASS** --complete-insert --single-transaction "$dbname" > "$dbname".sql; done
@spyesx
spyesx / wordpress_migrate_db.php
Last active May 24, 2017 10:03
Create multiple SQL DB for different environments based on a local one. Useful for Wordpress.
<?php
/*
Folder tree :
./wordpress_migrate_db.php
./local
./dev
./preprod
./prod
@spyesx
spyesx / folder_structure.sh
Last active December 12, 2020 06:15
Create a folder structure
# A
# ├── 1
# ├── 2
# └── B
# ├── 1
# └── 2
# https://explainshell.com/explain?cmd=mkdir+-p+.%2FA%2F%7B1%2C2%2CB%2F%7B1%2C2%7D%7D
mkdir -p ./A/{1,2,B/{1,2}}
@spyesx
spyesx / raw_to_jpg.php
Last active September 23, 2024 07:56
Convert RAW images to JPG. Actually whatever you want as long as these formats are supported by ImageMagick.
<?php
/*
Convert RAW images to JPG. Actually whatever you want as long as these formats are supported by ImageMagick.
https://www.imagemagick.org/script/formats.php
Best used in a terminal to avoid Apache's timeout :)
ex : php raw_to_jpg.php
Folder tree