Peter Bohner

Notes

These are collections of useful snippets I have collected over the years. All on one page, for easy Ctrl+F searching.


Open Fronius Inverter Service Menu

  1. Press the 3rd button from the left until the display shows “00000”
  2. Then enter the service code: 77634

Growatt online Service Key

Current date in format: %Y%m%d use ~$ date '+%Y%m%d' to compute. For example 20230102 for the January 2, 2023.


Fix user not showing up in KDE settings

sudo qdbus --system --literal org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts.CacheUser $USERNAME

source


Automatically log into a tmux session

Put this at the end of your shell configuration file (.bashrc or .zshrc)

if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
  if tmux list-sessions > /dev/null; then
    exec tmux attach
  else 
    exec tmux
  fi
fi

This snippet will attach to an existing session, or create a new one unless you are already inside a TMUX or screen session.


NixOS: Run shell scripts with dependencies

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cowsay lolcat

echo CoOoOoL! | cowsay | lolcat

source


Total number of pages in PDF documents

requires: poppler_utils, bc

find . -name '*.pdf' -exec pdfinfo {} \; | grep Pages: | grep -Eo '[0-9]+' |  paste -s -d + - | bc      

Get drive temperatures of all SATA HDDs

as root:

for i in /dev/sd?; do echo "$i: $(smartctl -A $i | grep Celsius | cut -d '-' -f 2)" ; done