2022年3月23日 星期三

Debug a large file copy caused system hangs up (for ubuntu)

 use iotop to debug I/O issue

1. # sudo apt-get install iotop

2. # sudo iotop

3. start another terminal

4. # sync

5. to monitor the process to see if it's hanging.

    # top

6. start another terminal, print free memory every 2 seconds

    # free -ms 2

7. Start another terminal, 

# sudo nohup free -ms 2 &> ~/Documents/log/free.log &

# sudo nohup top -b -d 5 &> ~/Documents/log/top.log &

# sudo nohup iotop -b -d 2 -o -t &> ~/Documents/log/iotop.log &




# iostat -x 1           or              collectl -sD

# atop




2022年3月19日 星期六

Win 7 / 10 查詢變更授權

Refer: https://read01.com/zh-tw/Le32AL.html#.YjUy9H9BxEY   

           (2016/05/13 來源:紅黑聯盟)

1. 以管理員身份執行 cmd

2. "slmgr.vbs -upk"  ---- 卸載證書

    "slmgr.vbs -rearm"則為重置電腦的許可證書狀態

3. 重新導入相關的OEM證書及Key

    slmgr.vbs -upkpb61
4. ex. 以管理員身份運行cmd,導入密鑰的命令(這裡以聯想的Ultimate為例):

slmgr.vbs -ipk 6K2KY-BFH24-PJW6W-9GK29-TMPWP


5. 導入證書的命令:

slmgr.vbs -ilc 證書路徑

其他命令及其作用:

slmgr.vbs -dli   (顯示許可證信息)

slmgr.vbs -xpr   (當前許可證狀態的截止日期)

slmgr.vbs -dlv   (顯示詳細的許可證信息)

slmgr.vbs -xpr

slmgr.vbs -ilc lenovo.oemcert.100036.xrm-ms


其它查看授權的方法:上網下載 slic toolkit 查看看 BIOS 有沒有windows 授權






2022年1月11日 星期二

Windows 10 彩盒版 (完整版 Full Version) (Retail) 與 隨機版 (OEM) 的使用限制

 Windows 10 彩盒版(完整版 Full Version) (Retail) 與 隨機版(OEM) 的使用

1. 隨機版(OEM): 輸入金鑰之後會綁定主機板,Win 10 build 1607 之後,若有用微軟帳號綁定轉成數位授權,則可以移機到新的主機

2. 數位版啟用授權之轉移同隨機版

(也就是免費更新上WIN10跟從M$商城買的授權隨機版規則)

(例如:原本是彩盒版 Win7 免費更新上 Win10,就會變成隨機版)

3. 彩盒版(完整版 Full Version) (Retail):理論上可以任意的移機,限制是同時只能有一台是合法使用。但實際上,微軟的伺服器好像會偵測安裝次數,可能被限制安裝次數,若有問題時,還是可打電話到微軟要求解決。最好保留購買的發票與彩盒金鑰


建議:

1. 若是使用隨機版(OEM),可考慮用微軟帳號綁定轉成數位授權,以後可以自由移機到新的主機,舊的會自動失效,不須事先取消綁定。先到微軟網站,登入你的帳號,查看帳戶有沒有連結授權。

2. 隨機版(OEM)不綁定微軟帳號轉成數位授權,要先取消綁定主機板授權,然後,才可以移動授權到新的主機板


按照MS的規則

彩盒版 = 可單機序號啟動+轉移、可綁定MS帳號啟動+轉移

隨機版 = 可單機序號啟動(不可轉移)、可綁定MS帳號啟動(不可轉移),
後來被發現微軟啟動規則BUG,才出現 [隨機版綁定MS帳號啟動+轉移] 的方法

至於隨機版用主機板維修的理由做電話序號啟動+轉移,這是微軟在放水(或是說相信客戶的誠實),按照規則是可以拒絕轉移的


上網下載 slic toolkit 查看看 BIOS 有沒有windows 授權

可用 DOS Prompt 的 slmgr 查看是 Retail, OEM or Volume

slmgr /dli

refer to :

1. https://www.lifewire.com/slmgr-command-4684499

2. https://www.windowscentral.com/how-determine-if-license-oem-retail-volume-windows-10

3. https://softwarekeep.com/help-center/how-to-plug-in-your-product-key-with-slmgr-and-slui

4. https://www.mobile01.com/topicdetail.php?f=300&t=5484013&p=2

5. https://www.mobile01.com/topicdetail.php?f=300&t=6394804





2021年12月30日 星期四

How to set up USB for Virtualbox?

How to set up USB for Virtualbox?


1. Install Extension Pack

  For USB 2.0 and USB 3.0 we need to install the free (but closed source) VirtualBox Extension Pack from the VirtualBox download page

  

2. Become a "vboxuser" in Host machine (local machine)

To be able to get access to an attached USB device, the Ubuntu host user needs to be in the vboxusers group. Add your user to this group by running the following command


sudo usermod -aG vboxusers <username> 


and reboot or logout/login.


3. Activate USB support in VirtualBox Manager


Shut down your virtual machine and open USB settings in the VirtualBox Manager. Tick Enable USB Controllerand USB 2.0 (EHCI) Controller or USB 3.0 (xHCI) Controller.


