Skip to content

Instantly share code, notes, and snippets.

@Konfekt
Konfekt / any2webm.sh
Last active May 22, 2020
convert video files into the WebM format in batches using ffmpeg (and preferrably GNU parallel)
View any2webm.sh
#!/usr/bin/env bash
# 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
kc-sms - send SMS using KDEconnect on the command line
View kc-sms.sh
#!/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
Created Apr 23, 2020
mutt key binding to compile markdown to HTML
View markdown-to-html.muttrc
# 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 / fuzzyfind-recent-dir.zsh
Last active May 7, 2020
fuzzy find recently visited and subdirectories under ZSH by pressing `Ctrl-x,r`
View fuzzyfind-recent-dir.zsh
if command -v sk >/dev/null 2>&1; then
export FUZZYFINDER="sk --tiebreak=index"
elif command -v fzf >/dev/null 2>&1; then
export FUZZYFINDER="fzf --tiebreak=index"
elif command -v peco >/dev/null 2>&1; then
export FUZZYFINDER=peco
elif command -v fzy >/dev/null 2>&1; then
export FUZZYFINDER=fzy
else
return 1
@Konfekt
Konfekt / fuzzyfind-recent-dir.bash
Last active May 7, 2020
fuzzy find recently visited and subdirectories under Bash by pressing `Ctrl-x,r` (uses `pazi` available at https://github.com/euank/pazi)
View fuzzyfind-recent-dir.bash
if command -v sk >/dev/null 2>&1; then
export FUZZYFINDER="sk --tiebreak=index"
elif command -v fzf >/dev/null 2>&1; then
export FUZZYFINDER="fzf --tiebreak=index"
elif command -v peco >/dev/null 2>&1; then
export FUZZYFINDER=peco
elif command -v fzy >/dev/null 2>&1; then
export FUZZYFINDER=fzy
else
return 1
@Konfekt
Konfekt / zathist.sh
Last active Apr 17, 2020
zathura MRU: filter in rofi all files viewed in zathura ordered by recency and view selection
View zathist.sh
#! /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 Sep 27, 2020
add useful chocolatey packages after installation of Windows 10
View windows10-add-packages.ps1
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
choco install iobit-uninstaller autoruns
choco install shutup10 debotnet adwcleaner patchcleaner glaryutilities-free
choco install wsus-offline-update windows-10-update-assistant
@Konfekt
Konfekt / opensuse-add-packages.sh
Last active Nov 6, 2020
add useful program packages after installation of openSUSE
View opensuse-add-packages.sh
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 / opensuse-add-packages-school.sh
Last active Nov 24, 2020
Installation von openSUSE zusätzlichen Programmpaketen für die Oberstufe nach Installation des Betriebssystems
View opensuse-add-packages-school.sh
# Zum Installieren:
#
# 0. Mit dem Internet verbinden.
# 1. Windowstaste drücken
# 2. Konsole eingeben und Eingabetaste drücken
# 3. In der Konsole eingeben:
#
# curl -s https://gist.githubusercontent.com/Konfekt/33a3adfc7ad5f5f0bd55dee290654e02/raw/6c44d19be3011e1ff32b42243d1e6c1ce05bddfd/opensuse-essentials.sh | sudo bash /dev/stdin
#
@Konfekt
Konfekt / okular-markdown-preview-vim.md
Last active Feb 29, 2020
A dead-simple markdown previewer in Vim thanks to KDE's document viewer Okular
View okular-markdown-preview-vim.md

KDE's document viewer Okular renders markdown as HTML (and reloads it automatically on changes.) Thus, simply open the markdown file currently edited in Vim in Okular to be all set!

To start an GUI application from Vim, without freezing, hit-<enter> prompts or scrambling screen lines, one can add a command such as

if has('unix')
  command! -complete=shellcmd -nargs=1 -bang Silent execute ':silent !' . (<bang>0 ? 'nohup ' . <q-args> . '</dev/null >/dev/null 2>&1 &' : <q-args>) | execute ':redraw!'
You can’t perform that action at this time.