Skip to content

Instantly share code, notes, and snippets.

View vinaysyadav's full-sized avatar
💭
Available

Vinay Yadav vinaysyadav

💭
Available
View GitHub Profile
// Get sizes of all databases on the server.
SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "database size in MB", sum( data_free )/ 1024 / 1024 "free space in MB" FROM information_schema.TABLES GROUP BY table_schema order by "database size in MB" DESC limit 500
@vinaysyadav
vinaysyadav / youtube_id_regex.php
Created July 8, 2020 20:30 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
Goto https://archive.org/advancedsearch.php, and in the "Advanced Search returning JSON, XML, and more
" pertform search, and save the file as txt
wget -r -H -nc -np -nH --cut-dirs=1 -e robots=off -l1 -i ./search.csv -B 'https://archive.org/download/'
@vinaysyadav
vinaysyadav / wp-cli.sh
Created December 3, 2018 19:25
using wp-cli tfor new wordpress installation
sudo /usr/local/bin/wp core download
sudo /usr/local/bin/wp core config --dbhost=loalhost --dbname={database_name} --dbuser={user} --dbpass={password}
sudo /usr/local/bin/wp core install --url={domain} --title="{title}" --admin_name={login_username} --admin_password={login_pass} --admin_email={admin_password}
# Script to reduce size of PDF file in Linux.
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=new_file.pdf original_file.pdf