Skip to content

Instantly share code, notes, and snippets.

@honboubao
honboubao / mouse_mods.ahk
Created May 24, 2026 13:31
AutoHotKey v2 script to activate mod keys and enable fast scrolling when mouse buttons are being held for more than 300ms.
; Hold time threshold in seconds (0.3 = 300 ms)
HoldTime := 0.3
; Multiplier for faster scrolling
ScrollSpeed := 10
; Timers start disabled
SetTimer(CheckHoldCtrl, 0)
SetTimer(CheckHoldShift, 0)
SetTimer(CheckHoldAlt, 0)
@honboubao
honboubao / mouse_mods_kanata.kbd
Created March 23, 2025 14:18
Kanata (https://github.com/jtroo/kanata) config to activate mod keys and enable fast scrolling when mouse buttons are being held for more than 300ms.
(defvar
tap-time 200
fast-scroll 1200
)
(defsrc
mfwd
mbck
mmid
mwu
@honboubao
honboubao / mouse_mods.ahk
Last active May 29, 2026 11:18
AutoHotKey v1 script to activate mod keys and enable fast scrolling when mouse buttons are being held for more than 300ms.
#Persistent
#MaxHotkeysPerInterval 2000
SetTimer, CheckHoldCtrl, Off ; Timer for Ctrl (forward button)
SetTimer, CheckHoldShift, Off ; Timer for Shift (back button)
SetTimer, CheckHoldAlt, Off ; Timer for Alt (middle button)
HoldTime := 0.3 ; Hold time threshold in milliseconds
ScrollSpeed := 10 ; Multiplier for faster scrolling
; Back button (XButton1) -> Shift key
@honboubao
honboubao / microqwertz_kanata.kbd
Last active December 27, 2024 11:48
Kanata (https://github.com/jtroo/kanata) keyboard mapping configuration. Adapted variant of the micro_qwertz keyboard layout (http://www.keyboard-layout-editor.com/#/gists/12281aabe024b50dbcfd42017a9aa722).
;; use with kanata_winIOv2.exe or kanata_gui.exe
(defcfg
windows-altgr cancel-lctl-press
process-unmapped-keys yes
)
(defvar
tap-time 200
)
@honboubao
honboubao / concatNullable.ts
Last active July 17, 2023 16:30
concatNullable
/**
* Ein fixer String, der in {@link Template} mit anderen Werten verknüpft wird und abhängig von der Gültigkeit der anderen Werte mitangezeigt wird.
*
* Das Trennzeichen darf kein Empty-String sein!
*/
export type Trennzeichen = string; // Empty string als Trennzeichen nicht erlaubt
/**
* Ein Wert, z.B. von einer Variable, der konkateniert werden soll. Ungültige Werte (null, undefined, Empty-String) werden nicht ausgegeben.
* Ungültige Werte beeinflussen ggf. auch die Ausgabe von Trennzeichen im gleichen {@link Template}
@honboubao
honboubao / format.ts
Created May 26, 2023 10:51
JS Concat Template String Function
/**
* Template String Tag Funktion, druckt die eingesetzten Werte im Template und den vorangestellten Verbindungsstrings nur aus, wenn der Wert nicht leer ist.
*
* z.B.
* format`${strasse} ${hausnummer} ${stockTuernummer} / ${abgabestelle} / ${anschriftzusatz}`
*
* => Bambuslichtung 15 / Scheunentor
*
* wenn nur strasse, hausnummer und abgabestelle angegeben sind
#SingleInstance Force
#InstallKeybdHook
TAPPING_TERM := 200
keyboard := ["SC029","SC002","SC003","SC004","SC005","SC006","SC007","SC008","SC009","SC00A","SC00B","SC00C","SC00D","SC00E"
,"SC00F","SC010","SC011","SC012","SC013","SC014","SC015","SC016","SC017","SC018","SC019","SC01A","SC01B","SC01C"
,"SC03A","SC01E","SC01F","SC020","SC021","SC022","SC023","SC024","SC025","SC026","SC027","SC028","SC02B"
,"SC02A","SC02C","SC02D","SC02E","SC02F","SC030","SC031","SC032","SC033","SC034","SC035","SC056","SC136"
@honboubao
honboubao / remap-caps-nav.ahk
Last active June 5, 2021 21:40
AutoHotkey script that maps nav keys and alt gr keys onto hotkeys with caps lock as modifier
#SingleInstance Force
Alt & CapsLock::SetCapsLockState, % (t:=!t) ? "On" : "Off"
CapsLock::return
CapsLock & j::Left
CapsLock & k::Down
CapsLock & l::Right
CapsLock & i::Up
@honboubao
honboubao / remap.ahk
Last active May 28, 2021 11:46
AutoHotkey script that maps arrow keys, home, end and page up/down onto left win key + uiop/jklö block
#SingleInstance Force
*<#j::Send {Blind}{LWin up}{Left}{LWin down}{LCtrl}
*<#k::Send {Blind}{LWin up}{Down}{LWin down}{LCtrl}
*<#l::Send {Blind}{LWin up}{Right}{LWin down}{LCtrl}
*<#i::Send {Blind}{LWin up}{Up}{LWin down}{LCtrl}
*<#u::Send {Blind}{LWin up}{Home}{LWin down}{LCtrl}
*<#o::Send {Blind}{LWin up}{End}{LWin down}{LCtrl}
*<#p::Send {Blind}{LWin up}{PgUp}{LWin down}{LCtrl}
*<#ö::Send {Blind}{LWin up}{PgDn}{LWin down}{LCtrl}
@honboubao
honboubao / StringUtils.java
Last active April 21, 2021 13:22
split/join with escape (Java)
public static class StringUtils {
public static String join(String... parts) {
return Arrays.stream(parts).map(s ->
s.replaceAll(
"\\\\", // regex, replace \
"\\\\\\\\" // with \\
).replaceAll(
"\\|", // regex, replace |
"\\\\|" // with \|