Skip to content

Instantly share code, notes, and snippets.

from win32api import keybd_event, GetKeyboardLayout, GetKeyboardLayoutList, SendMessage
from win32con import VK_LCONTROL, VK_SPACE, KEYEVENTF_KEYUP, WM_INPUTLANGCHANGEREQUEST
from win32gui import GetForegroundWindow
KEYBOARD_LAYOUT_EN = 0x04090409
KEYBOARD_LAYOUT_TC = 0x04040404
def switch_to_english():
Using Windows built-in tool: diskpart
1. in cmd or powershell
% diskpart
2. grant execution
3. in diskpart
list disk
select disk N
@xavieryin
xavieryin / gist:7764861686bc8294cc3e5ef015aaeb94
Created August 3, 2020 07:33
tar with symbolic links preserved
```
# tar -cvhf archive.tar /backupfolder
```
Ref:
1. https://linoxide.com/how-tos/how-to-preserve-symbolic-links-in-tar-command/
@xavieryin
xavieryin / python_setup_uninstall.md
Created November 26, 2018 03:58
Easy uninstall with python setup.py

python setup.py install --record files.txt cat files.txt | xargs rm -rf

  • For Windowns Power Shell: Get-Content files.txt | ForEach-Object {Remove-Item $_ -Recurse -Force}
@xavieryin
xavieryin / private_fork.md
Created July 17, 2018 09:43 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git