Skip to content

Instantly share code, notes, and snippets.

View ngandrass's full-sized avatar

Niels Gandraß ngandrass

View GitHub Profile
@ngandrass
ngandrass / pactl-sink-switcher.sh
Created July 13, 2023 10:37
Switch current default audio sink to the next available sink using pactl
#!/usr/bin/env bash
#
# Switches the current default audio sink to the next available sink using pactl.
# Get all sinks via pactl
sinks=$(pactl list short sinks | cut -f 2)
# Get current default sink
current_sink=$(pactl info | grep "Default Sink" | cut -d ' ' -f 3)
@ngandrass
ngandrass / gptid_to_deviceid.sh
Created February 18, 2023 11:40
Map GPTID to disk / device identifier (e.g. ada0)
#!/bin/bash
# Create associative mapping array
declare -A GPTID_TO_DISKID
while read -r row; do
gptid=$(echo "$row" | cut -d ' ' -f1)
diskid=$(echo "$row" | cut -d ' ' -f3 | rev | cut -d 'p' -f2 | rev)
if [[ "$gptid" = "gptid"* ]]; then
GPTID_TO_DISKID[$gptid]=$diskid
@ngandrass
ngandrass / 51-rename-rode-rodecaster-pro-2.lua
Last active April 10, 2024 22:28
Rename RODE RODECaster Pro II outputs (sinks) and inputs (sources). To be used with PipeWire and WirePlumber.
-- Renames the outputs and inputs of the RODE RODECaster Pro II.
--
-- Place this file inside ~/.config/wireplumber/main.lua.d/
--
-- Tips on using the RODE RODECaster Pro II on Linux:
-- - Use PipeWire together with WirePlumber. I'm using the following packages on
-- Arch Linux: pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber.
-- Optional packages: qpwgraph
-- - Configure the RODE RODECaster Pro II to use the 'Pro Audio' profile
-- - Your node names might differ. Run `pactl list sinks` and `pactl list sources` to check assigned names.
@ngandrass
ngandrass / .gitlab-ci.yml
Created May 15, 2022 11:26
Simple GitLab CI/CD .gitlab-ci.yml configuration for Gradle (Java / JDK 17) projects. With Docker build and push to repository container registry.
image: gradle:7.4-jdk17-alpine
stages:
- build
- test
- packaging
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
@ngandrass
ngandrass / pdf-rotate-aliases.bash
Created January 19, 2022 06:34
bash/zsh shell aliases for PDF rotation via pdfjam: pdf90, pdf180, pdf270
# Alias definitions to rotate PDF documents
# These useful aliases were removed from pdfjam since version 3.02
alias pdf90="pdfjam --landscape --angle 90"
alias pdf180="pdfjam --angle 180"
alias pdf270="pdfjam --landscape --angle 270"
@ngandrass
ngandrass / spincheck.sh
Created September 20, 2020 13:46
FreeNAS / camcontrol disk spindown check shell script with logging
#!/bin/sh
###########################################################################
# spincheck.sh
#
# Determines the power status of given disks without waking them through
# usage of smartctl.
#
# Author: Niels Gandrass
# Version: 1.0
# Since: 15.05.2017
@ngandrass
ngandrass / to_utm.vba
Created May 13, 2020 15:50 — forked from kissmygritts/to_utm.vba
VBA lat long to UTM conversion
Function to_utm(x, y) As Collection
Dim coordinates As Collection
Set coordinates = New Collection
E = 0.00669438
R = 6378137
K0 = 0.9996
E2 = E * E
@ngandrass
ngandrass / update_git_mirrors.sh
Created February 8, 2018 14:01
Mirror and update git/GitHub repository mirrors via a bash script
#!/usr/bin/env bash
# Updates all git repository mirrors that sit in current
# directory with a folder name ending on .git.
#
# Also allows to add repositories. See usage.
#
# To remove a mirrored repository simply delete the folder.
function print_usage() {