Skip to content

Instantly share code, notes, and snippets.

@Konfekt
Konfekt / git-multihook.sh
Last active November 27, 2023 09:26
use global git hooks as fallback to local hooks
View git-multihook.sh
#!/usr/bin/env bash
#
# Adaption of https://github.com/majutsushi/etc/commit/e62904088c698e064c17522d54dff91b629ee253#diff-53b7e445a85984949f551c277d4cc4ee9682287cb234e075e6d352be887e7494
# with https://github.com/pivotal-cf/git-hooks-core/blob/master/.base-hook
#
# This script is meant to be put into a directory pointed to by core.hooksPath
# in Git 2.9.
# Then for each hook you want to support, create a symlink "hookname -> git-multihook.sh"
# and optionally a directory "hookname.d" where you can put all scripts for
# that hook
@Konfekt
Konfekt / .xbindkeys.sh
Last active May 16, 2023 11:44
xbindkeys bindings to copy recognized (OCRed) text of rectangular selection or current window to clipboard (similar to Text Extractor of Powertoys under Microsoft Windows)
View .xbindkeys.sh
# Uses ksnip to select a rectangular region. Other options, instead of
#
# ksnip --rectarea --saveto "$file"
#
# are
#
# - spectacle --background --region --output "$file"
# - xfce4-screenshooter --region --mouse --save "$file"
# - maim --select --hidecursor --quiet "$file"
View MoveMouseToMonitorV6.ahk
; Original author: Joe Winograd 21-Aug-2021
; Converted to AHK v2 by Enno 24-Apr-2023
Version:="6"
#SingleInstance Force ; replace old instance immediately
InitializeVars() ; initialize all variables
ConfigureInitialTray() ; configure initial system tray (notification area)
Return
InitializeVars()
@Konfekt
Konfekt / ulister.ini
Created April 17, 2023 05:35
Universal Lister Total Commander plugin setup file to exclude common text files to be rather shown by a text viewer such as Cuda Lister
View ulister.ini
[ulister]
noloadtypes=1999,1118,1119,1170,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093
nopreviewtypes=1999,1118,1119,1170,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093
@Konfekt
Konfekt / Everything.ini
Created April 17, 2023 05:34
Everything configuration lines to exclude human unreadable, cache and temp files
View Everything.ini
[Everything]
exclude_folders="*\\temp","*\\tmp","*\\.cache","*\\*cache","*\\Trash","Trash-0","*\\.git","*\\.hg","C:\\Windows\\WinSxS","C:\\Windows.old","C:\\System Volume Information","C:\\$WinREAgent","C:\\Recovery","C:\\Config.Msi","C:\\Intel","C:\\PerfLogs","C:\\Users\\Default","C:\\Users\\Public","*\\scoop\\cache","*\\scoop\\buckets","*\\.cxoffice","*\\.wine","*\\okular\\docdata","*\\.local\\state\\vim","Z:\\.snapshots","Z:\\media","Z:\\mnt","Z:\\run","Z:\\dev","Z:\\proc","Z:\\sys","Z:\\tmp","Z:\\var\\run","Z:\\var\\lock","Z:\\var\\tmp","Z:\\var\\lib\\systemd\\coredump","Z:\\lib\\modules\\*\\volatile\\.mounted","*mozilla\\firefox","*\\syncthing\\index*"
exclude_files=~$*;*~;*.swap;*.temp;*.tmp;tags;thumbs.db;desktop.ini;*.pyc;*.pyo;*.out;*.toc;*.fls;*.fmt;*.fdb_latexmk;*.synctex;*.synctex.gz;*.synctex.gz(buzy);*.pdfsync;confdefs.h;*.elc;*.qmlc;config.status;.histfile.*;*.rej;*.jsc;lzo;*.blg;confstat;*.toc;moc_*.cpp;*.orig;*.po;litmain.sh;libtool;ui_*.h;*.lot;CTestTestfile.cmake;cmake_install.cmake;*.nvram
@Konfekt
Konfekt / prepare-commit-msg.py
Last active November 18, 2023 21:01
let ChatGPT write a sensible commit message using an adaptable Python script
View prepare-commit-msg.py
#!/usr/bin/env python3
# Adaption of https://github.com/tom-doerr/chatgpt_commit_message_hook/main/prepare-commit-msg
#
# Mark this file as executable and add it into the global hooks folder
# whose path is given by the core.hooksPath configuration variable
import sys
# # check to skip prepare-commit-msg during rebase or merges
@Konfekt
Konfekt / xdg-open
Last active December 2, 2023 11:14
drop-in replacement for xdg-open forwarding to more robust file open handlers of common desktop environments
View xdg-open
#!/usr/bin/env bash
linux_open_handler="$(type 2> /dev/null -a xdg-open | head | tail -n 1)"
linux_open_handler=${linux_open_handler#* * }
if [ "$linux_open_handler" = "$0" ]; then
linux_open_handler=""
fi
# xdg-open falls back to DE open handler if XDG_CURRENT_DESKTOP set
@Konfekt
Konfekt / persian-banan.vim
Created January 6, 2023 09:28
persian transliterate (finglish) keymap
View persian-banan.vim
scriptencoding utf-8
" Adapted from http://www.persoarabic.org/content/generated/doc.free/mohsen/PLPC/120036/current/accessPage/index.html#farsi-transliterate-bananPersianInputMethod
" Use this short name in the status line.
let b:keymap_name = "per"
loadkeymap
1 ١ " Arabic_1
@Konfekt
Konfekt / arabic-qwerty.vim
Last active December 6, 2022 08:15
arabic phonetic keymap
View arabic-qwerty.vim
scriptencoding utf-8
" Arabic phonetic keyboard from http://arabic.omaralzabir.com/
" at https://github.com/suryaya/Arabic-Phonetic-Keyboard-Linux
" See also https://r.nf/r/learn_arabic/comments/etj8x4/i_made_an_arabic_phonetic_keyboard_for_linux/
" Use this short name in the status line.
let b:keymap_name = "ara"
loadkeymap
@Konfekt
Konfekt / persian-qwerty.vim
Last active January 5, 2023 13:15
persian phonetic keymap
View persian-qwerty.vim
scriptencoding utf-8
" Adapted from https://github.com/gpuminingir/Farsi-Phonetic-Keyboard-Linux/blob/main/ubuntu_ir_keyboardlaout_qwerty
" to fit https://www.jahanshiri.ir/keyboard/phonetic/en/ .
" See also https://www.facebook.com/PersianPhoneticKeyboardLayout/
" Use this short name in the status line.
let b:keymap_name = "per"
loadkeymap