Skip to content

Instantly share code, notes, and snippets.

View Jaid's full-sized avatar
🔴
Streaming coding sessions on Twitch!

Jaid

🔴
Streaming coding sessions on Twitch!
View GitHub Profile
@Jaid
Jaid / windowFunctions.ahk
Last active March 17, 2021 04:10
Window functions in AutoHotkey v2
titleSearch := "My Window"
matchCount := WinGetCount titleSearch
OutputDebug "Window count: " matchCount "`n"
hwnd := WinGetID titleSearch
OutputDebug "Window Handle: " hwnd "`n"
windowTitle := WinGetTitle hwnd
OutputDebug "Window Title: " windowTitle "`n"
@Jaid
Jaid / header.ahk
Last active March 17, 2021 04:42
Sane default header for scripts in AutoHotkey v2
#Warn All, StdOut
#SingleInstance Prompt
SetTitleMatchMode "RegEx"
ProcessSetPriority "High"
@Jaid
Jaid / lockWindows.ahk
Created March 17, 2021 07:33
Lock Windows and turn off all displays in AutoHotkey v2
#Warn All, StdOut
#SingleInstance Prompt
ProcessSetPriority "High"
; From https://www.maketecheasier.com/turn-off-monitor-automatically-lock-windows/
#l:: {
Sleep 200
DllCall "LockWorkStation"
Sleep 1000
@Jaid
Jaid / forceAdmin.ahk
Last active March 19, 2021 04:14
Force administrator permissions in AutoHotkey v2
; From https://gist.github.com/Jaid/407c0f2b01aace1125ea34915ce1f6bb
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
try {
if A_IsCompiled {
Run '*RunAs "' A_ScriptFullPath '" /restart'
} else {
Run '*RunAs "' A_AhkPath '" /restart "' A_ScriptFullPath '"'
}
}
@Jaid
Jaid / resize.sh
Created March 24, 2021 13:34
Getting a 1920 x 1080 resolution in Linux Mint on VMWare Workstation
# From https://superuser.com/a/758464/1288709
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080
xrandr --output Virtual1 --mode 1920x1080
@Jaid
Jaid / boilerplate.ahk
Last active April 6, 2021 11:49
My personal boilerplate for building complex hotkey scripts in AutoHotkey v2
#Warn All, StdOut
#SingleInstance Prompt
#Include ../lib/jaid.ahk2
main() {
; TODO: Write business logic
}
; TODO: Change key
#e:: {
@Jaid
Jaid / Stopwatch.ahk
Last active April 6, 2021 19:04
Global stopwatch for measuring execution run time in AutoHotkey v2
class Stopwatch {
time := false
__New() {
this.start()
}
start() {
this.time := A_TickCount
}
end() {
return A_TickCount - this.time
@Jaid
Jaid / markdown.css
Last active April 13, 2021 00:22
Stylesheet for markdownConverter.StyleSheets in VSCode extension MarkdownConverter
* {
background: red !important;
color: red !important;
}
@Jaid
Jaid / showSeconds.reg
Created April 22, 2021 16:08
Show seconds in Task Bar clock in Windows 10
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ShowSecondsInSystemClock"=dword:1
@Jaid
Jaid / Disable Window Shaking.reg
Created April 29, 2021 14:53
Disable window shaking (minimize gesture) on Windows 10
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"DisallowShaking"=dword:1