Monday, March 28, 2016

Repair Win 8 Boot / migrate to SSD

I've spent a lot of time trying to get my Windows 8 PC to boot again after cloning to a new SSD and try to summarise how I finally got it all working -
Firstly, boot from a UEFI Windows 8 recovery disk (CD/DVD/USB) - I found that the automated recovery process didn't find the correct Windows partition, nor when I managed to add it to BCD settings would it make it reliably bootable e.g. using BCDEDIT I got it to find and launch the Windows partition but it refused to cold boot or would not "keep" the settings after a 2nd reboot or power off.
Go into the Advanced options and run the Command Prompt.
Enter diskpart to use the DiskPart tool to ensure you have all the right partitions and to identify your EFI partition - the key thing here is that your EFI partition is formatted as FAT32:
DISKPART> sel disk 0

Disk 0 is now the selected disk.

DISKPART> list vol

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1     C                NTFS   Partition    195 GB  Healthy    Boot
  Volume 2         WINRE        NTFS   Partition    400 MB  Healthy    Hidden
  Volume 3                      FAT32  Partition    260 MB  Healthy    System
Then assign a drive letter to the EFI partition:
DISKPART> sel vol 3

Volume 3 is the selected volume.

DISKPART> assign letter=b:

DiskPart successfully assigned the drive letter or mount point.
Exit DiskPart tool by entering exit and at the command prompt run the following:
cd /d b:\EFI\Microsoft\Boot\

bootrec /fixboot
Delete or rename the BCD file:
ren BCD BCD.bak
Use bcdboot.exe to recreate BCD store:
bcdboot c:\Windows /l en-gb /s b: /f ALL
The /f ALL parameter updates the BIOS settings including UEFI firmware/NVRAM, /l en-gb is to localise for UK/GB locale. The localisation defaults to US English, or use en-US.
Reboot and cross your fingers.
This gave me headaches. I was going in circles for a long while. There isn't a lot of reliable info about fixing UEFI/Windows 8 at the time of writing.
[EDIT]
To re-enable Hyper-V, I also had to run the following from an Administrator Command Prompt within Windows after rebooting:
bcdedit /set {default} hypervisorlaunchtype Auto
bcdedit /set {default} nx OptIn
http://superuser.com/questions/460762/how-can-i-repair-the-windows-8-efi-bootloader

Wednesday, November 26, 2014

Monday, June 30, 2014

OpenWRT - Mount rootfs on External Storage

Unable to install more software on OpenWRT ? Below is how to extend the storage using USB drive.

1. What is need :
-OpenWRT Router with USB port
-Any USB Storage

2. opkg update
opkg install kmod-fs-ext4 kmod-usb-storage-extras block-mount

3. Create new partition on USB storage using gparted, 1st partition is Swap partition 64M ( size is depend on your router model, usually mem size x2), 2nd partition is ext3 partition.

4. Duplicate the rootfs to USB storage
root@OpenWrt:/etc/config# mkdir /mnt/usb
root@OpenWrt:/etc/config# mount /dev/sda2 /mnt/usb/
root@OpenWrt:/etc/config# mkdir /tmp/root
root@OpenWrt:/etc/config# mount -o bind / /tmp/root
root@OpenWrt:/etc/config# cp /tmp/root/* /mnt/usb -a
root@OpenWrt:/etc/config# umount /tmp/root/
root@OpenWrt:/etc/config# ls /mnt/usb/


5. Edit the fstab using ssh terminal / putty and add configs below.
# vi /etc/config/fstab
config 'mount'
        option 'target' '/mnt/usb'
        option 'device' '/dev/sda2'
        option 'fstype' 'ext3'
        option 'options' 'rw,sync'
        option 'enabled' '1'
        option 'is_rootfs' '1'
        option 'enabled_fsck' '1'
           
config 'swap'                    
        option 'device' '/dev/sda1'
        option 'enabled' '1'


6. reboot & verify


Friday, June 27, 2014

OpenVPN Server with ACS SmartCard

This is note on how to configure OpenVPN server with smartcard (PKCS11), with window client.

1. Install OpenVPN server, please refer HERE

