Skip to content

Instantly share code, notes, and snippets.

View renshuki's full-sized avatar
💭
🇫🇷 🇯🇵 🇺🇸

Francois-Clement Brossard renshuki

💭
🇫🇷 🇯🇵 🇺🇸
View GitHub Profile
@renshuki
renshuki / reset_files_and_folders_permissions.md
Last active March 18, 2019 13:19
Reset files and folders permissions
chown -R user:group
find directory_path -type d -exec chmod 775 {} \;
find directory_path -type f -exec chmod 664 {} \;
@renshuki
renshuki / mysql_database_create_time.sql
Last active March 18, 2019 13:21
Find the time of creation of a MySQL database
SELECT create_time
FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'db_name';
@renshuki
renshuki / decipher_morse.md
Last active March 18, 2019 13:23
Crack / Decipher Morse

Introduction

Ciphered message:

-.-- -.. --- -... .- ..- / -.. ..- / ..- .- --. / -.-- --.. .-.. -... .- ..- / --.- .--- / --.. / .-. ..- -.. -.- -..- / -... --- -.. ..-. --- / -- -.. ..- / -.-- --.. .-.. -... .. --.- ... --.- .--- ...- / ...- --.. --.- --- - .--. / -..- ..- .- .--- .- --- .. / --.- --- / .-.. -.-- --.- --- --.. .-.-.- / .. -.-- .- / ..-. -.. ..- --. / -.-- -.. --- -... .- ..- / .- ...- .- ..- .-. .- --. / ..-. -.-- .- --- / .. -.-- .- / -.- --- --.- .. .- --. / .--- .. --.. .. .- .--- / .-- -.. ...- .-- .- --. / .. -.-- .- / .-.. -.-- --.- --- .- .--- .- / .- ...- .-- --.. .--- .--- .--. / --.- --- / .-- .- - .-. ..- --.. --. .- .-.-.- / .--- --.- --- .-.. .- / .. -.-- .- --- / -.-- -.. --- -... .- ..- .--- / -- -.. ..- ...- .- --. / --.. / -.-- -.. --- -... .- ..- / -.- --- --.- -.. --- / ..-. -.-- -.. .--- .- / ...- .- ...- .-- .- ..- .--- / .-.. -.. ...- .-- --.- --- .- --. / -.-- --.. .-.. -... --.- --- .-. / .--- -... --.- - - .--- / ..-. --.- .. -.-- / -..- --.. .. ..- --.- -..

@renshuki
renshuki / delete_all_gems.md
Last active March 18, 2019 13:23
Delete all installed Ruby gems

Command to uninstall all gems in Ruby

gem list | cut -d" " -f1 | xargs gem uninstall -aIx

@renshuki
renshuki / git_changed_files_6days_ago.md
Last active March 18, 2019 13:24
Find files changed 6 days ago in GIT and show them in a pretty format

git diff --stat @{6.days.ago} --pretty=format: --name-only

@renshuki
renshuki / delete_folders_older_than_2015.md
Last active March 18, 2019 13:24
Command to delete all folders older than year 2015

find . -type d -maxdepth 1 -not -newermt 20141231 -exec rm -r "{}" \;

@renshuki
renshuki / git_delete_remote_ghost_branches.md
Last active March 18, 2019 13:26
Delete all git remote GHOST branches that doesn't want to disappear (when you do a `git branch -a`)

git remote prune origin

or

git fetch origin --prune

@renshuki
renshuki / apache_delete_html_extension.md
Last active March 18, 2019 13:27
Apache rewrite configuration to delete .html extension in web page URL
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ $1 [R=301,L]
@renshuki
renshuki / apache_extfilter_change_url_onfly.md
Last active March 18, 2019 13:28
Apache extfilter module to replace URLs on the fly (while you access a website Apache automatically translate the address)

ExtFilterDefine fixtext mode=output intype=text/html cmd="/bin/sed s#www\.example1\.com#www\.example2\.com#g"

@renshuki
renshuki / count_number_of_files_in_directory.md
Last active March 18, 2019 13:28
Command to count the number of files in a directory

find DIR_NAME -type f | wc -l