How to change timezone in ubuntu

To change timezone in ubuntu, just use that in terminal:

sudo dpkg-reconfigure tzdata

How to survive with AWS EC2 T1.Micro instance

amazon-ec2

With my t1.micro, i can host my personal redmine, git and blog. But i couldn’t do that with default settings.

I have used swap on file to it and here is how you can do it:

Copy & paste the code below:

sudo su -c '

dd if=/dev/zero of=/var/swapfile bs=4096 count=524288

chown root:root /var/swapfile
chmod 0600 /var/swapfile
mkswap /var/swapfile
swapon /var/swapfile
echo "/var/swapfile none swap sw 0 0" >> /etc/fstab
'

To disable you can use:

sudo swapoff -v /var/swapfile
sudo rm /var/swapfile
sudo sed -i '/swapfile/d' /etc/fstab

 

Zabbix

Very cool tool for sysadmins! Check it out! 🙂 http://www.zabbix.com/

Android Virtual Device (aka AVD) tunning

In order to make the Android emulator run faster and be more responsive, you can configure it to take advantage of hardware acceleration, using a combination of configuration options, specific Android system images and hardware drivers…

My AVD API 18 config have intel processor, 768 RAM + 128MB VM Heap + Host GPU + Intel HAXM
My AVD API 10 config have intel processor, 768 RAM + 128MB VM Heap + Intel HAXM

CLI Database optimization

MariaDB & MySQL:

sudo apt-get install mysql-client
mysqlcheck -h yourdatabasehost -u root -p –auto-repair –check –all-databases
mysqlcheck -h yourdatabasehost -u root -p –auto-repair –optimize –all-databases

PostgreSQL:

vacuumdb -afvz -h yourdatabasehost -u postgres
reindexdb -a -h yourdatabasehost -u postgres

Amazon Web Services – Free Tier

How to get started with AWS free?
Just go to http://aws.amazon.com/free/ and make your account.
Credicard will be needed even for a free account.

What can be done with the free account?
It’s up to you! If you are going to make a light traffic website free tier can handle it. 🙂

You can have up to two EC2 instances (1 Linux, 1 Windows) with 613M Ram and up to 30GB EBS Size. You can go with all your 30GB on a Linux instance it’s the best way to spend your ‘free’ resources. (Windows is memory hungry.)

You can have up to one RDS instance (postgres, mysql, …) with 20GB of DB storage and 20GB for backups.

You can have up to one S3 with 5GB of storage with up to 20k put and 20k get requests.

You can have up to one Memcached server with 213MB

And some more things (ELB, DynamoDB, SNS, CloudWatch, …)

Continue reading

Check you website performance

WebPageTest, GTmetrix, PageSpeed Insights and Website Grader can test your website and your webserver and helps you to see if you are using optimal configurations!

GNU/Linux cli image optimizer

There are some benefit from lossless recompression utilizing optipng for PNGs, gifsicle for GIFs and jpegoptim for JPGs. Optimized graphics transfer faster and provide a faster perceived response for clients. The following example will recursively optimize (without any loss of quality) all the graphics and image files on a server with the above commands installed and available.

ubuntu:

sudo apt-get install optipng gifsicle jpegoptim imagemagick

Then execute this lines where you want to optimize your files. Remember to use the same owner user of those images.

find . -iname *.png -exec optipng -o7 --strip all {} \;
find . -iname *.gif -exec gifsicle -O2 -b {} \;
find . -iname *.jpg -exec jpegoptim --strip-all --max=85 {} \;
find . -iname *.jpg -exec convert -interlace line -quality 80 {} {} \;

For WordPress, you can install EWWW Image Optimizer or WP Smush.it

Source: Moodle