Skip to content

Instantly share code, notes, and snippets.

View schtobia's full-sized avatar

Tobias Schmidl schtobia

View GitHub Profile
@schtobia
schtobia / wslg-x11.service
Created July 26, 2024 11:50
systemd service for bind mounting the WSL X11 socket to /tmp/.X11-unix
# SPDX-License-Identifier: LGPL-2.1-or-later
#
[Install]
WantedBy=multi-user.target
[Unit]
Description=Mount WSL X11 socket
ConditionPathExists=/tmp/.X11-unix
ConditionPathExists=/mnt/wslg/.X11-unix
@schtobia
schtobia / docker-compose.override.yml
Created June 2, 2023 10:59
docker-compose Override for mailcow
version: '2.1'
services:
nginx-mailcow:
labels:
traefik.enable: true
traefik.http.routers.moo.entrypoints: websecure
traefik.http.routers.moo.middlewares: commonSSLHeaders
traefik.http.routers.moo.rule: Host(`${ADDITIONAL_SERVER_NAMES}`)
traefik.htttp.routers.moo.tls: true

$2a$11$pDk8VFI6qoZ5ezpLHLYsS.eRyO4.JInB6Xp8JXLWUkPRB3rNsn/VG

@schtobia
schtobia / docker-compose.yml
Last active July 1, 2020 08:29
Motioneye docker-compose file
---
version: "3.7"
services:
motioneye:
image: ccrisan/motioneye:master-armhf
init: true
ports:
- "8081:8081"
- "80:8765"
environment:
#!/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 / merge-pdfs.sh
Last active June 5, 2020 12:31
Merge PDFs with images in 300dpi
#! /bin/sh
[ "$#" -lt 2 ] && { echo "Usage: $0 <outputfile> <inputfile> ..."; exit 1; }
output_file="$1"
shift
gs -dBATCH -dNOPAUSE -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite -o "$output_file" $@
@schtobia
schtobia / dex.md
Created May 29, 2018 09:08
Open .desktop files under bash
  1. check if dex is installed:

    vimes ~ » [ -x "$(which dex)" ] && echo "Dex is installed." || echo "Dex is not installed."
    Dex is not installed.
    vimes ~ » 
    
  2. so, install dex:

vimes ~ » sudo apt install dex

#! /usr/bin/env python3
import logging
import logging.handlers
logger = logging.getLogger("foo")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.handlers.SysLogHandler('/dev/log'))
logger.info("foobar")
@schtobia
schtobia / backup-etc
Last active November 12, 2016 17:46
Find and tar all changed config files in /etc. Kudos to blast_hardcheese https://serverfault.com/a/658796
#! /bin/bash
[ -z "$1" ] && { (>&2 echo "Usage: $0 <backup.tar>"); exit 1; }
touch "$1" || { (>&2 echo "Cannot write to $1"); exit 1; }
find /etc -type f | grep -vFf <(debsums -e 2>/dev/null | sed 's/[[:space:]]*OK$//') | xargs tar cf "$1" 2>/dev/null
@schtobia
schtobia / kill-zombies.sh
Last active August 1, 2016 07:13
Kill all zombies, with increasing vigor
#! /bin/sh
for current_signal in HUP TERM KILL SEGV;
do
ZOMBIES=$(ps -A -ostat,ppid | sed -rn 's/^[zZ][^[:space:]]*[[:space:]]*([0-9]+)/\1/p' | sort -nu);
[ -n "$ZOMBIES" ] && { kill -s $current_signal $ZOMBIES; sleep 2; } || true;
done