Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Schmidl schtobia

View GitHub Profile
@schtobia
schtobia / docker-compose.yml
Last active Mar 27, 2020
Home Assistant docker-compose
View docker-compose.yml
---
version: '3.7'
services:
mqtt:
image: eclipse-mosquitto:latest
hostname: mqtt
init: yes
volumes:
- mosquitto_config:/mosquitto/config
- mosquitto_log:/mosquitto/log
@schtobia
schtobia / usb-blockdev.sh
Last active Jan 8, 2020
Device HMAC from USB serial
View usb-blockdev.sh
#! /bin/sh
openssl dgst -hmac `< /sys/class/block/sdb/device/model` -binary keyfile | base64
@schtobia
schtobia / ctags.md
Last active Dec 18, 2019
Generating a ctags file for libstdc++
View ctags.md

Generating a ctags file for libstdc++

Ripped off Stackoverflow and adapted to be version independent.

  • call the following script regularly via crontab

  • add the following line to $HOME/.vimrc:

    set tags+=$HOME/.cache/cpp_tags
    
View debdiffconf
#!/bin/bash
# Usage: debdiffconf.sh <filename>
# Produce on stdout, a diff of <filename> against the first installed Debian
# package found that provides it.
# Returns the exit code of diff if everything worked, 3 or 4 otherwise.
base_name=$(basename $0)
required=( apt-get apt-file diff dpkg-deb dpkg-query realpath)
@schtobia
schtobia / profiles.json
Last active Oct 25, 2019
Windows Terminal Settings
View profiles.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"keybindings":[],
"profiles":
[
{
"acrylicOpacity": 0.5,
"background": "#012456",
"colorScheme": "Campbell",
@schtobia
schtobia / aria2.daemon.sh
Last active Aug 14, 2019
firejail aria2
View aria2.daemon.sh
#! /bin/bash
RUNDIR="${XDG_DOCUMENTS_DIR:-$HOME/.local/share}/aria2"
SESSION_FILE="$RUNDIR/aria2.session"
LOG_FILE="${LOG_FILE:-$RUNDIR/aria2.log}"
[ ! -d $RUNDIR ] && mkdir $RUNDIR
[ ! -d $RUNDIR ] && { echo "Cannot create runtime dir $RUNDIR." >&2; exit 1; }
# if log size is not readable or too large, recreate it empty
[ "$LOG_FILE" != "-" ] && truncate -s0 $LOG_FILE
[ ! -r $LOG_FILE -a "$LOG_FILE" != "-" ] && { echo "Cannot create log file $LOG_FILE." >&2; exit 1; }
@schtobia
schtobia / enc-google
Last active Sep 28, 2018
EncFS on GDrive
View enc-google
#! /bin/bash
NAME=`basename $0`
BASEDIR="$XDG_RUNTIME_DIR/mount";
LOG_FILE=$(mktemp -p "${XDG_RUNTIME_DIR:-$TMPDIR}" "$NAME.XXXXXX")
[ ! -w "$LOG_FILE" ] && { echo "Logfile \"$LOG_FILE\" is not writeable." >&2; exit 1; }
trap "{ rm -f \"$LOG_FILE\"; exit $?; }" EXIT INT TERM HUP PIPE;
case $1 in
start)
mkdir -p $BASEDIR $BASEDIR/gdrive $BASEDIR/enc >"$LOG_FILE" 2>&1 && \
@schtobia
schtobia / BCM43142A0-105b-e065.hex
Created Sep 21, 2018
Firmware file for BCM43142A0 on Lenovo Edge E145
View BCM43142A0-105b-e065.hex
:020000040021D9
:8700000001060069999942041FC15E00000014222200001422223B02570258025802590259025A025A025B025B025C025C025D025D025E025E025F025F02600260026102610262026202630263026402640265026502660266026702670268026802690269026A026A026B281F0AFD0400FFFFFFFF400600000000A40100020A008700210000000000000003
:C800870041220042726F6164636F6D20426C7565746F6F746820446576696365202834333134322900980100035C01000172060003000708000193040020000000920600A300C80014648F0300020202B209000000008000000000006F210002331F05CF000000AA147F8C00AA00800A9200000000140000000000006C584E6C6A3600018011000000B0000000A0000000431008045310020180000000900000006310040273100402C1000000D000000022000000320000007C0400010A00020A05001C0A200001C4080078AA
:C8014F0000320000030000C30000C0000698F83100FFFFFFFFFF7F00009CF83100FFFFFFFF083B0000A0F83100FFFFFFFF06000000A4F83100FFFFFFFF5C340000A8F83100FFFFFFFF04000000ACF83100FFFFFFFF36300000B0F83100FFFFFFFF09000000B4F83100FFFFFFFFF5330000B8F83100FFFFFFFFC5C40000C0F83100FFFFFFFF00000000C4F83100FFFFFFFF35C90000ECF83100FFFFFFF
@schtobia
schtobia / regenerate-ctags
Last active Jul 2, 2018
regenerate ctags on edit
View regenerate-ctags
#! /bin/sh
watchmedo shell-command --patterns="*.cpp;*.hpp" --ignore-patterns='./__cmake_systeminformation*;./_build*;.' --wait \
--recursive --command="find . -path './_build' -prune -name '*.cpp' -or -name '*.hpp' -exec ctags --verbose=yes '{}' '+'"
View adblock-sync.sh
#! /bin/sh
jq -c '[.selectedFilterLists[] as $selected | .availableFilterLists[$selected] | select(.hasRemoteURL == true) | .remoteURL]' \
$HOME/.mozilla/firefox/*.default/browser-extension-data/uBlock0@raymondhill.net/storage.js | xargs -0 \
gsettings set org.gnome.Epiphany adblock-filters