11/08/2024

Fix "Your organization requires that you change your PIN"

1. Open local GPO Editor by running gpedit.msc command.

2. Next, go to Computer configuration > Administrative templates > System > PIN Complexity. Make the changes to match your PIN.

3. For password, changing the local group policy doesn't work. So the password must meet the complexity requirement set by the work account.

8/12/2024

电脑如何快速输入时间日期

使用搜狗输入法

高级设置 → 自定义短语 → 自定义短语设置

#$year-$month_mm-$day_dd (not yyyy)

用一下函数:

函数表如下:

  函数     含义     举例

  $year     年(4位) 2006、2008

  $year_yy 年(2位) 06、08

  $month     月       12、8、3

  $month_mm   月       12、08、03 //此函数在输入法3.1版之后(含)有效

  $day     日       3、13、22

  $day_dd 日      03、13、22 //此函数在输入法3.1版之后(含)有效

  $weekday 星期     0、1、2、5、6

  $fullhour 时(24小时制)   02、08、13、23

  $halfhour 时(12小时制) 02、08、01、11

  $ampm     AM、PM(英) AM、PM(大写)

  $minute   分       02、08、15、28

  $second   秒       02、08、15、28

  $year_cn 年(中文4位) 二〇〇六

  $year_yy_cn 年(中文2位) 〇六

  $month_cn 月(中文) 十二、八、三

  $day_cn   日(中文) 三、十三、二十二

  $weekday_cn 星期(中文) 日、一、二、五、六

  $fullhour_cn 时(中文24时制) 二、八、十三、二十三

  $halfhour_cn 时(中文12时制) 二、八、一、十一

  $ampm_cn 上午下午(中文) 上午、下午

  $minute_cn 分(中文) 零二、零八、十五、二十八

  $second_cn 秒(中文) 零二、零八、十五、二十八

7/25/2024

Use keyboard to mimic mouse left click

Ubuntu/Linux: Create a shortcut to use xdotool click 1 command

Windows: Use AHK software,

#j::

  MouseClick, left

7/24/2024

Ubuntu hibernation fails

 Try: sudo swapoff -a && sudo swapon -a

4/17/2024

Ubuntu 22.04, Cinnamon Desktop missing slack icons in the system tray

To solve this problem:

 sudo apt purge indicator-application

4/14/2024

How to set Windows 11 to hibernate automatically (hibernate after) hibernation

Just to be clear, Windows has two low-power modes:

Sleep - All non-essential activities and drivers are stopped and the processor goes into power-conservation mode

Hibernate - The current system state is stored to hard drive, and the system powers off

Sleep is enabled OOTB and can be controlled by control panel.

You can enable hibernate from the advanced power settings in control panel.

In Windows 10, you can set the timeout so that after sleeping for a certain duration, the PC automatically hibernates to go to deep power saving.

Windows 11 seems to be missing the UI feature to set that time out and by default it's set to a very long time (like 16 hours)

Here's how to enable hibernate and set the timeouts by the command line.

如果要从UI上enable:Control Panel | Power | 选择电源按钮的功能 | 休眠显示在电源菜单

Open an elevated command prompt (run as administrator)

Enable hibernate:  powercfg /HIBERNATE ON

Query the current hibernate idle settings: powercfg /Q

Look for a section that looks like:


Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced)

  GUID Alias: SCHEME_BALANCED 

  Subgroup GUID: 238c9fa8-0aad-41ed-83f4-97be242c8f20  (Sleep) 


    GUID Alias: SUB_SLEEP 


    Power Setting GUID: 9d7815a6-7ee4-497e-8888-515a05f02364  (Hibernate after) 


      GUID Alias: HIBERNATEIDLE 


      Minimum Possible Setting: 0x00000000 


      Maximum Possible Setting: 0xffffffff 


      Possible Settings increment: 0x00000001 


      Possible Settings units: Seconds 


    Current AC Power Setting Index: 0x00000000 


    Current DC Power Setting Index: 0x00000e10


0x00000e10 = 3600 seconds


To set the DC power (battery power) timeout: powercfg /x  hibernate-timeout-dc 60

This will set it to 60 min or 3600 seconds or 0x00000e10 seconds

You can even make it work when on AC power (plugged in): powercfg /x  hibernate-timeout-ac 60 

4/04/2024

Migrate a dual-boot (Windows 11 + Ubuntu 22.04) Surface Pro 6 to a new Surface Pro 9

Both Surface Pro 6 and Surface Pro 9 have 520 TB SSD hard drives.

Goal: Use Clonezilla to copy/image 3 Ubuntu partitions of the old Surface Pro 6 (/dev/nvme0n1p4, /dev/nvme0n1p5, /dev/nvme0n1p7) to the new Surface Pro 9 system.

The Surface Pro 9 Windows system was set up with the Windows 11 that came with the new computer. I only wanted to clone the Ubuntu 22.04 to avoid setting up the development environment again.

1. On old Surface Pro 6:

    Clonezilla:

  • Press Power + Volume Down button to start from the USB. Choose large VGA + to RAM option.
  • Selected /dev/nvme0n1p4, /dev/nvme0n1p5, /dev/nvme0n1p7 to clone and saved to a 2TB HDD.
2. On new Surface Pro 9:

  • Windows 11: EaseUS Partition Master Free tool to shrink the SSD to allocate 200500 MB free space for Ubuntu.
  • Power+VolumeDown boot from the Boot Repair Disk. Use GParted tool to create 3 partitions: /dev/nvme0n1p5 (ex4, 1024 MB), /dev/nvme0n1p6 (ex4), /dev/nvme0n1p7 (linux-swap, 20480 MB).
  • Edit the saved backup/image on the 2TB HDD. Change all files names: *p4* -> *p5*, *p5* -> *p6* and the parts file content to: nvme0n1p5, nvme0n1p6, nvme0n1p7

 

Clonezilla:

  • Start from USB
  • Follow the instructions of Clonezilla to restore 3 partitions.

 

Boot Repair Disk:

  • Boot from the USB 
  • Follow the instructions to repair the boot

  • Windows 11: Start PowerShell in Admin mode and run: bcdedit /set "{bootmgr}" path \EFI\ubuntu\grubx64.efi
  • Reboot and the Grub selection menu should show. Choose Ubuntu as the option to start the system.
  • The Ubuntu system won't start. Reboot and enter the recovery mode. In the recovery mode:
    • sudo apt remove lightdm
    • nmtui to connect to the WIF
    • sudo apt install gdm3
    • sudo reboot
  • The dualboot should be set up successfully now.