Friday, January 31, 2014

Photoshop CS make a rounded corner of image

- Select the whole image by pressing CTRL+A or Select->All from the menu. 

- Round the selection by selecting Select->Modiy->Smooth from the menu, a small dialog appears. 

- Enter a value, the more the value you enter, the more smooth the edge become. 

- Now choose Select->Inverse from the menu, the selection get inverted. 

- Make sure the layer(s) you want its edges rounded is selected, then press Delete. 

Congratulation, you made your first rounded corner.

Sunday, January 12, 2014

Backup (mysql dump) all your MySQL databases in separate files

Below is Shell script that backup all your database daily:

#!/bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/home/backup/$TIMESTAMP"
MYSQL_USER="root"
MYSQL_PASSWORD="*******"
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p $BACKUP_DIR
databases=`$MYSQL -u$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`
for db in $databases; do
echo $db
$MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --databases $db | gzip > "$BACKUP_DIR/$db.gz"
done