Hugh's Notes

Sunday, March 3, 2024

CopyTrans HEIC on Windows 10/11

Forget about the HEIC Image Extension and HEVF Video Extension on Microsoft App Store to support HEIC images on Windows 10 and 11. Microsoft is trying to charge for them and block ways to install them free of charge through adguard. 

Go straight to get CopyTrans HEIC. It is free for personal use. The product now includes a Studio, a Converter and Viewer. The old version only includes Converter and Viewer. The old version on Windows 11 does not work as expected. It seamlessly integrates into Windows File Explorer to provide thumbnail. All image applications work right away through it without configuration.

Friday, January 19, 2024

Manually Upgrade PHP with SQL Driver and Ioncube on IIS

Microsoft retired Web Platform Installer on December 31, 2022, making PHP upgrade manual on Windows platform. There are guides on Internet, but missing SQL and Ioncube. Some steps are not optimal.
I would like to share my process below:

PHP Upgrade

  1. Download the zip package from https://windows.php.net/download/. IIS requires NTS (non-threaded).
  2. Unzip and save all the content in new folder C:\Program Files\PHP\v7.2 (for example).
  3. Edit the php.ini file to ensure the path info are all correct.
  4. In IIS, launch PHP Manager, Register New PHP Version, then Change PHP version.

SQL Service Upgrade

  1. Download PHP Drivers for SQL from https://github.com/Microsoft/msphpsql/releases?page=2. For PHP 7.2, the file to download is Windows-7.2.zip under version 5.6.0.
  2. Unzip and save the nts version of php_sqlsrv.dll and php_pdo_sqlsrv.dll to C:\Program Files\PHP\v7.2\ext (for example).
  3. Rename them to php_sqlsrv.dll and php_pdo_sqlsrv.dll.
  4. Edit php.ini to include these two extensions.

Ioncube Upgrade

  1. Download the Loader Wizard from https://www.ioncube.com/loaders.php
  2. Unzip and place the loader-wizard.php file in wwwroot.
  3. Use Web browser to open loader-wizard.php to check and download the proper loader file.
  4. Unzip and place the loader file in C:\Program Files\PHP\v7.2\ext
  5. Edit php.ini to include the ioncube extension file.
Finally, restart IIS and keep finger crossed.

Tuesday, April 11, 2023

Check if SSL CSR, Key and CRT match

To view the md5 hash of the modulus of the private key:

$ openssl rsa -noout -modulus -in mykey.key | openssl md5

To view the md5 hash of the modulus of the CSR:

$ openssl req -noout -modulus -in mycsr.csr | openssl md5

To view the md5 hash of the modulus of the certificate:

$ openssl x509 -noout -modulus -in mycert.crt | openssl md5

If all three hashes match, the CSR, certificate, and private key are compatible. You can use 

diff3
 to compare the moduli from all three files at once:

$ openssl req -noout -modulus -in mycsr.csr > csr-mod.txt
$ openssl x509 -noout -modulus -in mycert.crt > cert-mod.txt
$ openssl rsa -noout -modulus -in mykey.key > privkey-mod.txt
$ diff3 csr-mod.txt cert-mod.txt privkey-mod.txt

If all three files are identical, 

diff3
 will produce no output.

Tuesday, March 7, 2023

Quickly Expand Linux Volume

 There are various complicated ways to expand a Linux volume. Here is an easy one using parted.

First, use command lsblk to show disk volume info, for example:

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0           2:0    1    4K  0 disk 
sda           8:0    0   40G  0 disk 
├─sda1        8:1    0    1G  0 part /boot
└─sda2        8:2    0   19G  0 part 
  ├─cl-root 253:0    0   17G  0 lvm  /
  └─cl-swap 253:1    0    2G  0 lvm  [SWAP]

To expand cl-root volume, enter command:
parted ---pretend-input-tty /dev/sda resizepart 2 100%;
partx -u /dev/sda; pvresize /dev/sda2;
lvextend -r /dev/cl/root /dev/sda2
If the command does not work, just update parted by yum update parted. This works in CentOS 7.

Tuesday, January 10, 2023

