Skip to content

Instantly share code, notes, and snippets.

View krisraich's full-sized avatar
🖖
Fascinating

Kris krisraich

🖖
Fascinating
View GitHub Profile
@krisraich
krisraich / IteratorInterceptor.java
Created July 9, 2022 12:08
add processing to java iterator
public static <I,O> Iterable<O> iteratorInterceptor(final Iterable<I> iterable, final Function<I, O> processor) {
return () -> {
final Iterator<I> iterator = iterable.iterator();
return new Iterator<>() {
@Override
public boolean hasNext() { return iterator.hasNext(); }
@Override
public O next() { return processor.apply(iterator.next()); }
};
@krisraich
krisraich / reportZFS.py
Last active April 4, 2024 08:55
ZFS to InfluxDB Monitoring Script for TrueNas
# A python script that can be run on TrueNas without installing any further libs.
# This script send zpool iostat to an InfluxDB 2.
# Use this script if you want to avoid creating jails.
#
# Run on start with crontab (and avid sending emails on output):
# MAILTO=""
# @reboot /usr/local/bin/python /root/reportZFS.py &
import subprocess
import requests
@krisraich
krisraich / hibernation_btrfs_luks.md
Last active May 8, 2025 20:30
Enable Hibernate on BTRFS and LUKS

Enable Hibernate on BTRFS and LUKS using a Swap file

This is a setup on how to enable Hibernate on an LUKS encrypted Volume using a swap file. Why? Because if you are using an encrypted Swap partition, you'll have to enter your decryption password twice... and that's lame.

Tested on Manjaro.

1. Create Swap subvolume

btrfs subvolume create /swap

check: btrfs subvolume list /