Skip to content

Instantly share code, notes, and snippets.

View koonix's full-sized avatar
🦆
honk

koonix

🦆
honk
View GitHub Profile
@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 / 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 / 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 / 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 / circumvent.sh
Last active February 27, 2022 21:02
a script to download, configure and start the psiphon proxy client.
#!/bin/sh
# download, configure and start the psiphon proxy client.
# requires curl, aria2, libnotify (optional).
# Config
# ==========
# ports
SOCKS_PORT=9050
HTTP_PORT=8585
#
@koonix
koonix / progressbar.lua
Created February 13, 2022 12:47
Unicode Progress Bar in Lua.
-- lua code for generating a nice unicode progress bar.
-- author: Ehsan Ghorbannezhad <ehsan at disroot dot org>
-- input percentage
PERCENT = 96
function round(n)
return math.floor(n+0.5)
end
@koonix
koonix / mtp-automount.sh
Last active July 1, 2023 18:22
Automount android phones. Uses go-mtpfs.
#!/bin/sh
# this script mounts and opens any connected mtp devices while it's running.
# requires go-mtpfs, moreutils , fuse and udev.
# config
cache="${XDG_CACHE_HOME:-$HOME/.cache}/mtpd"
tmp="${XDG_RUNTIME_DIR:-/tmp}/mtpd"
main()
{
@koonix
koonix / swallow-tmux.diff
Last active April 3, 2022 07:22
A modified version of dwm's swallow patch that works with tmux.
A modified version of dwm's swallow patch that works with tmux.
Based on: https://dwm.suckless.org/patches/swallow/dwm-swallow-20201211-61bb8b2.diff
Hosted at: https://gist.github.com/soystemd/0ac35d048672c63d7fc3afb1fde4c5f2
---
diff --git a/config.def.h b/config.def.h
index a2ac963..f833d23 100644
--- a/config.def.h
+++ b/config.def.h
@koonix
koonix / mount-ftp.sh
Last active July 1, 2021 10:26
[Bash Script] Mount FTP servers from a list of servers.
#!/bin/bash
# mount ftp servers from a server list.
# i use it to mount my phone with the
# help of an ftp server android app.
# requires curlftpfs.
# config
hosts=~/.config/mftp/hosts
mntdir=~/Mount/FTP
@koonix
koonix / watchusb.sh
Last active July 1, 2021 10:24
Watch connected usb devices on linux.
#!/bin/sh
# show a cleaned-up output of lsusb periodically. requires usbutils.
watch --differences --no-title --interval 0.5 "lsusb | grep -vi 'root hub$'"