Skip to content

Instantly share code, notes, and snippets.

@Rychu-Pawel
Rychu-Pawel / TimeSpanExtensions.cs
Created April 29, 2021 08:37
TimeSpan Readable Ago String
public static class TimeSpanExtensions
{
// Inspired by @Peter answear from https://stackoverflow.com/questions/842057/how-do-i-convert-a-timespan-to-a-formatted-string
public static string ToReadableAgoString(this TimeSpan span, double justNowSecondsThreshold)
{
if (span.TotalSeconds < justNowSecondsThreshold)
return "just now";
return span switch
{
@Rychu-Pawel
Rychu-Pawel / zfs_health_check.sh
Last active March 12, 2023 09:18
ZFS Health Check script for monit. For detailed description and usage go to http://pawelrychlicki.pl/Article/Details/58/zfs-health-check-script-for-monit-09
#! /bin/bash
#
## ZFS health check script for monit.
## v1.0.2
#
## Should be compatible with FreeBSD and Linux. Tested on Ubuntu.
## If you want to use it on FreeBSD then go to Scrub Expired section and Trim Expired section
## and comment two Ubuntu date lines and uncomment two FreeBSD lines in Scrub Expired section.
## In Trim Expired section adjust the date format directly in the for loop's awk parameter.
#