Skip to content

Instantly share code, notes, and snippets.

View tribut's full-sized avatar
🕺
Never gonna give you up

Felix Eckhofer tribut

🕺
Never gonna give you up
View GitHub Profile
@tribut
tribut / btrfs-scrub.sh
Created September 15, 2015 21:45
Btrfs scrub cronjob with logs from systemd's journalctl
#!/bin/sh
# also see http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html
for fs in $(grep ' btrfs ' /proc/mounts | cut -d' ' -f1 | sort -u)
do
starttime="$(date "+%Y-%m-%d %H:%M:%S")"
logger "Starting btrfs scrub on $fs"
btrfs scrub start -Bd "$fs"
journalctl -q -k --since "$starttime" | grep BTRFS
@tribut
tribut / update-starship-config.sh
Created December 11, 2023 13:03
Combine multiple toml files for starship
#!/bin/bash
set -eEuo pipefail
CONF_FILE="$HOME/.config/starship.toml"
CONF_D="$HOME/.config/starship.d"
TEMPFILE="$(mktemp)"
starship preset -o "$CONF_D/99-nerd-font-symbols.toml" nerd-font-symbols
@tribut
tribut / ds102-3.yaml
Created August 6, 2019 14:26
Esphome config for DS102 (3 Gang)
substitutions:
device_name: your_device_name
friendly_name: "Your Device Name"
api_password: !secret api_password
ota_password: !secret ota_password
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
@tribut
tribut / ds102-1.yaml
Last active February 27, 2022 22:00
Esphome config for DS102 (1 Gang)
substitutions:
device_name: your_device_name
friendly_name: "Your Device Name"
api_password: "pass1"
ota_password: "pass2"
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
#!/bin/bash
set -eEuo pipefail
# docker run -d -t --name paperless-test -v $(pwd):/paperless ubuntu:focal /bin/bash
# docker exec -it paperless-test /bin/bash
apt update
apt install --no-install-recommends --assume-yes python3 python3-pip python3-dev fonts-liberation gnupg libpq-dev libmagic-dev mime-support unpaper tesseract-ocr imagemagick ghostscript optipng
@tribut
tribut / VirtualBox
Created July 5, 2019 10:02
Workaround for VirtualBox and dark mode themes
#!/bin/sh
# This is a workaround for Virtualbox drawing white text on light background
# when using dark mode, see https://www.virtualbox.org/ticket/18258
exec "$(which -a VirtualBox | grep -v "$(readlink -e "$0")" | head -n1)" -style Fusion "$@"
@tribut
tribut / jpgsplit.sh
Created April 9, 2018 11:57
Split Samsung Motion Photo from files and strip video from original file / Samsung Bewegungsaufnahme aus Datei extrahieren und Video aus Originalbild entfernen
#!/bin/bash
set -e
info() {
echo "$*" >&2
}
warn() {
info "WARNING: $*"
}
@tribut
tribut / git-safe-clone.sh
Last active November 10, 2019 11:49
Git clone with signature verification
#!/bin/sh
# Clone a git repository, but make sure that it has a valid signature
# before actually checking it out.
#
# Note that this will always clone the master branch and probably doesn't
# exactly behave like "git clone" in other ways.
set -e
fail() {
echo "$*" >&2
@tribut
tribut / mosh_pc.sh
Last active June 4, 2018 11:33
wrapper for mosh to work with ssh's proxycommand directive. this only makes sense if the target machine is directly reachable from the internet using udp (but probably not via tcp). usage: mosh_pc.sh [host as mentioned in .ssh/config] [public ip of host]
#!/bin/sh
# ########################################################## #
# wrapper for mosh to work with ssh's proxycommand directive #
# this only makes sense if the machine is directly reachable #
# from the internet using udp. #
# ########################################################## #
THISSCRIPT="`basename \"$0\"`"
REMOTE="$1"
@tribut
tribut / mosh_wrapper.sh
Created April 10, 2013 09:03
call mosh_pc.sh for list of hosts, mosh otherwise
#!/bin/bash
# ########################################################## #
# wrapper for mosh that will call mosh_pc.sh for a list of #
# host and mosh otherwise. see mosh_pc.sh why you might want #
# this. #
# ########################################################## #
# >> modify this
indirect_access=(asterix obelix idefix)