Skip to content

Instantly share code, notes, and snippets.

View tastytea's full-sized avatar

tastytea

View GitHub Profile
@tastytea
tastytea / addfromyoutube.sh
Last active May 21, 2018 09:30
Adds an Youtube video to MPD
#!/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}
@tastytea
tastytea / feiertag_cron
Last active May 10, 2018 08:51
Prüft, ob heute oder morgen ein feiertag ist.
#!/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
@tastytea
tastytea / tabname.html
Last active December 24, 2017 03:19
Rename title, show folder icon. For tab tree browser-extensions.
<?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
@tastytea
tastytea / urlhandler
Last active November 15, 2017 16:03
Open URLs based on regular expressions
#!/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
@tastytea
tastytea / srtadrm
Last active January 21, 2020 02:55
Remove ads from SRT files
#!/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"
@tastytea
tastytea / fetch_gaidao.sh
Last active September 19, 2017 14:46
Auf neue Ausgaben von der Gai Dao prüfen, herunterladen
#!/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')"
@tastytea
tastytea / 40-joystick.conf
Last active September 11, 2017 00:59
Use XBOX controller as mouse
# 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
@tastytea
tastytea / wintime
Last active September 11, 2017 00:59
Display time in window title
#!/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
@tastytea
tastytea / .gpg-mime-end
Last active September 11, 2017 00:59
procmail auto-encrypt
--MfFXiAuoTsnnDAfX
@tastytea
tastytea / gettemp.sh
Last active September 11, 2017 00:59
Get temperature and store in file, openweathermap
#!/bin/sh
API_KEY=""
CITY="Hamburg,de"
OUTPUT_FILE="/run/user/$(id -u)/gettemp.temperature"
RESULT=""
RETRY=0
if [ "${1}" != "" ]; then
CITY="${1}"