How To Reduce the Size of a PDF Using Ghostscript

Author: , February 4th, 2017

Make sure you have Ghostscript installed, then: 1 gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="/ebook" -sOutputFile=output.pdf input.pdf gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=”/ebook” -sOutputFile=output.pdf input.pdf -dPDFSETTINGS={value} where {value} is one of: /screen – the lowest resolution and lowest file size, fine for viewing on a screen /ebook – mid-range resolution and file size /printer – high-quality […]

How To Send Email From the Command Line on MacOSX 10.10.5 Yosemite

Author: , January 29th, 2017

I wanted to send email from cron for various reasons, but the emails would bounce with an error 554: 554 5.1.8 : Sender address rejected: Domain not found Clearly, Postfix was using the “internal” hostname of myappledesktop.local (MacOSX has TWO hostnames! also, myappledesktop.local is not the real hostname ;-). So, I needed two things: 1. […]

How To Install a .pkg file from the Command Line on MacOSX

Author: , August 12th, 2016

sudo /usr/sbin/installer -pkg /path/to/yourFile.pkg -target /

How To Create a PDF from Multiple Image Files on the Command Line

Author: , June 6th, 2016

convert myFile*.jpg myFile.pdf convert myFile*.png myFile.pdf

How To Install the AWS CLI

Author: , March 29th, 2016 1 2 3 4 5 6 7 8 cd curl "" -o "" unzip yum install python26 /usr/bin/python26 awscli-bundle/install -i /opt/aws/awscli -b /usr/bin/aws aws configure aws s3 ls aws ec2 describe-instances –output text cd curl “” -o “” unzip yum install python26 /usr/bin/python26 awscli-bundle/install -i /opt/aws/awscli -b /usr/bin/aws aws configure aws […]

How To Fix Peer Not Authenticated Errors While Using AWS API Tools

Author: , February 9th, 2016

I was getting the following errors when using an older version of the Amazon EC2 API Tools: $ ec2-describe-regions Unknown problem connecting to host: ‘’ Unable to execute HTTP request: peer not authenticated The solution was to upgrade to the latest AWS CLI tools and start using the aws command instead. For example: aws ec2 […]

How To Eject a Volume from the Terminal Command Line in MacOSX

Author: , December 8th, 2015

As always, YMMV… 1 2 3 4 5 6 7 8 9 #!/bin/bash # Usage: eject [fullpath to mount point] DISK="${1:-/Volumes/YourUSBFlashDriveName/}" df -h "$DISK" > /dev/null 2>&1 if [ $? -eq 0 ]; then    diskutil unmountDIsk `diskutil list "$DISK" | grep ^/dev/` else    echo Volume $DISK is not mounted…skipping. fi #!/bin/bash # Usage: […]

How To Convert UNIX Timestamps to Date using PHP CLI

Author: , August 15th, 2015

For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015″) – 1;’

How To Find the AWS Region and Availability Zone Via the CLI

Author: , June 30th, 2015

/opt/aws/bin/ec2-metadata | grep placement

How To Force Getopt::Long To Be Case Sensitive in Perl

Author: , March 19th, 2014

1 use Getopt::Long qw(:config no_ignore_case); use Getopt::Long qw(:config no_ignore_case);