Skip to content

Instantly share code, notes, and snippets.

View aahung's full-sized avatar
🔨

_sam aahung

🔨
View GitHub Profile
@aahung
aahung / README.md
Created January 31, 2021 05:49 — forked from ascendbruce/README.md
Use mac style keyboard shortcuts on Windows with AutoHotkey (ahk) script

Use (most) macOS style keyboard shortcuts on Windows

Make Windows PC's shortcut act like macOS (Mac OS X)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

Note that

  1. You should disable the Between input languages shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys because it conflicts with cmd + shift + ↑ / ↓ / ← / → (select text between cursor and top / bottom / beginning of line / end of line)
  2. you shouldn't change the modifier keys mapping with keyboard DIP. This script assumes you use a standard PC keyboard layout, and wish to use shortcuts as if it was a mac keyboard layout.

after Build 17093

  • can override settings by edit "/etc/wsl.conf"
  • normally this file is not exists at first
$ sudo vi /etc/wsl.conf

[interop]
appendWindowsPath = false
@aahung
aahung / eslint-ignore.sh
Created April 6, 2020 07:08
Add eslint ignore to all files (macOS)
find ./src -maxdepth 5 -type f -name *.tsx -exec sed -i '' '1i\
/* eslint-disable */
' {} \;
@aahung
aahung / .applescript
Created June 26, 2019 08:16
Open current folder in Kitty (apple script)
on alfred_script(q)
tell application "Finder"
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
set textToType to "clear; cd " & pathList
end tell
tell application "System Events"
set isRunning to (exists (processes where name is "kitty"))
end tell
@aahung
aahung / README.md
Last active June 23, 2022 19:26
Quickly toggle "Connect on Demand" for IKEv2 VPN connection on Mac

Make sure you add the app invoking this script is in the Preferences -> Security & Privacy -> Pricavy -> Accessbility

For me, I use it with Alfred, so Alfred 3.app is in the list.

@aahung
aahung / .sh
Created February 13, 2017 06:57
Multithreading gzip Compress using pigz
# http://stackoverflow.com/a/12320421
# -9 for better compression
# 32 is number of cores to use
tar cf - paths-to-archive | pigz -9 -p 16 > archive.tar.gz
qsub j1.pbs
qsub j2-1.pbs
qsub j2-2.pbs
qsub j2-3.pbs
qsub j2-4.pbs
qsub j2-5.pbs
qsub j2-6.pbs
qsub j2-7.pbs
qsub j2-8.pbs
qsub j3.pbs
@aahung
aahung / copy necessary
Last active June 6, 2017 02:55
Copy from remote server include files with some pattern only
export REMOTE_PATH=/data/xinhong/pd/run_makeup_cr0.02
rsync -a --include="*o/" --include="*.out" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*eff*.out" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*1460000*.out" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*1460000*" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*10600000*" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*507200*" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
rsync -a --include="*/" --include="*6600000*" --exclude="*" xinhong@144.214.25.68:$REMOTE_PATH . --progress
@aahung
aahung / gist:b4813232c5524c598223a90191ee08b3
Created December 7, 2016 17:21
Comvert to MP4 using ffmpeg
ffmpeg -i ?.mkv -vcodec copy -acodec copy ?.mp4
@aahung
aahung / reset-touch-bar.sh
Created December 6, 2016 12:59
Reset Macbook Pro's Touch Bar
killall ControlStrip