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 match | Alt + Enter |
| Quick Fix | โ Control< + . |
| Ctrl+K Ctrl+X | โ Control< + K โ Control< + X |
Navigation
| |
|---|
| Go to Lineโฆ | โ Control + G |
| Go to Fileโฆ | โ Control + P |
| Go to next error or warning | F8 |
| 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 breakpoin | F9 |
| Start/Continue | F5 |
| Step over | F10 |
| Step into | F11 |
| Step out | โง Shift + F11 |
Others