Skip to content

Instantly share code, notes, and snippets.

View calebj's full-sized avatar

Caleb Johnson calebj

View GitHub Profile
@fastjack
fastjack / Additional configuration for Telegraf
Last active December 4, 2022 13:14
Quick and dirty gateway metrics for telegraf on pfSense
[[inputs.exec]]
commands = ["/usr/local/libexec/telegraf/gateways.py"]
timeout = "5s"
data_format = "influx"
@beginor
beginor / snowflake-id.sql
Last active April 17, 2024 11:47
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@arm2arm
arm2arm / rebalance_zfs.sh
Created April 6, 2021 15:59
rebalance zfs for the cold data
# If you change some settings in the zfs dataset you should rebalance it in order to store data with this current settings.
# Usage:
# zfs set recordsize=1M data/archive
# sh ./rebalance_zfs.sh /data/archive| parallel -P 16 --eta
mypath=$1
find $mypath -type f | xargs -d '\n' -I{} echo "rsync -a --inplace \"{}\" \"{}.abcdef\";unlink \"{}\";mv \"{}.abcdef\" \"{}\" "