Skip to content

Instantly share code, notes, and snippets.

@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 / vim_mouse_2.ahk
Last active February 7, 2022 08:07
toggle vim_mouse_2.ahk (from https://github.com/4strid/vim_mouse_2.ahk) by Ctrl+; (similar to keynav on Linux)
#InstallKeybdHook
; vim_mouse_2.ahk
; vim (and now also WASD!) bindings to control the mouse with the keyboard
;
; Astrid Fesz-Nguyen
; 2019-04-14
;
; Last updated 2019-06-24
@Konfekt
Konfekt / add-vim-help.sh
Last active August 31, 2021 12:46
add missing Vim help to Vim plug-in repos
#!/usr/bin/env bash
# description: add missing Vim help to Vim plug-in repos
# usage: add-vim-help.sh repos/*
# where repos/* are folders containing cloned repos without Vim help files
# needs:
# - md2vim from https://github.com/FooSoft/md2vim
# - hub from https://github.com/github/hub/ to open a Github pull request
@Konfekt
Konfekt / git-diff.md
Last active December 11, 2023 09:52
git diff common binary files
@Konfekt
Konfekt / scope.sh
Last active May 24, 2024 11:44
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 / any2webm.sh
Last active March 13, 2021 09:31
convert video files into the WebM format in batches using ffmpeg (and preferrably GNU parallel)
#!/bin/sh
# convert video files into the WebM format in batches using ffmpeg (and preferrably GNU parallel)
# exit on error or use of undeclared variable or pipe error:
set -o errexit -o nounset -o pipefail
# -crf 10 : Constant Rate Factor (crf) gives video quality from 0 (lossless) to 63 (worst); default is 23.
# -c:a/v ... = transform the audio/video data using ...
# -b:a/v ... = audio/video bitrate is ...
@Konfekt
Konfekt / kc-sms.sh
Last active May 8, 2020 14:54
kc-sms - send SMS using KDEconnect on the command line
#!/bin/sh
if ! command -v kdeconnect-cli >/dev/null 2>&1; then
echo "kde-connect-cli not found! Please install KDE Connect."
exit 1
fi
if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
echo "kc-sms - send SMS using KDE Connect on the command line"
echo "usage: kc-sms <Phone Number> <Message> [Parameters]"
@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 / zathist.sh
Last active April 17, 2020 19:28
zathura MRU: filter in rofi all files viewed in zathura ordered by recency and view selection
#! /bin/sh
#
# Save this script as executable ~/bin/zathist.sh and
# add to ~/.xbindkeysrc the shortcut
#
# "$HOME/bin/zathist.sh"
# Control + Alt + z
#
# PDFs whose path matches this pattern will not be listed
@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