Sunday, September 29, 2019

Power on/off/reboot Android phone without using power button

Works without rooting the phone.

Power Off and Reboot

In Google Play Store, install app Button Mapper: Remap your keys. Remap one of the volume key to Power Dialogue. You can set Up Volume Long Press to bring up Power Dialogue.

Power On 

It may not work with every phone. Plug in power cable to charge it. When it show a simple charging (flash) icon on screen but not yet showing animated charging picture with percentage, unplug the cable. Wait a while, the phone will boot.

If your phone supports wireless charging, simply put it on charger. It will boot the phone right away.

Tuesday, September 10, 2019

Running Bitcoin Full Node on 10 year old Netbook

Recently installed a fully functioning Bitcoin Full Node on a ten year old Asus Eee PC 900HA. The hardware and software are lower than official requirement, but they work fine.

CPU: Intel Atom N270 (32bit, 1.7GHz)
Memory: 2GB
Hard Drive: 500GB HD not SSD
OS: 32bit Centos 6

Bitcoin Core has a 32bit installer.

The only catch is autostarting bitcoind daemon using non-root user at boot. After some research this command worked.

Edit /etc/rc.d/rc.local, add one line:
  su - user -c "bitcoind -daemon".

If using SSD instead of regular hard drive, it is nice to include a scheduled trim script in /etc/cron.weekly.
nano dofstrim
Add content:
 #! /bin/sh
#for mount in / /boot /home; do
      fstrim $mount
#done


Make it excutable:
chkmod +x dofstrim

Lastly, set up forward forwarding in router and add TCP 8333 to firewall iptables:
nano /etc/sysconfig/iptables


-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

Running Bitcoin Full Node with weak hardware only affects the initial block download and verification time. It took my netbook two weeks. When it is fully running and accepting incoming traffic, it handles 30 traffic without sweat.

Wednesday, August 28, 2019

Be careful buying phones from Aliexpress


Recently bought two refurbished LG G6 H873 from Aliexpress for CAD$130. Both of them are defective and I can't return them because I updated the ROM trying to fix the problem myself. Although I just updated to a later version of official ROM without rooting, the seller denied my request for return and refund

Below is the brief recount of my unfortunate experience:

  1. Placed an order for a H873 to a seller. The seller did not respond for a week.
  2. After waiting for a week, I cancelled the first order and placed second order to another seller review says responds quickly. Yes, the seller responded in a few hours and within 24 hours the phone is shipped.
  3. The first seller responded that my cancellation of first order is rejected because the phone has been shipped, although online status did not show.
  4. So I waited for the two phones thinking I could use them both or sell one of them on Kijiji.
  5. The second phone arrived in two weeks. Quick delivery. 
  6. I found I can't make and receive calls on Freedom Mobile. After a lot of testing, I determined the 3G Band 4 AWS/1700 is dead on this phone. 
  7. Attempted to fix the issue through resetting and updating to the latest official ROM. All failed.
  8. Contacted the second seller for return and refund. The seller's response is:
    "upgrading the system by yourself or auto updating is not supported since we have tested the phone carefully and upgraded the system to the most stable stytem before shipment.and we will not be responsible for such case."
    So essentially even automatic official update is not supported and void warranty.
  9. The first phone came. It works with voice calls, but its Wi-Fi and Bluetooth is dead. After a lot of attempts to fix it myself, including updating to the latest official ROM, I came to realize it is a hardware defect, caused by bad contacts of wifi/bluetooth ic on the motherboard.
    https://forum.xda-developers.com/general/help/qa-wifi-stuck-mac-020000000000-g2-g3-g4-t3452133
  10. Also contacted the first seller for return and refund. The seller offered a 20% refund. This is better than the second seller, because it is better than nothing, so I accepted the offer. Then I cracked open the phone to fix it myself following above mentioned instructions. Voila! The phone is clearly assembled out of used parts, and most importantly, there NO wifi/bluetooth chip on the motherboard! 
Lesson learned.

Update:

I was wrong about the second phone that I thought had bad 3G Band 4. Last week I updated it to official ROM Android 9. Everything starts to work. Incoming and outgoing voice calls work well.  Also Android 9 works noticeably faster than Android 8. So the takeaway from this incident is still, be careful when buying phones from Aliexpress.

Tuesday, February 12, 2019

Useful OpenSSL Commands

Generate new SSL private key and CSR file:
openssl req -new -newkey rsa:4096 -nodes -keyout mydomain.key -out mydomain.csr 

Convert RSA private key to PEM format:
openssl rsa -in mydomain.key -text > mydomain-key.pem

Convert key, cert and ca-bundle into pfx format to be imported into IIS:
(If the IIS Server Windows Server 2016, must use OpenSSL 1.0.x  to convert CRT to PFX otherwise the .pfx file import will fail with "incorrect password" error.)
openssl pkcs12 -export -out mydomain.pfx -inkey mydomain.key -in mydomain.crt -certfile intermediateCA.crt

Convert everything into Tomcat keystore file such as for JIRA:

In Linux, concatenate all *.pem files (cert first, followed by interca cert) into one pem file, like all.pem Then create keystore in p12 format with private key + all.pem

openssl pkcs12 -export -inkey private.key -in all.pem -name test -out test.p12

Then go into Windows, use Java included keytool to export p12 into jks

keytool -importkeystore -srckeystore test.p12 -srcstoretype pkcs12 -destkeystore test.jks

For Jira, make sure the "name" is "alias", use "jira" as "name".

The path of keystool.exe in Windows is at C:\Program Files\Java\jre7\bin

When done, list the content of the keystore file:

Keytool -list -keystore test.jks

Monday, February 4, 2019

A Perfect ROM for Asus Zenfone 2 ZE551ML(Z00A)

Recently upgraded my three year old Asus Zenfone 2 ZE551ML(Z00A) from Android 6 CleanStock to Android 7.1.2 Groovy Android. It works perfectly. All around better than Android 6 CleanStock which has stopped updating long ago. Groovy Android seems will keep updating.

https://forum.xda-developers.com/zenfone2/development/rom-groovy-android-t3756429

Why do you need a $1000 new phone like iPhone while a $100 old phone works perfectly well with a good ROM.