Skip to content

Instantly share code, notes, and snippets.

@crpb
crpb / blauton.sh
Created October 22, 2021 19:34
First draft for adding registered bluetooth speakers or headsets to ~/.asoundrc for #osmc #kodi
#!/usr/bin/env bash
IFS=$'\n' BLAU_OUTPUT=( $(echo "exit" |bluetoothctl |grep Device |cat -A |cut -c59-) )
lines=${#BLAU_OUTPUT[@]}
for i in ${BLAU_OUTPUT[@]}; do addr+=(${i:0:17}); name+=(${i:18}); done
SKEL='pcm.PCMNAME {\n
type plug\n
slave.pcm {\n
@crpb
crpb / probackup_invoke.sh
Created November 7, 2021 02:50
Helper Script and functions for pg_probackup with which i run my cronjob's. The functions are also useful for ~backupuser/.bashrc|.zshrc.
#!/bin/bash
shopt -s expand_aliases
export BACKUPDIR=/mnt/to/nfs/dedup/storage/postgres/pg_probackup
INSTANCES () { pg_probackup-13 show -B $BACKUPDIR --format json |jq -r '. [].instance' ;}
SHOWBACKUP () {
if [ -z $@ ]; then
pg_probackup-13 show -B $BACKUPDIR
else
pg_probackup-13 show -B $BACKUPDIR --instance $1
@crpb
crpb / preseed.cfg
Last active March 30, 2022 21:59
My Base Debian Seed Template for simple virtual Machines. The Disk-layout is on purpose to be able to extend the Disk with no further investigation on the Guest-Level with `echo 1 > /sys/block/sda/device/rescan && growpart /dev/sda 1 && resize2fs /dev/sda1`
d-i debian-installer/locale string en_US
d-i localechooser/supported-locales multiselect en_US.UTF-8, de_DE.UTF-8
d-i keyboard-configuration/xkb-keymap select us
d-i netcfg/get_hostname string debian-raw
d-i netcfg/get_domain string unassigned-domain
d-i anna/choose_modules string network-console
d-i network-console/authorized_keys_url string http://URLTO/pub.key
d-i network-console/password password INSERTCOINH3R3
d-i network-console/password-again password INSERTCOINH3R3
d-i mirror/country string manual
@crpb
crpb / occ
Last active February 27, 2022 22:07
One OCC to maintain them all! Nextcloud, Owncloud-Possible OCC-Wrapper for local installations and Docker-Guests.
#!/usr/bin/env bash
SUDO=''
if [[ $EUID -ne 0 ]]; then
SUDO='sudo'
fi
if [ -f /var/www/nextcloud/occ ]; then
COMMAND="/usr/bin/php /var/www/nextcloud/occ"
if [[ $(whoami) != 'www-data' ]]; then
@crpb
crpb / dotfiles.sh
Last active February 13, 2022 07:50
Move all your beloved dotfiles to a subdirectory and automagically track changes with git
mkdir -p ~/.dotfiles
cd ~/.dotfiles
git init
cd ~/
find ~/ -maxdepth 1 -regextype posix-extended -regex '.*[.](bash|zsh|profile|Xresources|xinitrc|vimrc|function|alias|sig|tmux|xbind|netrc|nethack|fasd|viminfo|selected_editor|tool-versions).*' -type f,l -exec mv -t ~/.dotfiles/ '{}' \;
find ~/.dotfiles -maxdepth 1 -type f,l -exec ln -s -t ~/ '{}' \;
crontab -l | cat<<EOF |crontab -
*/5 * * * * bash -c "cd ~/.dotfiles && git add . && git commit -m \$(echo \$(date +\%Y\%m\%d\%H\%M))" >> /dev/null
EOF
@crpb
crpb / CheckMK_Local_Mailstore.py
Last active October 2, 2022 21:37
CheckMK Local-Check Mailstore Licenses Version Profiles
#!/usr/bin/python3
import os
import configparser
import sys
from mailstore.mgmt import ServerClient as ms_api
import requests
from datetime import datetime, timedelta
# Config-File
@crpb
crpb / Firefox-Pre-Task.ps1
Last active May 18, 2023 21:46
PDQ Deploy Firefox Auto-Download Package automatically in your own Language via a Pre-Task.
# Set the Version in which the Script is pasted.
#$ff_release = "Firefox"
$ff_release = "Firefox-ESR"
#For what purpose was this all?
$ff_lang = "de"
# Universal separator \o/
$sep = [IO.Path]::DirectorySeparatorChar
# 2023.05
# https://help.pdq.com/hc/en-us/articles/5719272144667-PDQ-Package-Library-Changelog
# PDQ changed their Auto-Download folder and filename schema
@crpb
crpb / fluxbox-apps-helper.sh
Last active April 9, 2022 01:26
Fluxbox Apps xprop shell-function to create an ~/.fluxbox/apps entry
#Fluxbox-Helper
fbxprop(){
echo -n "[app] "
xprop WM_CLASS WM_NAME WM_WINDOW_ROLE | sed 's/WM_\(.*\)(\(.*\)) = "//g;s/", "/\n/;s/"$//'| sed '1 s/^/(name=/;2 s/^/(class=/;3 s/^/(title=/;4 s/^/(role=/;s/$/)/g' | grep -v WM_WINDOW_ROLE |tr '\n' ' '
echo
echo "[end]"
}
/*
* This combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#dt/dt-1.11.3/af-2.3.7
*
* Included libraries:
* DataTables 1.11.3, AutoFill 2.3.7
@crpb
crpb / gen_hosts_yml.sh
Created May 21, 2022 04:44
ansible hosts.yaml generated from ssh_config files
#!/usr/bin/env bash
# Generate hosts.yaml from ssh_config-Includes
# Filename-Pattern "NNN_customer.ssh"
SRC="$HOME/git/ssh_config/*.ssh"
printf "all:\n children:\n"
for CONF in ${SRC}; do
BASE=$(basename "${CONF}")
GROUP=${BASE:4:-4}
HOSTS=$(awk '/^Host / {print $2}' "${CONF}"|sort|uniq)
printf ' %s:\n hosts:\n' "${GROUP}"