https://gist.github.com/search?q=user%3Amttjohnson+gist
user:mttjohnson gist
| # rsync with sudo | |
| rsync -av \ | |
| --rsync-path="sudo -u www-data rsync" \ | |
| -e 'ssh -o StrictHostKeyChecking=no' \ | |
| path_to_local_data/ [email protected]:/var/www/ | |
| # If you wanted to build an exclusion list from a list of files in a directory | |
| # This was useful when trying to sync a list of files but exclude a list of default installed | |
| # so that the destination only contained the differences of what was added that wasn't a part |
| /* | |
| # Get size of a specific database into a bash variable for use in estimating mysqldump size for pv status bar | |
| DATABASE_NAME="example_db_name" | |
| DATABASE_SIZE=$(mysql --batch -sN -e "SELECT CONCAT(ROUND(sum( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 0), 'g') as size FROM information_schema.TABLES WHERE table_schema = '${DATABASE_NAME}' GROUP BY table_schema;") | |
| echo "${DATABASE_SIZE}" | |
| */ | |
| /* find the largest tables on the server */ | |
| SELECT CONCAT(table_schema, '.', table_name) 'db.table', | |
| CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, |
| SET @user_login := 'mjohnson'; | |
| SET @user_pass := 'securePassword'; | |
| SET @user_email := '[email protected]'; | |
| INSERT INTO `wp_users` | |
| (`user_login`, `user_pass`, `user_email`, `user_registered`) | |
| VALUES | |
| (@user_login, MD5(@user_pass), @user_email, now()); | |
| SELECT @user_id := LAST_INSERT_ID(); | |
| INSERT INTO `wp_usermeta` | |
| (`user_id`, `meta_key`, `meta_value`) |
| # Temporarily remove php memory limit when running composer from the commmand line | |
| php -dmemory_limit=-1 /usr/local/bin/composer ... | |
| # Run with explicitly defined list of extensions to avoid xdebug | |
| php -n \ | |
| -dextension=bcmath.so \ | |
| -dextension=bz2.so \ | |
| -dextension=calendar.so \ | |
| -dextension=ctype.so \ |
| # to turn on the remote debugger pass in a config flag to automatically start it | |
| php -d xdebug.remote_autostart=On ... | |
| # just make sure your debugger is referencing the same path as the path of the file you are executing | |
| # for remote debugging, these options should exist in your xdebug.ini file | |
| xdebug.remote_enable = on | |
| xdebug.remote_host = 127.0.0.1 |
| # Verify SSL | |
| ssl_domain=mydomainnametotest.com | |
| openssl rsa -noout -modulus -in $ssl_domain.key | openssl md5 | |
| openssl req -noout -modulus -in $ssl_domain.csr | openssl md5 | |
| openssl x509 -noout -modulus -in $ssl_domain.crt | openssl md5 | |
| # Output text of certificate | |
| openssl x509 -text -in /etc/nginx/ssl/$ssl_domain.crt | |
| # Get details of all certs in .crt bundle file to verify certificate chain |
| # recursively search for files that have pattern in them, then list the filename and line number where found | |
| find . -type f -exec awk '/\$store_code/ {printf "%d:", FNR; print FILENAME}' {} + |
| stage.rb | |
| set :branch, ENV['BRANCH'] || 'develop' | |
| BRANCH=074e9eb--entire-commit-has-in-this-branch-variable--cab54fcc2fde8b bundle exec cap stage deploy |
https://gist.github.com/search?q=user%3Amttjohnson+gist
user:mttjohnson gist
| change file permissions | |
| find /path/to/base/dir -type d -exec chmod 0755 {} + | |
| find /path/to/base/dir -type f -exec chmod 0644 {} + | |
| find . -type d -exec chmod 0777 {} + | |
| find . -type f -exec chmod 0666 {} + |