Putty SSH settings to stop garbled output

Using ubuntu 18 and tools like glances and iftop would often mangle the output

Changing the default Puttty settings
‘Connection > Data > ‘Terminal-type string’ to ‘putty’ instead of ‘xterm’
and setting your PuTTY settings under Translation and ensure that you have UTF-8 set as the character set then save this as the default profile and enjoy 🙂

Copy files from Andorid phone using ADB – Quicker than MTP

When backing up photos form my Android phone i found that the phone didn’t present as a mass storage device, it would only appear as a MTP\PTP device and the file copy speed was terrible.

So some research led me to using the ADB command, you’ll need to enable USB debugging before this will work.

 

Find your files

adb shell ls /storage/

Back em up

adb pull /storage/self/primary/DCIM/Camera /home/user/photos/

MYSQL Backup to S3 script

Script

#!/bin/bash

# Set the enviroment variable so read function knows to seperate on ",".
export IFS=","

NOW=$(date +"%Y_%m_%d_%H_%M")

DATABASES_CONFIG_FILE="/home/bfnadmin/databases.csv"

S3_ENDPOINT="https://my-s3-storage.com"
S3_BUCKET="s3://sql-backups"

TEMP_BACKUP_DIR="backups"

while read HOST USERNAME PASSWORD DB_SRV DB_NAME;
do
echo "[$DB_SRV - $DB_NAME]"

mysqldump --single-transaction --quick --lock-tables=false \
-h $HOST \
-u $USERNAME \
-p$PASSWORD \
$DB_NAME | gzip > $TEMP_BACKUP_DIR/$DB_SRV-$DB_NAME-$NOW.sql.gz

echo "Uploading backup to S3 storage - $DB_SRV-$DB_NAME-$NOW.sql.gz"

aws --endpoint-url=$S3_ENDPOINT s3 cp $TEMP_BACKUP_DIR/$DB_SRV-$DB_NAME-$NOW.sql.gz $S3_BUCKET

rm $TEMP_BACKUP_DIR/$DB_SRV-$DB_NAME-$NOW.sql.gz

echo -e "\n\n"

done < $DATABASES_CONFIG_FILE

~/ .aws/credentials

[default]
aws_access_key_id=xxx
aws_secret_access_key=yyy

databases.csv

ip_Address,sql_user,sql_password,Host_Display_name,DB_Name