Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / toggle-mute-arknights.ahk
Last active May 28, 2025 19:43
an autohotkey script to toggle mute/unmute Arknights
#Requires AutoHotkey v2.0
#SingleInstance Force
soundvolPath := "D:\pgm\soundvolumeview-x64\SoundVolumeView.exe"
matchKey := "アークナイツ" ; used to find the session
muteTarget := "" ; will be set from CSV field[1] (Name column)
^!m::toggleMute()
toggleMute() {
@hidsh
hidsh / ZZ_example.txt
Last active May 22, 2025 04:11
shellscript (zsh): Infinite wait for the success-status of given `command` for polling something
$ cd ~/Downloads
$ ls foo # `foo` does *not* exist
ls: cannot access 'foo': No such file or directory
$ waitfor 1 ls foo
....
#### begin: another shell
$ touch ~/Downloads/foo
#### end: another shell
@hidsh
hidsh / ping-scan.sh
Last active May 12, 2025 07:40
A shell script for ping-ing to all other hosts belonging to the same subnet
#!/usr/bin/bash
#
# Usage: ping-scan.sh
#
# Notes: This script can only be executed on WSL2/Windows.
# You can specify $SUBNET variable.
SUBNET='192.168'
my_ip() {
@hidsh
hidsh / zmk-create-skeleton.v
Last active February 15, 2025 08:36
creates skeleton files for zmk template
// SPDX-License-Identifier: CC0-1.0
//
// zmk-create-skeleton.v
//
// Creates skeleton files for the ZMK template (https://github.com/zmkfirmware/unified-zmk-config-template)
//
// ./boards/shields/KBD_NAME/
// Kconfig.shield
// Kconfig.defconfig
// KBD_NAME.overlay
@hidsh
hidsh / show-path.sh
Created December 17, 2024 01:35
linux: list $PATH env variable
echo $PATH | tr ':' '\n'
@hidsh
hidsh / part-of-sway-config
Created December 17, 2024 01:13
sway: show keybinding via fuzzel
# somewhere like `~/.config/sway/config.d/default`
#
# add a following line to the end of sway config
bindsym $mod+k exec PATH/TO/sway-show-keybindings-fuzzel.sh
@hidsh
hidsh / sway-show-keybindings.sh
Created December 16, 2024 02:27
shell script: cheat sheet for keybindings of sway
#!/bin/zsh
s=$(rg '^ *bindsym +(.+)$' ~/.config/sway/config.d/default | sed -e 's/^ *bindsym *//' | sed 's/ \+/\t/' | sed 's/\+/ /g' | awk '{printf("%25s\t%s\n", $1, $2)}' FS='\t')
w=`expr "$COLUMNS" - 16`
s=$(echo ${s} | cut -c -${w})
echo $s | less
@hidsh
hidsh / part-of-.zshrc
Last active December 24, 2024 01:00
show command help w/ fzf
h() {
local tmp_file=/tmp/h
local cmd=''
if [ "$#" -eq 0 ]; then
cmd=$(echo $PATH | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -executable 2>/dev/nul
l | xargs -n 1 basename | fzf);
elif [ "$#" -eq 1 ]; then
cmd=$1
else
@hidsh
hidsh / sed-example.txt
Last active December 9, 2024 08:15
linux: sed で全置換
$rg --no-heading bat43 # check
rat43.zmk.yml:2:id: bat43
rat43.zmk.yml:5:url: https://kbd.dailycraft.jp/bat43/
Kconfig.shield:5: def_bool $(shields_list_contains,bat43)
$sed -i -e 's/bat43/rat43/' * # replace bat43 --> rat43
$rg --no-heading bat43 # confirm
$rg --no-heading rat43 # confirm
@hidsh
hidsh / rename-example.txt
Last active December 9, 2024 07:14
linux: renameコマンドなんてあったんや…
$ls -1
bat43.keymap
bat43.overlay
bat43.zmk.yml
Kconfig.defconfig
Kconfig.shield
$rename -n -v bat43 rat43 bat43* # dry run
`bat43.keymap' -> `rat43.keymap'
`bat43.overlay' -> `rat43.overlay'