Useful Things I learned

Random things I found out
 

Format aws-cli output as CSV

One of my recurring annoyances is that the AWS cli utility doesn’t support a CSV output option. This command fixes this (at least for snapshot data). aws ec2 describe-snapshots –owner-ids 12345 –output json |jq -r ‘.Snapshots[] | [.Description, .Encrypted, .OwnerId, .Progress, .SnapshotId, .StartTime, .State, .VolumeId, .VolumeSize, .StorageTier] | @csv’ >snapshots.csv …

Quickly generating a password that avoids confusing characters

One of the common issues with modern fonts is that certain characters can be easily confused. These include the letters and numbers 0,O,o,1,l,i and has been the subject of an XKCD comic. Here are two simple scripts to generate a random alpha-numeric password which avoids ambiguous characters. First python: #!/usr/bin/python …

X.509 Certificate Terminal Commands

For more details about X.509 certificates, you can read the wikipedia article at https://en.wikipedia.org/wiki/X.509 Display Certificate Values subject, expiry, signature algorithm, fingerprint, modulus md5 sum CERT=crt.pem echo; echo “Cert:” $CERT; CERTV=$(openssl x509 -text -noout -in $CERT);echo -n “Subject: “;echo “$CERTV”|grep -i [S]ubject:|cut -d ‘:’ -f 2;echo -n “Issuer Date: “;echo …

MySQL and Postgres cheatsheat

Initializing the DBMS (Note that this assumes no meta-database or anything exists at the present time.) Mysql: Just start the mysqld daemon if he mysql meta-database doesn’t exist. (see below) Postgresql: linux# su -c “initdb -D /path/to/data/dir” postgres Starting the DBMS Mysql: linux# service mysql start Postgresql: linux# service postgresql …

Installing Let’s Encrypt SSL certificates on Ubuntu, things to know

Preparing your server for SSL If you are installing SSL and Let’s Encrypt on Ubuntu for the first time, you should first enable SSL on your apache install. If you don’t you will get this error message: SSLCertificateFile: file ‘/etc/apache2/insert_cert_file_path’ does not exist or is empty First enable SSL: sudo …