Posts

Don't use static field for object when coding Android app

This might save your time:  Don't use static field for object when coding Android app Static methods are OK, create private field or local variable for object and pass it as parameter.

Choosing good USB cable and charge faster

Ever wondering why sometime your phone charges very slow, even using 1A charger. Check the cable! If are using android lollipop, check charging power using Ampere from play store. You can probably see some printed codes on the good quality USB cable, including something like this: "28AWG/2C and 24AWG/2C" or "28AWG/1P + 24AWG/2C". Therefore, charging with a "28AWG/1P + 28AWG/2C" USB cable is normally slower than a "28AWG/1P + 24AWG/2C" cable. Source: http://voyager8.blogspot.com/2013/04/how-to-choose-good-usb-data-and.html?m=1

Email scripts collection (1)

Delete old postmaster email: find /home/vmail/*/postmaster@*/{new,cur} -type f -mtime +30 -delete Delete old trash: find /home/vmail/*/*/.Trash/{new,cur} -type f -mtime +30 -delete Move sent messages to zip: find /home/vmail/*/*/.Sent*/{new,cur} -type f -mtime +30 | zip -m -9 /home/vmail/Sent.zip -@ Move old email to zip: find /home/vmail/domain.com/ -type f -mtime +365 -print | file -F# -if- | grep -E 'rfc822|octet' | awk -F# '{print $1}' | zip -m -9 /home/vmail/Old.zip -@ Update quota2: cd /home/vmail/domain.com du -s * | awk '{ print "insert into quota2 values (\"" $2 "\"," $1 "*1000,1000) on duplicate key update bytes=" $1 "*1000;" }' | mysql -uroot -ppaswot postfixadmin Learn spam from folder Spam: poll mail.domain.com with proto IMAP user 'email@domain.com' there with password 'paswot' folder INBOX.Spam options ssl sslfingerprint 'FB:9D:14:94:FD:F...

Applying patch from remote fork (github)

Find which commit you want to patch, for example: https://github.com/waalt/yowsup/commit/2a56d2c25e53b37221190185c5ffd0eb543bb73f Append ".patch" to URL: https://github.com/waalt/yowsup/commit/2a56d2c25e53b37221190185c5ffd0eb543bb73f.patch Run this to apply: curl https://github.com/waalt/yowsup/commit/2a56d2c25e53b37221190185c5ffd0eb543bb73f.patch | git apply Reference: http://transparatech.com/blog/how-use-git-apply-patch-directly-remote-server-without-downloading-it-first-0

Make firefox faster

After using Mozilla Firefox for a long time, it become slow. Try Clear Cache , and set Cache limit to 50 MB