Skip to content

Instantly share code, notes, and snippets.

@guychouk
guychouk / vim-keys.ahk
Last active March 10, 2021 19:46
Enable HJKL home row keys as arrows when Space key is pressed using AutoHotkey
; Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
; Recommended for new scripts due to its superior speed and reliability.
SendMode Input
; Ensures a consistent starting directory.
SetWorkingDir %A_ScriptDir%
; Mentioned in the hotkeys docs for UP
Space & F1::Return
@guychouk
guychouk / schedule-task.ps1
Last active March 15, 2021 11:53
Register a Scheduled Task to run AutoHotkey script at Windows startup (specifically on user logon).
Register-ScheduledTask `
-TaskName "AHK-Macros" `
-Action $(New-ScheduledTaskAction -Execute "path\to\ahk.exe" -Argument "D:\Drive\etc\macros.ahk" -WorkingDirectory "D:\Drive\etc") `
-Trigger $(New-ScheduledTaskTrigger -AtLogOn) `
-Principal $(New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest)
@guychouk
guychouk / post-merge
Last active January 26, 2021 13:42
Post merge/pull hook to run npm command only if view files changed
#!/bin/bash
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
runOnChange() {
echo "$changedFiles" | grep -q "$1" && eval "$2"
}
runOnChange resources/js/ "npm run <your-npm-script>"
runOnChange resources/scss/ "npm run <your-npm-script>"
@guychouk
guychouk / onedrive-hider.ps1
Last active January 26, 2021 13:43
A Powershell script to hide or show OneDrive in the explorer tree for Windows 10 (64-bit)
switch ($args[0]) {
"hide" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 0
break;
}
"show" {
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name System.IsPinnedToNameSpaceTree -Value 1
break;
@guychouk
guychouk / media_sorter.py
Last active May 18, 2022 03:15
Python script for sorting images and videos by Years and Months based on EXIF & Media Created Info.
'''
Put this script in a messy folder filled with images and video files.
After running it, a "Years" folder will be created with the media files
sorted by months in each year.
You can also change what types of files to look for in your folder by
adding to or changing the "imgFormats" and "videoFormats" lists.
'''
import os