Suggestion: using USB 2.0 (EHCI) Controller


4. Select host USB device for access from the guest

To grant access to USB devices we need to select a device to disable in the host and to enable in the guest (this is a precaution to avoid simultaneous access from host and guest). This can be done from the panel Devices menu or by right mouse click in the bottom panel of the VirtualBox Manager on the USB icon:


Tick the device you need in the guest, untick it if you need it in the host. If you can't see your USB device in that list, it means that VirtualBox cannot access your host USB devices. Make sure your user is added to the vboxusers group and that you restarted your host.


The selected device will immediately be accessible from the guest.


Refer to : https://askubuntu.com/questions/25596/how-to-set-up-usb-for-virtualbox


2021年11月11日 星期四

How to make 'python' program command execute Python 3?

/usr/bin/env: ‘python’: No such file or directory

 

Method 1: (This method is failed to "#! /usr/bin/env")

   putting alias in the user's ~/.bashrc

   example:

   alias python=python3


Method 2: (This method is OK to "#! /usr/bin/env")

  $ whereis python3

  $ ls -lisa /usr/bin/python*

  $ sudo ln -s /usr/bin/python3 /usr/bin/python


Method 3:

  $ sudo apt install python-is-python3

2021年10月22日 星期五

Install Chinese Input on Ubuntu 20.04

1. Settings / Region & Language / Input Sources / Manage Installed Language

    Add Chinese

2. Settings / Region & Language / Input Sources / + 

    Select ... , 

    then Other, 

    then select Chinese, Press Add

3. Settings / Region & Language / Input Sources / Chinese

    Press Chinese, Select Chinese (Chewing)


2021年10月8日 星期五

VirtualBox Copy & Paste don't work between host and guest OS (for Ubuntu)

Refer to https://askubuntu.com/questions/63420/how-to-fix-virtualboxs-copy-and-paste-to-host-machine



1) VirtualBox / Machine / General / Advanced
    Shared Clipboard: Bidirectional
            Drag'n' Drop: Bidirectional
2) The guest's Ubuntun terminal commands:
sudo apt install virtualbox-guest-x11 --reinstall
VBoxClient-all --clipboard
I used --reinstall option because of I had virtualbox-guest-x11 package installed and before reinstalling it I had:
$ VBoxClient-all --clipboard
VBoxClient: error: No service specified. Quitting because nothing to do!
3) After reboot screen resolution jumps to its minimal value, so
Run Guest OS (Ubuntu) / Settings / Displays / Resolution 

2020年12月4日 星期五

The default way to take screenshot in Linux #print screen #prtscr

The default way to take screenshot in Linux


Almost all Linux distributions and desktop environments support these keyboard shortcuts.

Let’s take a look at the list of keyboard shortcuts you can utilize:

PrtSc – Save a screenshot of the entire screen to the “Pictures” directory.
Shift + PrtSc – Save a screenshot of a specific region to Pictures.
Alt + PrtSc  – Save a screenshot of the current window to Pictures.


Ctrl + PrtSc – Copy the screenshot of the entire screen to the clipboard.
Ctrl + Shift + PrtSc – Copy the screenshot of a specific region to the clipboard.

Ctrl + Alt + PrtSc – Copy the screenshot of the current window to the clipboard.

Big5 txt files became unreadable under Linux

command line (convert big5 encoding text.txt to utf8 encoding test-utf8.txt)

iconv -f big5 -t utf8 test.txt > test-utf8.txt

Refer to:  

https://www.itread01.com/p/160400.html

2020年11月5日 星期四

My Favorite Git Setting (for Ubunut)


1. Add the following in ~/.bash_profile


#! /bin/bash
#-----------------------------------------------------------------
# Bash autocompletion for Git

if [ -f ~/.git-completion.sh ]; then
   source ~/.git-completion.sh
fi

if [ -f ~/.git-prompt.sh ]; then
   source ~/.git-prompt.sh
fi

# PS1 may be replaced
 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][\w]\[\033[0m\]\[\033[1;36m\]$(__git_ps1)\[\033[0;33m\]\[\033[0m\]$ '
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\w \[\033[0m\]\[\033[1;36m\] $(__git_ps1)\[\033[0;33m\]\[\033[0m\]$ '
#PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
#PS1="[\[\033[1;32m\]\w\[\033[0m\]] \[\033[0m\]\[\033[1;36m\]\$(git_branch)\[\033[0;33m\]\$(git_since_last_commit)\[\033[0m\]$ "
#PS1="[\[\033[1;32m\]\w\[\033[0m\]] \[\033[0m\]\[\033[1;33m\]\$(__git_ps1)\[\033[0;33m\]\[\033[0m\]$ "


2. Download  https://github.com/git/git/blob/master/contrib/completion/git-completion.bash 

and rename by git-completion.sh

3. download https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh

$ mv git-completion.sh ~/.git-completion.sh
$ mv git-prompt.sh ~/.git-prompt.sh
$ chmod 775 .git-completion.sh
$ chmod 775 .git-prompt.sh


4. 

$ source ~/.bashrc

or


$ source ~/.bash_profile

Reference result