Skip to content

Instantly share code, notes, and snippets.

@dashbad
dashbad / gist:7337ade601f049a5087024476b61bd32
Created October 27, 2016 05:36
Find all mkv's in current directory and sum their durations in seconds
find . -maxdepth 1 -iname '*.mkv' -exec ffprobe -v quiet -of csv=p=0 -show_entries forma│····································
t=duration {} \; | paste -sd+ -| bc
@dashbad
dashbad / temp_hum_influx.py
Created September 13, 2016 10:50
Push DHT22 raspberry Pi readings to influxdb
#!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@dashbad
dashbad / zpool_capacity.sh
Created June 30, 2016 00:34
collectd exec script to collect zpool capacity information
#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
while sleep "$INTERVAL"; do
VALUE="$(zpool list -Ho capacity)"
VALUE="$(echo "${VALUE: :-1}")"
echo "PUTVAL $HOSTNAME/zpool_capacity/percent interval=$INTERVAL N:$VALUE"
done
@dashbad
dashbad / speedtest_tester.sh
Created June 30, 2016 00:33
Bash script to run speedtest-cli on freebsd (pfsense) and send results to influxdb
#!/usr/local/bin/bash
#This script requires speedtest-cli to function!!!!!!!!!!!!!!!!!!!!!!!
#Prepare to start the loop and warn the user
echo "Press [CTRL+C] to stop..."
#Store the speedtest results into a variable
results=$(/usr/local/bin/python2.7 /root/speedtest-cli --simple)
echo "$results"