Jan 30, 2019

Regular Expression to check Bhutan Vehicle Number

You can use the following Regular Expression to validate the text field for Bhutan Vehicle using javascript.
[BG]{2}[-][0-9][-][A-Z 0-9]{4,5}

Nov 14, 2017

Get the serial number of a computer using command

Open a command prompt (by choosing the Command Prompt item from the Start menu, or typing cmd in the Start menu's "Run" box), and type the following:

wmic bios get serialnumber

Go to Utilities. Open the Terminal application and type:

ioreg -l | grep IOPlatformSerialNumber
Open a shell and type:

sudo dmidecode -t system | grep Serial
Note: The user will need to have root access to the system.

Oct 13, 2017

Get MySQL Database columns and datatypes

To get database details for specific database under MySQL use the following script. Execute the script in any DB tools like DBeaver etc.

select * from information_schema.columns
where table_schema = 'your_database_name'

May 30, 2016

Enable Dzongkha keyboard on Android 6

The best thing about Android 6.0 for Bhutanese Android phone user was the Dzongkha font support. If you are not getting any official Android 6.0 on your android device then try installing custom ROM like CynogenMod.

I presume that you have Android 6.0 on your device, and now lets enable dzongkha keyboard:

1. Install Multiling O Keyboard from Play Store
2. Launch the Multiling O Keyboard and follow the app screen instruction, then you are done.

May 25, 2016

Install CyanogenMod 13 on Nexus 4

Let me show you how to install CyanogenMod 13 which is build on Android 6.0.1 since Nexus 4 no longer receives update from Google. I will be explaining you using Debian Linux.

Download the latest version of CyanogenMod 13 from Official CyanogenMod website https://download.cyanogenmod.org/?device=mako. I would recommend Stable release only. Make sure to download system image (CyanogenMod Build), recovery image (CyanogenMod Recovery) and Google App from https://wiki.cyanogenmod.org/w/Google_Apps

1. You will need Android SDK platform tool and we will be using fastboot and adb. 

2. Now boot the phone in recovery mode, hold down Volume Down + Power button until bootloader appears, then navigate to Bootloader by clicking volume up/down and select by clicking Power button. 

3. Open terminal and then navigate to folder where you have placed Android SDK platform tools. Type 
sudo ./fastboot oem unlock if your OEM is locked else 
sudo ./fastboot oem lock
sudo ./fastboot oem unlock

4. Now lets erase some partitions like recovery, system, boot, cache and userdata.
sudo ./fastboot erase recovery
sudo ./fastboot erase system
sudo ./fastboot erase boot
sudo ./fastboot erase cache
sudo ./fastboot erase userdata

5. Now lets flash recovery image 
sudo ./fastboot flash recovery cm13xxx-recovery.img

6. Now reboot the phone to Recovery Mode like you did in step 2. 

7. Now select Wipe/Factory Reset and also any wipe option available.

8. So let flash in System Image and Google Apps using adb sideload. Select Apply Update in the recovery mode, and select ABD Sideload

sudo ./adb kill-server
sudo ./adb start-server
sudo ./abd sideload CM13xxx.zip
sudo ./abd sideload open-gappxxx.zip 

9. Now select Reboot System from the recovery mode menu. At first time boot it will take some time, just relax and wait for it to boot.

Now your Nexus 4 will boot in CyanogenMod 13 in turn Android 6.0.1

Nov 5, 2014

CentOS 7 and RHEL 7 new commands

In CentOS 7/RHEL 7 the 'service' command has now been changed to systemctl. Now the command are:
systemctl start sshd.service 
The above line will start sshd service.

systemctl restart sshd
The above line is a short form command.

chkconfig command has also changed.

Now to enable service during boot is:
systemctl enable sshd
To disable service during boot is:
systemctl disable sshd

To check startup list:
systemctl list-unit-files --type=service

Jul 25, 2014

Install Wordpress on CentOS/RHEL

Download the latest version of Wordpress extract the zipped filw.

1. wget http://wordpress.org/latest.tar.gz
2. tar xzf latest.tar.gz

Now assigning to group and setting folder permission.

1. chown -R apache.apache wordpress
2. chmod -R 755 wordpress

Configuring Apache

1. cd /etc/httpd/conf.d/
2. Create a file wordpress.conf
3. wordpress.conf

Alias /wordpress /home/wordpress
<Directory /home/wordpress>
Order allow,deny
Allow from all

4. service httpd restart

Browse at localhost/wordpress it should show you wordpress site.

That's it. You can use the existing mysql connection and connect to wordpress site.

Jul 3, 2014

Druknet PPoE VPI/VCI

If you are using Druknet broadband, following are the VPI and VCI value you need to know when you configure in your Wireless Access Point.

VPI (Virtual Path Identifier) = 0
VCI (Virtual Channel Identifier) = 35

Jun 22, 2014

Update Kali Linux from ISO image with no network

Mount the ISO to /mnt directory
sudo mount -t iso9660 -o loop /path/to/iso /mnt/

Modify the /etc/apt/sources.list
deb file:///mnt kali main contrib non-free

Comment out all other repository locations from the file except the about one.

Update the system
sudo apt-get update
sudo apt-get dist-upgrade

We have now updated the system from the ISO, now we need to un-comment back the official repository locations and comment our newly added ISO repository.

Un-mount the ISO
sudo umount /mnt

Apr 30, 2014

How to connect to remote desktop using linux

Remmina has now been moved to FreeRDP. To connect to remote desktop using freerdp command

sudo  xfreerdp /size:800x600 /u:administrator /v:

with the above command I am connecting to windows server where remote desktop is enabled with the screen resolution 800x600. By default remote desktop works on tcp port 3389.