This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a snippet of how I added an idle timeout to the Axios. | |
My use case includes having an external abort signal that should abort the whole request. I also want to have axios-retry configured. | |
*/ | |
/* This is the idle manager class that includes most of the logic. The usage example is below. */ | |
export type AxiosIdleTimeout = { mergedSignal: AbortSignal; idleTimeoutSignal: AbortSignal; resetIdleTimeout: () => void; stopIdleTimeout: () => void; } | |
export default class AxiosIdleTimeoutManager { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a comparison-test of multiple IV counter increment functions I found on the internet and created myself. | |
The goal here was to pick the most reliable one. | |
`incrementIVOriginal` comes from https://stackoverflow.com/questions/49954020/is-it-possible-to-decipher-at-random-position-with-nodejs-crypto | |
Run with: | |
> npx ava | |
Output: | |
$ npx ava --timeout=10m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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. | |
# |