Category Archives: technology

How to use 2 numbers for whatsapp

I have 2 numbers and both are using whatsapp. The problem with this is I have to carry 2 devices (smart phones) every where I go.

There are solutions to this by root your device and install some app that can cater for 2 numbers. But the solution is not that practical.

What I do is to use web.whatsapp.com to open both numbers. One is opened in Google Chrome. Another one is set to be opened in Firefox browser.

So when I’m working on my notebook (most of the time), it is very easy for me to check both whatsapp messages for both numbers.

Google spreadsheet – function to split comma separated string to few lines

Face this problem to split address to few lines for printing purpose.

Example address:

No. 1 Road 2, Happy Park, 43800 Big Town, My State

to

No. 1 Road 2,
Happy Park,
43800 Big Town,
My State

Just use this function besides the cell.

=SUBSTITUTE(A1, ",", char(10))

Replace A1 with the cell number.

Another related function is SPLIT.

Setting up Gmail to receive and reply email from other email

Steps to set up

  1. to receive email from x email in gmail (forward)
  2. reply from gmail using that x email address

A. Setting up the forwarding (example below is from another gmail. If from other emails may be differeent. e.g. from zoho mail)

  1. Go to Settings > Forwarding and POP/IMAP
  2. Click on “Add a forwarding address”
  3. Complete the process

B. Setting up to reply via gmail

  1. Add account
    1. Settings > Accounts
    2. Click on “Add another email address you own”
    3. Fill up the forms
    4. Verify the email address by clicking on the link sent

 

DigitalOcean – Notes

This is my notes on digital ocean.

Click here to register with DigitalOcean and get free USD10 to start using the service.

I used to install Ubuntu 14.04 with LAMP on it. With this also get SFTP ready.

Manage users and groups

Change root password. If logged in as root

  • passwd

