Skip to content

Instantly share code, notes, and snippets.

@Konfekt
Konfekt / mailcap
Last active December 8, 2023 11:27
mutt mailcap file to display attachments in mutt mail client
# From http://wiki.free-unices.org/doku.php/config/mutt/new_mailcap
application/vnd.oasis.opendocument.text; mutt_bgrun okular %s; test=test -n "$DISPLAY"
application/vnd.oasis.opendocument.text; odt2txt %s | cat --squeeze-blank; copiousoutput
# application/vnd.oasis.opendocument.text; pandoc --from=odt --to=plain %s | cat --squeeze-blank ; copiousoutput
# application/vnd.oasis.opendocument.text; libreoffice --cat %s | cat --squeeze-blank ; copiousoutput
application/vnd.oasis.opendocument.spreadsheet; mutt_bgrun libreoffice --nologo %s; test=test -n "$DISPLAY"
application/vnd.oasis.opendocument.spreadsheet; odt2txt %s | cat --squeeze-blank; copiousoutput
# application/vnd.oasis.opendocument.spreadsheet; libreoffice --cat %s | cat --squeeze-blank ; copiousoutput
@Konfekt
Konfekt / windows10-add-packages.ps1
Last active September 26, 2023 22:05
add useful chocolatey packages after installation of Windows 10
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
# remove bloat as in
# https://lifehacker.com/you-can-get-rid-of-windows-bloatware-with-one-command-1848707156
iwr -useb https://git.io/debloat | iex
iwr -useb https://christitus.com/win | iex
@Konfekt
Konfekt / opensuse-add-packages.sh
Last active June 6, 2023 05:33
add useful program packages after installation of openSUSE
if [ $(id -u) -ne 0 ]; then
echo "Please run as root, for example, by sudo!"
exit
fi
. /etc/os-release
version="$VERSION_ID"
z="sudo zypper --non-interactive --ignore-unknown --gpg-auto-import-keys --no-gpg-checks"
zin="$z install --download in-advance --recommends --auto-agree-with-licenses --replacefiles --force-resolution --no-confirm"
@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)
# 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"
@Konfekt
Konfekt / markdown-to-html.muttrc
Last active May 9, 2023 19:29
mutt key binding to compile markdown to HTML
# press M in the mutt compose menu before sending to convert
# the markdown syntax of the e-mail text into an HTML e-mail
macro compose M "<pipe-entry>tee /tmp/message.txt | pandoc --standalone --from markdown --to html --metadata title=Message --output=/tmp/message.html<enter><attach-file>/tmp/message.txt<enter><toggle-disposition><edit-description>Message in TEXT format<enter><edit-type><kill-line>text/plain; charset=utf-8<Enter><first-entry><detach-file><attach-file>/tmp/message.html<enter><toggle-disposition><edit-description>Message in HTML format<enter><edit-type><kill-line>text/html; charset=utf-8<Enter>" "attach HTML message converted from Markdown"
# alternatively, use discount instead of pandoc ...
# macro compose M "<pipe-entry>tee /tmp/message.txt | mkd2html > /tmp/message.html<enter>"
@Konfekt
Konfekt / view-attachments-mutt-windows-wsl.md
Last active May 9, 2023 19:27
View mail from Mutt in GUI Browser or E-Mail client under Windows, be it via WSL or Git Bash

To be able to view an E-Mail from Mutt under Windows either using the Windows Subsystem for Linux (WSL) or MSYS2 (as delivered with Git Bash)

  • in your default GUI E-Mail client by selecting the e-mail and hitting E(mail),
  • in your default GUI browser by selecting the attached HTML file and hitting B(rowser),

do as follows:

For WSL

Add to ~/.muttrc the lines

@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
[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
[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 / scope.sh
Last active March 28, 2023 09:33
scope.sh for text preview of office documents in ranger file manager (similar to mailcap file)
#!/bin/bash
# CUSTOM {{{
shopt -s nocasematch
# }}}
set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'
# If the option `use_preview_script` is set to `true`,
@Konfekt
Konfekt / persian-banan.vim
Created January 6, 2023 09:28
persian transliterate (finglish) keymap
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