Skip to content

Instantly share code, notes, and snippets.

View wookietreiber's full-sized avatar
🎸

♫ Christian Krause ♫ wookietreiber

🎸
View GitHub Profile
@wookietreiber
wookietreiber / time.rules
Created May 26, 2020 08:12
Prometheus/Alertmanager rules for business hour based inhibition (Germany/Saxony)
---
groups:
- name: datetime
interval: 60s
rules:
- record: daylight_saving_time
expr: |
@wookietreiber
wookietreiber / README.md
Last active December 20, 2022 14:00
R - Command Line Interface (CLI) and RStudio - template

R - Interactive Sessions and Command Line Interface

This is a template for R projects that should work both on the command line as well as in an interactive session.

Template Files

The template is made up of three files:

  1. foo.r
@wookietreiber
wookietreiber / default.pa
Created November 29, 2015 10:44
stream with ffmpeg, pulseaudio.
# To record both mic and other audio input sources we need to add a named output sink. See:
# http://www.linuxquestions.org/questions/linux-software-2/alsa-and-pulseaudio-recording-multiple-input-devices-877614/
# http://www.youtube.com/watch?v=oJADNOY615Y&feature=player_embedded
# Add this to your /etc/pulse/default.pa file
load-module module-null-sink sink_name=stream
load-module module-loopback latency_msec=5 sink=stream
load-module module-loopback latency_msec=5 sink=stream
@wookietreiber
wookietreiber / git-ignore.sh
Created March 21, 2022 10:09
ignore files with git
#!/bin/bash
function usage { cat << EOF
usage: git ignore [--global|--local|--repo] PATTERN
ignores PATTERN in git
PATTERN may include wildcard. you may want to quote it:
# ignores all pdf files that are in the current directory
@wookietreiber
wookietreiber / afm-cleanup.sh
Created December 20, 2021 13:55
spectrum scale afm cleanup
#!/bin/bash
input=$1
while read -r file
do
orig="$file"
neu="${file}.sonich42xxx"
echo "orig: $orig"
@wookietreiber
wookietreiber / git-hook-shellcheck.sh
Last active April 27, 2021 05:15
git pre-commit hook to check shell scripts with shellcheck
#!/usr/bin/env bash
set -efu -o pipefail
# returns staged files
function staged.files {
if git rev-parse --verify HEAD &> /dev/null
then
against=HEAD
else
@wookietreiber
wookietreiber / xsv-grep.sh
Created August 5, 2020 10:08
search for pattern in column in XSV
#!/bin/bash
set \
-o errexit \
-o pipefail \
-o noglob \
-o nounset \
app=$(basename "$0" .sh)
@wookietreiber
wookietreiber / battery-notification.service
Last active April 29, 2020 19:31
battery notification
[Unit]
Description=battery notification
[Service]
Environment="DISPLAY=:0"
ExecStart=/bin/bash /path/to/battery-notification.sh 20 10
Type=oneshot
[Install]
WantedBy=default.target
@wookietreiber
wookietreiber / git-hook-lintr.r
Last active April 1, 2019 22:11
git pre-commit hook to check R scripts with lintr via littler
suppressMessages(library(lintr))
files <- commandArgs(trailingOnly = T)
messages <- function(file) {
result <- lint(file)
print(result)
return(length(result))
}