Share mapped network drive for all users

 Normally a shared network drive is only accessible to the user who mapped it. Even when you use net use command in Command Prompt or PowerShell to map a network drive as Administrator, you will be surprised to find the drive is only available within the elevated Command Prompt or PowerShell window itself. It will not show in File Explorer.

In a small network environment, it is useful to allow all users using the same computer have ready access to the same mapped network drive, for example you have a team file server. You could use a login script to map drives for each and every user, or use a registry setting to share the mapped drive for all users.

Just create HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLinkedConnections DWORD and set the value to 1. Restart the computer to take effect.

You could use File Explorer to map network drives, or use command to do the same with option to enter different credential for access.

net use z: \\file_server\share_name password_here /user:username_here /persistent:Yes

Sunday, April 18, 2021

Change Password Complexity Setting in Local Group Policy

The Password complexity is a Local Policy setting named "Passwords must meet complexity requirements" under Computer Configuration/Windows Settings/Security Settings/Account Policies/Password Policy.


In a Server Core installation there is no graphical user interface to set this policy.
Instead use secedit to import and export the security settings from a Full Installation of Windows Server 2008.
  1. First export your security configuration using the following command:

    secedit /export /cfg C:\securityconfig.cfg
      
  2. Then open notepad.exe and edit the C:\securityconfig.cfg file.
    Under [System Access] you should find PAssword complexity = 1
    Change the value to 0 and save the file.
     
  3. Then fire up the next command to import the configuration:

    secedit /configure /db C:\Windows\security\new.sdb /cfg C:\securityconfig.cfg /areas SECURITYPOLICY

Friday, July 17, 2020

Unlock and install custom ROM on LG G6 H872

Lots of steps to get it done. I love it when everything is done. My LG G6 H872 abandoned by T-Mobile is now running Android 10 using Havoc OS 3.7 smoothly.

Generally followed the steps from https://forum.xda-developers.com/tmobile-g6/how-to/root-h872-to-including-11g-t3775518. For simplicity and memory, below is my steps in brief.
  1. Download and install ADB platform on Windows computer.
  2. Download and install LG G6 USB driver.
  3. Plug in LG G6 via USB to ensure the connection is stable and USB driver loads correctly.
  4. In phone Settings, tap Software Build six time to enable Developer Mode.
  5. In phone Settings, get into Developer Mode to enable Developer Connection and Debugging
  6. With phone plugged in USB, run ADB command adb devices to verify the phone is online.
  7. Run ADB command adb reboot bootloader
  8. When the phone is rebooted into Download Mode, enter command fastboot oem unlock. Command fastboot devices may not show the phone, but it works with oem unlock command. Finally adb reboot to reboot the phone. This completes bootloader unlock.
  9. Hold Volume Up button, without touching power button, plug in phone to USB. It will get phone into download mode.
  10. Download the special LGUP program. 
  11. Run it detect the plugged in phone in Download Mode,
  12. Download the image of another LG phone with laf
  13. Flash LG G6 with the image for laf only. Be careful with laf flashing. As soon as  laf flashing step is over, pull the USB cable immediately. The process only take one or two seconds. So be careful to pull quickly.
  14. Download the current stock ROM the phone is using.
  15. Flash the ROM using LGUP to phone again but without laf.
  16. Download FWULL and burn it into USB flash drive.
  17. Boot computer using FWUL USB flash drive.
  18. Make sure the computer has wire connection to Internet
  19. Connect phone in Download Mode to FWUL computer.
  20. Enter a few commands (search online) in FWUL to download and install TWRP recovery system onto laf partition. This completes TWRP installation.
  21. Reboot computer into Windows for more ADB commands.
  22. Hold Volume Up button and plugin phone to get into Download Mode. Wait a while, it will go into TWRP.
  23. In TWRP, ignore password, do a factory reset.
  24. Download custom ROM Havoc OS for LG G6 and GAPPS 10 for ARM micro. Copy them into ADB folder.
  25. Put phone into Sideload mode,
  26. Run ADB command to sideload custom ROM zip file and GAPPS zip file: adb sideload filename.zip.
  27. Reboot when sideload is complete by command adb reboot.
  28. This completes custom ROM installation. Enjoy.
Note: TWRP is only installed in laf partition, to get into TWRP in future, must plug in USB to computer while holding Volume Up key.