Skip to content

Instantly share code, notes, and snippets.

@VolMi
VolMi / Marstek_Venus_Signal.yaml
Last active August 6, 2025 09:22
Home Assistant sensor for Marstek Venus battery storage
- sensor:
- name: "Marstek Quellsignal"
# Generate a hate-driven differential signal for the Marstek Venus E battery storage.
# We hate both throwing away energy into the grid and buying energy from the grid, but we hate one more than the other.
# By quantifying our bad feelings we can prioritize what to do if it's hard to reach zero.
# The trade-off becomes mostly relevant if the power oscillates a lot and we try to tame this oscillation by calmly accepting
# that less countersteering is better. Or if we move the target power to a non-zero value, because we anticipate future power jumps.
#
# The storage interprets the value as the difference between it's current power output (which I don't know) and the power required by the home.
# So this is the meaning of several example values from the perspective of the storage:
#!/bin/bash
NumCPU=$(grep -c ^processor /proc/cpuinfo)
NumJobs=$(calc -p "ceil(2*$NumCPU+1)")
export CONCURRENCY_LEVEL=$NumJobs
baseURL="https://www.kernel.org/pub/linux/kernel/v3.x/"
latest="$(curl -s $baseURL | sed -n 's|\(.*\)\(linux-\)\(.*\)\(\.tar\.xz<\)\(.*\)|\3|p' | sort --version-sort | tail -n1)"
[ ! "$latest" ] && { echo "Are we offline?" >&2; exit 1; }
@VolMi
VolMi / feeder
Last active December 22, 2015 17:59
stream precious random data to all intelligence services in the universe
#!/bin/bash
# Bashisms are embraced here and therefore used quite heavily.
#
# This script is meant to keep some folks a bit busy, who were never invited
# by yourself to share your data.
# The idea is that you use cloud storage to store your encrypted (real) files
# and additionally generate some randomized junk which should be
# indistinguishable from the encrypted data.
# We now do this by encrypting the junk as well.
#
@VolMi
VolMi / optimize_png.nemo_action
Last active June 29, 2025 14:03
Nemo action "Optimize PNG files"
[Nemo Action]
Active=true
Name=Optimize PNG files
Name[de]=PNG-Dateien optimieren
Comment=Reduce size of selected PNG files
Comment[de]=Die Dateigröße der gewählten PNG-Dateien reduzieren
Exec=optipng %F
@VolMi
VolMi / meld-diff.nemo_action
Last active June 29, 2025 14:03
Nemo action "Compare with meld"
[Nemo Action]
Active=true
Name=Compare with Meld
Name[cz]=Srovnání s meld
Name[de]=Mit meld vergleichen
Name[fr]=Comparer avec meld
Name[nl]=Vergelijk met meld
Comment=Show differences between files or directories
Comment[cz]=Ukázat rozdíly mezi souborama a složky
@VolMi
VolMi / cachefill
Last active December 15, 2015 03:08
cache the files *you* consider important in RAM
#!/bin/bash
#
# cachefill -- warm up the file cache and buffer of the Linux kernel
#
# *****
# ONLY IF YOU HAVE A LOT OF MEMORY!
# I think, something like at least 8 GB for a regular Desktop
# *****
#
#