Monday, September 25, 2017

Replace HTTP to HTTPS

To quickly replace all of the http to https within a file can be easily done by
sed -i 's|http:|https:|g' *.html
 
or find
find . -name "*.html" -exec sed -i 's|http:|https:|g' {} \; 

Thursday, September 14, 2017

Increase Max Filesize Upload in Wordpress



This address specifically to the Media Library upload limitation within Wordpress

NGINX Configuration

Modified /etc/nginx/nginx.conf within the http section

http {
      # set client body size to 200M #
      client_max_body_size 200M;

PHP Configuration


Modified php.ini with three items within /etc/php/7.0/cli/php.ini and /etc/php/7.0/fpm/php.ini

  • upload_max_filesize = 200MB
  • post_max_size = 200MB
  • memory_limit = 128MB

WP Plugin


Used Increase Upload Max Filesize

Thursday, August 31, 2017

Bulk Resize Images in Ubuntu

ImageMagick Installation
sudo apt-get update
sudo apt-get install imagemagick -y
 Resize to either height or width, keeps proportions using ImageMagick
cd /path/to/output
find </path/to/images> -iname '*.jpg' -o -iname '*.png' -exec convert \{} -resize WIDTHxHEIGHT\> \{} \;

Thursday, August 24, 2017

Thursday, August 17, 2017

Clone HDD Remotely

If your intent is to backup a remote computer's HDD A via SSH to a single file that's on your local computer's HDD, you could do one of the following.

Find the hard drive to backup. Notice that the hard drive is only the letters and not the number since the number is the partitions.
df -h
Run from remote computer
sudo dd if=/dev/sda | gzip -1 - | ssh user@local dd of=image.gz
Run from local computer
sudo ssh user@remote "dd if=/dev/sda | gzip -1 -" | dd of=image.gz

Methods for monitoring?

  1. Login via ssh in another terminal and ls -l the file to see what it's size is.
  2. You can use pv to monitor the progress of a large dd operation, for instance, for the remote example above, you can do:
    $ dd if=/dev/sda | gzip -1 - | pv | ssh user@local dd of=image.gz
    
  3. Send a "SIGUSR1" signal to dd and it will print stats. Something like:
    $ pkill -USR1 dd