Skip to content

Instantly share code, notes, and snippets.

@wngtk
wngtk / remapping.ahk
Last active December 24, 2023 13:45
Change Caps Lock to Control when held down; otherwise, Escape
; Change Caps Lock to Control when held down; otherwise, Escape
;
; Originally based on the comment provided in
; [this](https://gist.github.com/volks73/1e889e01ad0a736159a5d56268a300a8?permalink_comment_id=4688167#gistcomment-4688167)
; Github Gist.
;
; A shortcut should be created for this script and placed in the Windows 10/11
; user's startup folder to automatically enable the feature on boot/startup.
; The user's startup folder can be found using the following steps:
;
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"BingSearchEnabled"=dword:00000000
@wngtk
wngtk / hostip.py
Created June 11, 2023 01:52
Print Windows WLAN IPv4 address in WSL.
import os
pipe = os.popen('ipconfig.exe')
text = pipe.buffer.read().decode('gbk')
ip_line = (line for line in text.split('\r\n') if 'IPv4' in line)
try:
ip_addr = next(ip_line).split(':')[-1].strip()
print(ip_addr)
except StopIteration:
exit(1)