2. Generate cert for client :
# ./build-key-pkcs12 client2
Generating a 1024 bit RSA private key
........................++++++
....................................++++++
writing new private key to 'client2.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [MY]:
State or Province Name (full name) [KL]:
Locality Name (eg, city) [Petaling Jaya]:
Organization Name (eg, company) [Test]:
Organizational Unit Name (eg, section) [server]:
Common Name (eg, your name or your server's hostname) [client2]:
Name [server]:
Email Address [me@test.com]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'MY'
stateOrProvinceName   :PRINTABLE:'KL'
localityName          :PRINTABLE:'Petaling Jaya'
organizationName      :PRINTABLE:'Test'
organizationalUnitName:PRINTABLE:'server'
commonName            :PRINTABLE:'client2'
name                  :PRINTABLE:'server'
emailAddress          :IA5STRING:'me@test.com'
Certificate is to be certified until Jun 21 13:06:42 2024 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Enter Export Password:
Verifying - Enter Export Password:

copy all client2* file to window that installed ACS Cert Management Utility.

3. Import the client cert
3.1 plug the smartcard reader and login
3.2 Action  > Certificate Manager
3.3 Click import , select file that you copy just now. e.g client2.p12
3.4 When prompt to enter export password, enter the password enter during generate the cert, DO NOT LEAVE BLANK.


4. Install and Configure OpenVPN client.(without install gui)
4.1 download http://ovpnppc.ziggurat29.com/files/openvpn-gui-1.0.3-pkcs11.src.zip gui, this version will prompt  the pkcs11 pin where the official site verion won't.

4.2 Locate the middleware by the smartcard provider, my case is :
"C:\Program Files\Advanced Card Systems Ltd\ACOS5-CryptoMate Admin Client Kit\Mid dleware\x86\PKCS\>acospkcs11.dll"

4.2 Find the Serialized id.
openvpn --show-pkcs11-ids C:\Program Files\Advanced Card Systems Ltd\ACOS5-CryptoMate Admin Client Kit\Mid
dleware\x86\PKCS\acospkcs11.dll

The following objects are available for use.
Each object shown below may be used as parameter to
--pkcs11-id option please remember to use single quote mark.

Certificate
       DN:             C=MY, ST=KL, L=Petaling Jaya, O=Test, OU=server, CN=xp3,
name=server, emailAddress=me@test.com
       Serial:         04
       Serialized id:  Advanced\x20Card\x20Systems\x20Ltd\x2E/CTM64/603868942
/ACS\x20Card\x20OS\x205/F8892A3678F75A7E586BFBEF805F3CA80DD2



4.3  Add PKCS provider to openvpn config file

pkcs11-providers C:\Program Files\Advanced Card Systems Ltd\ACOS5-CryptoMate Admin Client Kit\Mid
dleware\x86\PKCS\acospkcs11.dll
pkcs11-id     'Advanced\x20Card\x20Systems\x20Ltd\x2E/CTM64/603868942
/ACS\x20Card\x20OS\x205/F8892A3678F75A7E586BFBEF805F3CA80DD2'


5. Run openvpn-gui and connect.



Wednesday, June 25, 2014

FB Invite all friends js script


elms=document.getElementById('fbpage_invite_audience_action_finch').getElementsByTagName('button');for(var fid in elms){if(typeof elms[fid] === 'object'){(elms[fid]).click();}}


Steps:

1. Launch Mozilla and load the Pages.

2.  Under invite friend click "See all friends"

3. Press F12 on keyboard > click on "Console" tab.

4. Paste the script above to console >>

5. Scroll down the friends list and repeat step 4.

Wednesday, June 11, 2014

Bluetooth module for old multimedia speaker


This is about how to adding Bluetooth feature to your old multimedia speaker.


Old phone charger with 5v output.


This AC-DC converter

Connect the phone charger board to 220AC on the speaker board

USB Bluetooth module


Connect the 5v output to Bluetooth USB input (pin 1(+) and pin 4 (-).

Connect the Bluetooth Aux out to speaker Aux input, above is Edifier R202 board.


Manually iron the AC input to phone charger board


Wrap the high voltage circuit for safely!!


Glue the charger board to panel


Glue the Bluetooth beside the charger board

Bluetooth speaker!!


Note: your speaker aux will not function properly because the bluetooth module will draw the power from it, if you want have both work you need extra switch to switch between Aux or bluetooth.

NiMh Charger Disassemble


This post is to dissemble NiMH charger to inspect the build quality, I only have 3 units, 2 from GP and 1 from unknown china brand. 

GP Fast Charge

China brand cheap charger

China brand cheap charger overview



Below 3 pictures is GP 4 position charger. 





Tuesday, June 10, 2014

Bash script to adjust laptop LCD backlight

##!/bin/bash

export blval=`sudo intel_backlight |awk '{print $4}' |sed 's/%//g'`
if  test "$1" = "up"
then
        echo "currrent val : $blval"
        export blval=`expr $blval + 10`
        echo "increase to $blval"
elif test "$1" = "down"
then
        echo "currrent val : $blval"
        export blval=`expr $blval - 10`
        echo "decrease to $blval"


else
        echo  "e.g adj_backlight.sh [ up | down ]"
fi

sudo intel_backlight $blval
exit

Tuesday, April 22, 2014

How to Setup and Configure an OpenVPN Server on CentOS 6

How to Setup and Configure an OpenVPN Server on CentOS 6


Introduction


This article will guide you through the setup and configuration of OpenVPN server on your CentOS 6 cloud server. We will also cover how to configure your Windows, OS X, or Linux client to connect to your newly installed OpenVPN server.

Before we begin, you'll need to have the Extra Packages for Enterprise Linux (EPEL) Repository enabled on your cloud server. This is a third party repository offered by the Fedora Project which will provide the OpenVPN package.
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

Initial OpenVPN Configuration


First, install the OpenVPN package from EPEL:
yum install openvpn -y

OpenVPN ships with only a sample configuration, so we will copy the configuration file to its destination:
cp /usr/share/doc/openvpn-*/sample-config-files/server.conf /etc/openvpn

Now that we have the file in the proper location, open it for editing:
nano -w /etc/openvpn/server.conf

Our first change will be to uncomment the "push" parameter which causes traffic on our client systems to be routed through OpenVPN.
push "redirect-gateway def1 bypass-dhcp"

We'll also want to change the section that immediately follows route DNS queries to Google's Public DNS servers.
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

In addition, to enhance security, make sure OpenVPN drops privileges after startup. Uncomment the relevant "user" and "group" lines.
user nobody
group nobody

Generating Keys and Certificates Using easy-rsa


Now that we've finished modifying the configuration file, we'll generate the required keys and certificates. As with the configuration file, OpenVPN places the required scripts in the documentation folder by default. Create the required folder and copy the files over.
mkdir -p /etc/openvpn/easy-rsa/keys
cp -rf /usr/share/openvpn/easy-rsa/2.0/* /etc/openvpn/easy-rsa

With the files in the desired location, we'll edit the "vars" file which provides the easy-rsa scripts with required information.
nano -w /etc/openvpn/easy-rsa/vars

We're looking to modify the "KEY_" variables, located at the bottom of the file. The variable names are fairly descriptive and should be filled out with the applicable information.

Once completed, the bottom of your "vars" file should appear similar to the following:
export KEY_COUNTRY="US"
export KEY_PROVINCE="NY"
export KEY_CITY="New York"
export KEY_ORG="Organization Name"
export KEY_EMAIL="administrator@example.com"
export KEY_CN=droplet.example.com
export KEY_NAME=server
export KEY_OU=server

OpenVPN might fail to properly detect the OpenSSL version on CentOS 6. As a precaution, manually copy the required OpenSSL configuration file.
cp /etc/openvpn/easy-rsa/openssl-1.0.0.cnf /etc/openvpn/easy-rsa/openssl.cnf

We'll now change into our working directory and build our Certificate Authority, or CA, based on the information provided above.
cd /etc/openvpn/easy-rsa
source ./vars
./clean-all
./build-ca

Now that we have our CA, we'll create our certificate for the OpenVPN server. When asked by build-key-server, answer yes to commit.
./build-key-server server

We're also going to need to generate our Diffie Hellman key exchange files using the build-dh script and copy all of our files into /etc/openvpn as follows:
./build-dh
cd /etc/openvpn/easy-rsa/keys
cp dh1024.pem ca.crt server.crt server.key /etc/openvpn

In order to allow clients to authenticate, we'll need to create client certificates. You can repeat this as necessary to generate a unique certificate and key for each client or device. If you plan to have more than a couple certificate pairs be sure to use descriptive filenames.
cd /etc/openvpn/easy-rsa
./build-key client

Routing Configuration and Starting OpenVPN Server


Create an iptables rule to allow proper routing of our VPN subnet.
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
service iptables save

Then, enable IP Forwarding in sysctl:
nano -w /etc/sysctl.conf

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

Finally, apply our new sysctl settings. Start the server and assure that it starts automatically on boot:
sysctl -p
service openvpn start
chkconfig openvpn on

You now have a working OpenVPN server. In the following steps, we'll discuss how to properly configure your client.

Configuring OpenVPN Client


Now that your OpenVPN server is online, lets configure your client to connect. The steps are largely the same regardless of what operating system you have.

In order to proceed, we will need to retrieve the ca.crt, client.crt and client.key files from the remote server. Simply use your favorite SFTP/SCP (Secure File Transfer Protocol/Secure Copy) client and move them to a local directory. You can alternatively open the files in nano and copy the contents to local files manually. Be aware that the client.crt and client.key files will are automatically named based on the parameters used with "./build-key" earlier. All of the necessary files are located in /etc/openvpn/easy-rsa/keys
nano -w /etc/openvpn/easy-rsa/keys/ca.crt
nano -w /etc/openvpn/easy-rsa/keys/client.crt
nano -w /etc/openvpn/easy-rsa/keys/client.key

With our certificates now on our client system, we'll create another new file called client.ovpn, where "client" should match the name of the client being deployed (from build-key), the contents should be as follows, substituting "x.x.x.x" with your cloud servers IP address, and with the appropriate files pasted into the designated areas. Include only the contents starting from the "BEGIN" header line, to the "END" line, as demonstrated below. Be sure to keep these files as confidential as you would any authentication token.
client
dev tun
proto udp
remote x.x.x.x 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
<ca>
Contents of ca.crt
</ca>
<cert>
Contents of client.crt
</cert>
<key>
Contents of client.key
</key>

As all of the required information to establish a connection is now centralized in the .ovpn file, we can now deploy it on our client system. On Windows, regardless of edition, you will need the official OpenVPN Community Edition binaries which come prepackaged with a GUI. The only step required post-installation is to place your .ovpn configuration file into the proper directory (C:\Program Files\OpenVPN\config) and click connect in the GUI. OpenVPN GUI on Windows must be executed with administrative privileges.

On Mac OS X, the open source application "Tunnelblick" provides an interface similar to OpenVPN GUI on Windows, and comes prepackagd with OpenVPN and required TUN/TAP drivers. As with Windows, the only step required is to place your .ovpn configuration file into the ~/Library/Application Support/Tunnelblick/Configurations directory.

On Linux, you should install OpenVPN from your distributions official repositories. You can then invoke OpenVPN by simply executing:
sudo openvpn --config ~/path/to/client.ovpn

Congratulations! If you made it this far you should now have a fully operational VPN running on your cloud server. You can verify that your traffic is being routed through the VPN by checking Google to reveal your public IP.

[src:https://www.digitalocean.com/community/articles/how-to-setup-and-configure-an-openvpn-server-on-centos-6]
.

Sunday, September 22, 2013

Ubuntu slow connection with Atheros AR9485

Took the latest snapshot from https://www.kernel.org/pub/linux/kernel/projects/backports/ +  ran make defconfig-ath9k && make && sudo make install. Hopefully the patches will get in soon enough, so that I don't need to rerun the module building every time kernel updates.


[src: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/971809/comments/63]

Monday, July 29, 2013

FreeNAS Resize Root Partition

FreeNAS designed to fix into sdcard, the default root partition only come with 1GB, it's insufficient if you try install mediatomb + transcoder. Below is steps on how to resize the root partition of FreeNAS.
Before proceed, boot into option 4 (single user mode) for all steps below.

1. )  Add another disk to NAS machine or virtual disk if running on VM.

2. )  Backup the current partitions for reference, type:
# gpart backup da0
<da0> is the geom label, your case may difference.

3. ) Backup all partition to new added disk.
# dd if=/dev/da0s1 of=<new disk path>/da0s1
# dd if=/dev/da0s2 of=<new disk path>/da0s2
# dd if=/dev/da0s3 of=<new disk path>/da0s3
# dd if=/dev/da0s4 of=<new disk path>/da0s4

4. ) Delete and re-create the partition so that we have the free space for 1st partition.

# gpart show da0
=>      63  18874305  da0  MBR  (9.0G)
        63  1930257    1  freebsd  [active]  (942M)
  1930320   1930257    2  freebsd  (942M)
  3860577      3024    3  freebsd  (1.5M)
  3863601     41328    4  freebsd  (20M)
  3904929       14969376       - free -  (7.1G)

# gpart delete -i 4 da0

you need calculate the start index of your last partition, your last partition index should be 18874305 - 128 - 41328.

# gpart add -t freebsd -b 18832849 -s 41328 da0

5. ) Repeat step 4. for partition 3 and 2. You should get something like below
# gpart show da0
=>      63  18874305  da0  MBR  (9.0G)
        63  1930320    1  freebsd  [active]  (942M)
  1930383       14969241       - free -  (7.1G)
  16899624   1930257    2  freebsd  (942M)
  18829881      3024    3  freebsd  (1.5M)
  18832905     41328    4  freebsd  (20M)

6. ) Restore the partition 2,3 and 4.
# dd of=/dev/da0s2 if=<new disk path>/da0s2
# dd of=/dev/da0s3 if=<new disk path>/da0s3
# dd of=/dev/da0s4 if=<new disk path>/da0s4

7. )  Resize root partition
# gpart resize -i 1 da0

8. ) Correct the label
# bsdlabel /dev/da0s1
# /dev/da0s1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:   1930241         16    unused        0     0  
  c:   1930257          0    unused        0     0     # "raw" part, don't edit

Edit the label to correct size.
#  gpart show da0
=>      63  18874305  da0  MBR  (9.0G)
        63  16899561    1  freebsd  [active]  (8.1G)
  16899624   1930257    2  freebsd  (942M)
  18829881      3024    3  freebsd  (1.5M)
  18832905     41328    4  freebsd  (20M)
  18874233       135       - free -  (67k)

 Mine da0s1 size is 16899561, I edit my label as below:
# /dev/da0s1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:   16899545         16    unused        0     0   
  c:   16899561          0    unused        0     0     # "raw" part, don't edit


9. ) Now grow the file system
# growfs /dev/da0s1a

10. ) Reboot the machine and you will find that the root / not able to mount
type ufs:/dev/da0s1a to mount root.

11. ) Correct the mount path for root /
# mount -uw /
# vi /conf//base/etc/fstab
change /dev/ufs/FreeNASs1a / ufs ro 1 1
to /dev/da0s1a / ufs ro 1 1

12.) Reboot and done.




Tuesday, July 23, 2013

Android - DBHelper

Android using Sqlite as primary storage for android application, below is the sample code for create, upgrade or delete database.


Usually you will require to create one Helper for 1 database, we create our first helper class name "DBHelper", this class extends SQLiteOpenHelper and you need implement at least 2 methods


  • onCreate()
  • onUpgrade()
Always create only single instance for any DBHelper to avoid open & close connection of DB.


   public static DBHelper getInstance() {
        if(instance == null) {
            instance = new UserDatabaseHelper();
        }
        return instance;
    }



After install and start the app, verify if the db created.

root@android:/data/data/com.androidtutorial/databases # ls
Songs.db
Songs.db-journal
e3 Songs.db                                                                   <
SQLite version 3.7.16 2013-03-18 11:39:23 [www.ptsoft.org] [www.ptdave.com]
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Songs             android_metadata
sqlite> select * from Songs;
sqlite> select * from Songs;
song1
sqlite> 


The songs.db is created.


One confusing about onUpgrade, if you upgrade the db version from 2~10, don't expect onUpgrade will handle for you, you need do some checking as below.

   @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.d(TAG, "onUpgrade ..." + oldVersion ); 
        oldVersion += 1;
        if(oldVersion < newVersion) {
            onUpgrade(db, oldVersion, newVersion);
        }
    }



Thursday, May 9, 2013

JNI Detaching threads (native thread exited without detaching)


Attached thread must detact before the thread exit, when involved in Android JNI programming plus dealing with multithread usually you will facing problem like "threadid=41: native thread exited without detaching". To solved this problem is possible when use 'pthread_key_create', below is how to implement.


1. We need register a function pointer do detach the thread during JNI_Onload(), function 'detach_current_thread' will called during thread exit.

static void detach_current_thread (void *env) {
  (*java_vm)->DetachCurrentThread (java_vm);
}

jint JNI_OnLoad(JavaVM *vm, void *reserved) {
  JNIEnv *env = NULL;
  java_vm = vm;
  if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
    return 0;
  } 
  pthread_key_create (&current_jni_env, detach_current_thread);
  return JNI_VERSION_1_4;
}



2. During callback to Java, we check the current_jni_env if initialized. 

static JNIEnv *get_jni_env (void) {
JNIEnv *env;
if ((env = pthread_getspecific (current_jni_env)) == NULL) {
env = attach_current_thread ();
pthread_setspecific (current_jni_env, env);
}
return env;
}

if current_jni_env is NULL, will attach thread to VM.


That all you need to solved the "thread exited without detaching" because pthread will call detach_current_thread before exit.




Wednesday, April 24, 2013

Configure Time Zone for CentOS

$ yum install ntp -y

find out your timezone, as my case I used SGT. (/usr/share/zoneinfo/Asia/Singapore)
$ ll /usr/share/zoneinfo
$ chkconfig ntpd on
$ /etc/init.d/ntpd start

sync the time manually
$ ntpdate pool.ntp.org

Ubuntu Relaying Postfix SMTP (gmail)


The purpose is to sent mail through my Linux laptop with mailutils...

1. # apt-get install postfix

2. Edit /etc/postfix/main.cf by edit any exist entry as below values:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

3. Saved your gmail authentication info to  /etc/postfix/sasl_passwd  as below:
[smtp.gmail.com]:587    user.name@gmail.com:password

4. Change permissions 
#sudo chmod 400 /etc/postfix/sasl_passwd
#sudo postmap /etc/postfix/sasl_passwd

5. Tell it where it can validate the certificate.
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

6. Restart & Test
#sudo service postfix restart
# echo 'test' | mail user.name@gmail.com

end.

[ref :https://help.ubuntu.com/community/Postfix]

Thursday, April 18, 2013

SVN merge between trunk & branch

Branched out 'branch_xxx' for feature AA, after branch out 'trunk' is continue changes, now need all changes on 'trunk' merge to 'branch_xxx'.

1. Find out the version since branch_xxx copy.
    svn log -v --stop-on-copy

<comment>
------------------------------------------------------------------------
r503 | <user> | 2013-03-06 10:56:01 +0800 (Wed, 06 Mar 2013) | 1 line

2. svn merge -r 503:519  svn+ssh://user@svnurl/var/local/svn/proj/trunk
ver 519 is trunk latest ver, you might have some conflicts need to resolve.

3. svn ci -m "comment"

Friday, April 5, 2013

Enable flash player for Chromium on Ubuntu


    1  sudo apt-get install flashplugin-nonfree
    2  sudo cp /usr/lib/flashplugin-installer/libflashplayer.so /usr/lib/chromium-browser/plugins
    3  chromium-browser --enable-plugins

Tuesday, April 2, 2013

SSH to ESXi host with public key

cat ~/.ssh/id_rsa.pub | ssh root@esxi.local 'cat >> /etc/ssh/keys-root/authorized_keys'

Wednesday, March 6, 2013

Wash machine need maintenance ? YES!

Wash machine need maintenance ? YES!


I buy the wash machine 3 years ago, last month I buy some chlorine bleach to clean it. The result is bad, I can't use the wash machine anymore because there is a lot small piece of dust leak out and attache on my cloths. 

So I decided to disassemble the wash machine to clean up the dust inside, below is some pictures.



Before cleaning


After clean up

So clean you wash machine today or buy a new one. :)