Useful Information

About

This page contains useful information to myself. It also serve as a testing page for this blog.

Frequently Used Prompt

Convert a string from blog title to Linux friendly filename.

convert string by replacing colon with dash, nonnalpha numeric with underscore. reduce repetiting underscore or dash to single underscore or dash:

Software Development

Security

Miscellaneous

Frequently Used Commands

  • Shutdown Windows immediately shutdown -r -t 0, useful when you remote to a Windows PC
  • Switch java version {% codeblock %}export JAVA_HOME=/usr/libexec/java_home -v 1.8{% endcodeblock %}

Git

  • Undo (Not pushed) git reset --soft HEAD~
  • Deleting a remote branch git push [remote] --delete [branch] e.g., git push origin --delete feature/branch
  • Sync remote branch and delete remote non-existing local copy git fetch --prune
  • List the commit different between branches git rev-list [branch]...[another branch]
  • List the commit different between branches with arrow indicates which branch owns the commit git rev-list --left-right [branch]...[another branch]
  • List the commit of a branch is ahead/behind to a remote branch git rev-list [branch]...[remote]/[another branch]
  • Show the number of ahead of behind between branches git rev-list --left-right count [branch]...[another branch]
  • Update submodules with latest commit git submodule update --remote
  • Clean up orphan commits git gc --prune=now --aggressive

Windows

Remove XBox

  • Remove XBox with Powershell Get-ProvisionedAppxPackage -Online | Where-Object { $_.PackageName -match "xbox" } | ForEach-Object { Remove-ProvisionedAppxPackage -Online -AllUsers -PackageName $_.PackageName }
  • Check if any Xbox application is left dism /Online /Get-ProvisionedAppxPackages | Select-String PackageName | Select-String xbox

Windows shortcuts

Only those that are frequently used and easily forgotten are listed.

Move Window to another monitorโŠž Windows + โ‡ง Shift + โ† / โ†’
Switch to another desktopโŠž Windows + โŒƒ Control + โ† / โ†’
Task ViewโŠž Windows + Tab
Open Action CenterโŠž Windows + A
Display/Hide DesktopโŠž Windows + D
Open File ExplorerโŠž Windows + E
Quick Link Menu (System tools such as Event Viewer)โŠž Windows + X
LockโŠž Windows + L

Editing

Switch Voice TypingโŠž Windows + H
Open Clipboard HistoryโŠž Windows + โŒƒ Control + V
Paste as plain text1โŠž Windows + V2
Capture screen and then OCR to clipboard1โŠž Windows + T2
EmojiโŠž Windows + .2

Visual Studio Code shortcuts

Only those that are frequently used and easily forgotten are listed. Refernce from https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

Basic

User SettingsโŒƒ Control + ,
Select all occurences of Find matchAlt + Enter
Quick FixโŒƒ Control< + .
Ctrl+K Ctrl+XโŒƒ Control< + K โŒƒ Control< + X
Go to Lineโ€ฆโŒƒ Control + G
Go to Fileโ€ฆโŒƒ Control + P
Go to next error or warningF8
Focus into 1st, 2nd or 3rdโ€ฆ editor groupโŒƒ Control + 1/2/3โ€ฆ
Spit editorโŒƒ Control + </kbd>
Show integrated terminaโŒƒ Control + `
Create new terminalโŒƒ Control + โ‡ง Shift + `
Show Explorer / Toggle focusโŒƒ Control + โ‡ง Shift + E
Show SearchโŒƒ Control + โ‡ง Shift + S
Show Source ControlโŒƒ Control + โ‡ง Shift + G
Show DebugโŒƒ Control + โ‡ง Shift + D
Show ExtensionโŒƒ Control + โ‡ง Shift + X
Replace in filesโŒƒ Control + โ‡ง Shift + H
Show Output panelโŒƒ Control + โ‡ง Shift + U
Open Markdown preview to the sideโŒƒ Control + K V

Debug

Toggle breakpoinF9
Start/ContinueF5
Step overF10
Step intoF11
Step outโ‡ง Shift + F11

Others

Footnotes

  1. Requires PowerToys โ†ฉ โ†ฉ2

  2. Customized shortcut โ†ฉ โ†ฉ2 โ†ฉ3