Instantly share code, notes, and snippets.

View addfromyoutube.sh
#!/bin/zsh
# Adds an Youtube video to MPD
if [ -z "${1}" ]; then
echo "usage: ${0} <URL>" >&2
exit 1
fi
# Split by newline
oldIFS=${IFS}
View feiertag_cron
#!/bin/sh
today="$(date +'%d.%m.%Y')"
tomorrow="$(date -d tomorrow +'%d.%m.%Y')"
for holiday in $(feiertage -region Niedersachsen $(date +'%Y') | awk '{print $1}'); do
if [[ "${holiday}" != "Niedersachsen" ]]; then
if [[ "${holiday}" == "${today}" ]]; then
echo "Heute ($(date +'%A')) ist ein feiertag."
fi
View tabname.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAQVSURBVFiF7Zc9bxxFGMd/M7t3e6/2OZEwCQVWlMIfAAkFIVNulYIaiQJaOj5AJD5ASoREhWihQ0inQBfJigKK0kXCxsQoFsb3unfel5mdGYp7yTp3jhNyUij4S492dnb3eX7zPDOzuyIMQ16n5GuN/l8A8AFu3LjhK6V+Nsa8d9EDQojcWvv5w4cPv1wZQJqmW5VK5Z2bN2/6SZLgnAPAWgswP5+2/Tt37tze3t7+/tGjR8crAVBKZdVq1R0dHdHpdHDOLTUAIQSbm5v5wcHBR8DtlQBordMsy8SlSxsYY7DWnglczIQQgmq1Wj88PPxie3v71qx/mZxz2lr78d7e3o/PBQCyLMu8TqdLp9OZA8yOsyDFQFtbW/VGo0Gz2UQIgRACACnlvB1FEffu3bsFPB/g8uXLab/f9zY2WmitFwCWlWKmOI4B5hBFi+MYY0ztvOBzgN3dXXXt2jXZ6/XmGQCWgsyyUdRsxMXgUsoZQOVCAABjjG0212SaZtw/tNz
View urlhandler
#!/bin/zsh
# Open URLs based on regular expressions
if [ -z "${1}" ]; then
print "usage: $(basename ${0}) URL [URL] ..." >&2
exit 1
fi
zmodload zsh/regex
View srtadrm
#!/bin/zsh
# Remove ads from SRT files with a list of POSIX extended regular expressions
zmodload zsh/regex
file="${1}"
newfile="${1}.tmp"
ad_re=(
"Advertise your product or brand here"
"OpenSubtitles.org"
View fetch_gaidao.sh
#!/bin/sh
# Auf neue Ausgaben von der Gai Dao prüfen, herunterladen
cd ~/Documents/Zeitungen/Gaidao
ausgaben="$(curl -s https://fda-ifa.org/gaidao/ausgaben/ \
| grep -Eo 'https://fda-ifa.org/gai-?dao-(nr-)?[0-9]+-[^/]*/')"
for ausgabe in ${ausgaben}; do
url="$(curl -s ${ausgabe} \
| grep -Eo 'https://fda-ifa.org/wp-content/uploads/[0-9]{4}/[0-9]{2}/[^ ]*\.epub')"
View 40-joystick.conf
# Use an XBOX controller as mouse in X.Org
Section "InputClass"
Identifier "Joystick"
MatchIsJoystick "on"
MatchDevicePath "/dev/input/event*"
Driver "joystick"
Option "StartKeysEnabled" "True"
Option "StartMouseEnabled" "True"
Option "MapButton1" "key=36" # A – Return
View wintime
#!/bin/sh
if [ -z "${1}" ]; then
echo "usage: ${0} <Window Title>" >&2
exit 1
fi
WINTITLE="${1}"
WINID=$(wmctrl -l | grep ${WINTITLE} | cut -d' ' -f1)
if [ -z "${WINID}" ]; then
View .gpg-mime-end
--MfFXiAuoTsnnDAfX
View gettemp.sh
#!/bin/sh
API_KEY=""
CITY="Hamburg,de"
OUTPUT_FILE="/run/user/$(id -u)/gettemp.temperature"
RESULT=""
RETRY=0
if [ "${1}" != "" ]; then
CITY="${1}"