Install PHP Composer Globally Single Line

How to install PHP composer globally in a single line

I use this in Dockerfile’s a lot

curl -sS https://getcomposer.org/installer | \
sudo php -- --install-dir=/usr/local/bin --filename=composer

This will allow composer to be run in any directory and will not require including the .phar extension.

Linux Disk Space Usage Tool

The most common server issue I encounter is probably related to a full disk.

Here is a great command line tool that I use to find out what files are eating up all the available space.

ncdu

Test File Upload Limit

Sometimes (most of the time) when setting up a server or app I forget to set the file upload limit.

Here is a quick way to generate a file of any size and then upload it to a server via curl.

mkfile -n 24m 24.txt
curl -F 'data=@24.txt' https://example.com/file-upload-handler

Note: I use a Mac

Git Rename Origin

git remote -v
git remote rm origin
git remote add origin gitlab.com:repo/path.git

or

git remote set-url origin git@gitlab.com:repo/path.git

AWS Certificate Manager Wildcard Certificate

I usually use Let’s Encrypt for obtaining my SSL certificates but this is just not an option
when using Amazon CloudFront. Fortunately, like Let’s Encrypt, Amazon does issue free SSL certificates. I must admit I do like using Amazon’s certificates because if you host your DNS on Route 53 (which I usually do) they basically take care of setting up your domain’s DNS verification automatically. DNS verification with Let’s Encrypt is most definitely not as seamless.

There is one thing that I keep forgetting when I create an Amazon wildcard certificate.
Several times now I have added the wildcard domain like *.example.com but I forgot to
include the root domain like example.com. This is not really a problem unless you like having many
certificates when a single one would suffice.

Anyway, because I forget things… When creating an Amazon wildcard certificate be sure to include the root domain as by default *.example.com does NOT include example.com.