Skip to content

Instantly share code, notes, and snippets.

View koonix's full-sized avatar
🦆
honk

koonix

🦆
honk
View GitHub Profile
@koonix
koonix / virtualmic.sh
Created March 13, 2022 17:31
setup a LAN audio stream as a microphone for pulseaudio.
#!/bin/sh
# setup a LAN audio stream as a microphone for pulseaudio.
# requires: dmenu, ffmpeg.
# config
NAME=VirtualMic
PIDFILE=${XDG_RUNTIME_DIR:?}/virtualmic
DIR=${XDG_CACHE_HOME:-$HOME/.cache}/virtualmic
main() {
@koonix
koonix / obs-pulse-remap-sink.lua
Last active May 6, 2022 15:13
an OBS script to load/unload a pulseaudio module-remap-sink on OBS's start/exit.
function script_description()
return [[
<h2>obs-pulse-remap</h2>
<p>Load a module-remap-sink on pulseaudio when OBS starts, and unload it when OBS exits.</p>
<p>Useful for when you want OBS to capture the audio of only one program.</p>
<p>Author: Ehsan Ghorbannezhad <[email protected]></p>
]]
end
local modules = {}
@koonix
koonix / live.sh
Last active June 21, 2022 12:15
bash script to set a video or gif as the wallpaper. requires mpv, xrandr and xwinwrap.
#!/bin/bash
#
# 2022-06-21
# version: 0.1.1
# author: Ehsan Ghorbannezhad <[email protected]>
#
# sets a video or gif as your wallpaper.
# requires mpv, xwinwrap and xrandr.
main()
@koonix
koonix / vim-persian-langmap.vim
Created June 29, 2022 14:16
Farsi (Persian) langmap definitions for Vim.
" persian langmap
set langmap=۱1,۲2,۳3,۴4,۵5,۶6,۷7,۸8,۹9,۰0,٬@,٫#,﷼$,٪%,×^,،&,ـ_
set langmap+=ضq,صw,ثe,قr,فt,غy,عu,هi,خo,حp,ج[,چ]
set langmap+=شa,سs,یd,بf,لg,اh,تj,نk,مl,ک\\;,گ'
set langmap+=ظz,طx,زc,رv,ذb,دn,پm,و\\,
set langmap+=ْQ,ٌW,ٍE,ًR,ُT,ِY,َU,ّI,
set langmap+=ؤA,ئS,يD,إF,أG,آH,ةJ,»K,«L
set langmap+=كZ,ژC,ٰV,‌B,ٔN,ءM,؟?
@koonix
koonix / sysact
Created July 11, 2022 09:52
a dmenu wrapper script for system functions.
#!/bin/bash
# a dmenu wrapper script for system functions.
actions=(
'鈴 Sleep'
'鈴 Hibernate'
'⏻ Poweroff'
' Reboot'
' Logout'
)
@koonix
koonix / is-X-ptr-on-root-win.sh
Last active December 17, 2022 10:33
Detect if the pointer is on the root window (background) on Linux.
#!/bin/sh
# this script return true if the pointer is on the root window.
# requires xorg-xwininfo and xdotool.
rootwin=$(xwininfo -root | grep -Po 'Window id: \K\S+')
currentwin=$(printf '0x%x\n' "$(xdotool getmouselocation | cut -d: -f5)")
[ -n "$currentwin" ] && [ "$currentwin" = "$rootwin" ]
@koonix
koonix / ssh-config
Last active March 9, 2023 22:05
example ssh config (~/.ssh/config)
AddKeysToAgent yes
Host github.com
IdentityFile ~/.ssh/keys/github
Host aur.archlinux.org
IdentityFile ~/.ssh/keys/aur
User aur
Host desktop.local
@koonix
koonix / fence.sh
Created September 10, 2022 20:10
run commands on cursor leaving or entering your machine when using barrier.
#!/bin/sh
# this script accompanies barrier (https://github.com/debauchee/barrier).
# it runs commands upon your mouse leaving or entering your machine.
# config
interval=2
check_count=10
# this hook runs when mouse enters this machine.
@koonix
koonix / obs-pulse-remap-sink.lua
Last active December 17, 2022 10:31
load/unload a pulseaudio module-remap-sink on OBS start/exit.
function script_description()
return [[
<h2>obs-pulse-remap v1</h2>
<p>Load a module-remap-sink on pulseaudio when OBS starts, and unload it when OBS exits.</p>
<p>Useful for when you want OBS to capture the audio of only one program.</p>
<p>Author: ghesy <ehsan at disroot dot org></p>
]]
end
local modules = {}
@koonix
koonix / android-notif.sh
Last active December 17, 2022 10:30
A proof-of-concept script that shows android notifications on linux.
#!/bin/bash
# show android notifications on linux.
# it updates duckdns ddns and portforwards via upnp.
# requires a duckdns account, NetworkManager, miniupnpc and an2linux.
# config
duckdns_token= # put your duckdns token here
local_ddns= # local ddns name
public_ddns= # public ddns name