Add new user

  • adduser is perl script to simplify original useradd function
  • command – adduser username_here
  • just answer all questions asked
  • This add user function will …
    • Create the user named username.
    • Create the user’s home directory (default is /home/username and copy the files from /etc/skel into it.
    • Create a group with the same name as the user and place the user in it.
    • Prompt for a password for the user.
    • Prompt for additional information on the user.
  • allow user for sudo mode (optional) – usermod -a -G sudo <your username>
  • add user to group – adduser username groupname
  • more on adduser
  • and more

Manage groups for user

  • list group – cat /etc/group
  • add user to group – adduser usrname groupname

Manage services

Connect to server via SSH, in terminal type the following:

  • ssh username@yourdomain_or_ip

To get default MySQL root password, write this in terminal. Remove the file once done change the MySQL root password.

  • cat /etc/motd.tail

To enter mysql console

  • mysql -u root -p

Secure MySQL server. Run following command and answer all the questions.

  • mysql_secure_installation

To change MySQL root password:

  • mysqladmin -u root -p’oldpassword’ password newpass

To only allow certain IP to access directly to database

  • edit file /etc/mysql/my.cnf
  • comment line with IP 127.0.0.1
  • restart service – service mysql restart
  • enter following command in mysql command line
    • type mysql -u root -p
    • enter password when asked
  • mysql> GRANT ALL ON database_name.* TO user@xx.xxx.xx.xx IDENTIFIED BY ‘your_password’;
    • xx.xxx.xx.xx is the remote IP to access the server

Enable .htaccess (mod rewrite)

  • enable mod rewrite – sudo a2enmod rewrite
  • update file /etc/apache2/apache2.conf
  • change Override none to Override all for web root directory
  • restart service

To restart services (can also use stop and start)

  • service mysql restart
  • service apache2 restart

Install sendmail service (used by PHP mail function)

  • apt-get install sendmail
  • Run the sendmail config and answer ‘Y’ to everything: sendmailconfig

Server general settings

Change permission for directory (especially for ‘upload’ directory)

  • chmod 755 /path/directorypath

Change the timezone. By default using US time zone

  • sudo dpkg-reconfigure tzdata
  • follow instruction on screen
  • check if the date is correct by typing – date

To turn off server

  • sudo shutdown -h now
  • OR
  • sudo poweroff

Check for disk utilization

  • to check for disk utilization
    • df -h
  • to check for huge files location
    • sudo du -a / | sort -n -r | head -n 10
  • check for huge file (another option)
    • find / -size +50M -ls

Securing the server

To update/upgrade OS

  • aptitude update
  • aptitude upgrade

Disable root login on SSH

  • edit /etc/ssh/sshd_config
  • set PermitRootLogin no
  • restart ssh – service ssh restart

Block IP’s from accessing certain services

Other measures:

  1. Disallow access to server via root username
  2. Disallow access directly to database from outside
  3. Close all unused ports. Left only web, SFTP, MySQL, SSH
  4. auto patch?

To explore

  • using VPN
  • using SSH key
  • creating ftp user to access only certain directory
  • virtual host (multiple domains for a server)
  • security for 777 chmod directory
  • change ssh port to different port (but still below 1024)
  • install fail2ban to protect against brute force attack

Additional tools

  1. Ansible.com
  2. Docker.com

Other reading and references

  1. Securing the server (SSH, VPN etc)
  2. Initial setup for Ubuntu 14.04

Editors

vi, vim, nano

Click here to register with DigitalOcean and get free USD10 to start using the service.

List of payment gateway

Below are the list. Haven’t had time to review in details. Some for Malaysia, some other from outside but used by many countries including Malaysia.

Old players

  • ipay88.com
  • molpay.com
  • paypal.com (outside) – 3.9% + rm2 per transaction
  • 2checkout (outside)
  • senangpay.my – rm300/yr subscription, 2.5% for credit card, 1.5% for FPX
  • billplz.com – free registration, rm1.50 per transaction. no credit card
  • jompay.com.my (by BNM subsidiary)

Problem with Chromecast connecting to D-link 615 Router

This has been a long-dragging problem for me. As for record, here I list all possible solutions suggested by people from various sources

  1. change wireless settings to
    1. single mode N only,
    2. WPA2 only,
    3. AES (instead of TKIP) only
  2. flash rom with DDWRT (haven’t tried, please be careful with this)
    1. anyway, a comment from a forum: Flashing DDWRT isn’t too hard, just download a file and upload via the web interface. Just make sure you get the right file and read the instructions a few times all the way through before you attempt it
    2. extra reading DDWRT on lifehacker
    3. comment from forum also: is it pretty much: hard reset, upload factory firmware, hard reset, upload current firmware? That’s pretty much it. It’s actually only 15mins work
    4. list of routers that can install DDWRT. Seems that  mine can’t – D-Link G2
  3. purchase a new router that is proven compatible with chromecast (especially in your country/area). For example Asus RT-AC68U, TP-LINK TL-WR1043ND
    1. unifi router list
    2. unifi router list 2

Wireless settings can be found at

  1. Setup (top bar) > wireless setup (left bar) > manual wireless connection set up
  2. Advanced (top bar) > advanced wireless (left bar)
  3. IP for router normally http://192.168.0.1 (or http://192.168.1.1)
  4. Username: admin. Password: (just leave empty)

Other sources

  1. Chromecast compatible router list (D-link 615 firmware version 5.1 listed there. My version is G2 firmeware version 7.19)
  2. Forum 1
  3. Forum 2 – DDWRT solution

Update: My solution as at 2015-12-21:

Purchased a HDMI cable extension M and F ends 1.5 meters. Make the chromecast device out from back of the TV to get stronger wireless signal. Solved.

 

Cloud hosting

There are more cloud hosting offered by big boys. Normally they themselves use a lot of resources just to host their own applications. And we can also ride on latest and fastest technology they have to host ours as well.

  1. Google – free USD300 for first 6 months on trial
  2. Amazon
  3. Microsoft Azure  – free USD200 for 1 month trial
  4. Alibabacloud – free USD300 for trial

Cheaper alternatives for cloud VPS

  1. Vultr.com – starts from USD2.50/mo
  2. Digitalocean – starts from USD5/mo
  3. Linode – starts with USD5/mo
  4. Heroku (PaaS)