How to quickly find the AZ of an EC2 while using SSH on the box

Well the title is a mouthful but long and the short of it is I needed a quick way to figure out what AZ a specific box was running on so I can update the Linux software running on it via the UI Console… and I have a bunch of EC2 instances I run across AWS full set of AZ. So how do you find it? Simple… using curl & hitting a unique IP address provided by AWS.


That's it ... what you get back will tell you where your EC2 is located... and in the case of the one I was trying to find ... ap-northeast-1 

How to quickly parse an Apache logfile with AWK

awk '{print $9}' apache_access.log | sort | uniq -c | sort -r | head -n 25  

The above command line is a pipeline of several commands…

sort: This takes the output of the previous command (the list of HTTP status codes) and sorts them in ascending order.

uniq -c : filters out repeated lines that are adjacent, and -c adds a count of how many times each line occurred. Since the input is sorted, this counts how many times each time a specific instance of a code appears in the log.

sort -r : This sorts the output of the previous command (the count of each status code) in reverse order (i.e., descending order).

head -n 25 : displays the first 25 lines of the sorted output. This shows the top 25 HTTP status codes by frequency in the log file.

How to quickly bulk delete spam from Xenforo from moderation tools without plugins

Using Chrome right click on the moderation page where you got a bunch of spam posts and or new users. Click inspect. Then click Console. Paste the script below into the console and press enter. This will toggle all radio buttons to delete, reject & uncheck notify user.

var btns = document.querySelectorAll('input[type="radio"]')
for(var i=0;i<btns.length;i++){
 var btns = document.querySelectorAll('input[type="radio"]')
for(var i=0;i<btns.length;i++){
 var btns = document.querySelectorAll('input[type="checkbox"]')
for(var i=0;i<btns.length;i++){

How to update private keys for your on an S3 site using Docker & Let’s Encrypt.

First this how to is intended to be run on a Linux system as Docker will be writing the finished CERT files to directories on your Linux system.

Next make sure you have Docker installed and working properly on your Linux machine

docker run -it --rm --name certbot -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" certbot/certbot certonly --manual --agree-tos -d ""

Next create the file that Certbot wants you to upload and upload it using the AWS CLI command below.

aws s3 cp [NAME OF THE FILE CERTBOT GAVE YOU] s3://[s3bucket that stuff should gointo]/.well-known/acme-challenge/ --acl=public-read --profile=[IF YOU NEED A PROFILE USE THIS OTHERWISE DROP EVERYTHING before --proile]

Replace the placeholder text with what ever Certbot gave you and whatever the S3 bucket is your. If you need a profile make sure to include that.

Once uploaded click continue to the Certbot prompt. This will create the keys and save them in the directory /etc/letsencrypt/live/

Change to root (sudo -s) and then change to this directory and nano *

Now login to AWS and go to and find the website you’re updating and click on REIMPORT.

Next copy each of the files that you now have open in nano over to the respective boxes.

  • cert.pem -> Certificate body
  • chain.pem -> Certificate chain
  • privkey.pem -> Certificate private key

fullchain.pem doesn’t go into any boxes. Click NEXT.

Now go to Cloud Front find the distribution you’re working with and click the ID. In the sections setting click EDIT. Don’t change anything scroll down to the bottom and click Save Changes even though you haven’t made any.

In about 15 minutes the certificate will be deployed and renewed.

Nigerian Scam in Shakespeare’s time

Dear esteemed friend,

I, the prince of Nigeria, do beseech thy assistance in a matter most pressing. It is with great urgency that I seek thy help in transferring a sum of money, a trifling amount in the grand scheme of things, to a safe and secure location.

If thou art willing to lend thy aid in this noble cause, thou shalt be handsomely rewarded with a generous bonus, a princely sum that shall far exceed thy wildest expectations.

I implore thee, do not hesitate in offering thy assistance. Time is of the essence and every moment counts.

I remain, thy devoted prince and servant,