Skip to content

Instantly share code, notes, and snippets.

@StevenWolfe
StevenWolfe / distro
Created February 21, 2025 13:30
snmp scripts
#!/usr/bin/env sh
# See https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
# Detects which OS and if it is Linux then it will detect which Linux Distribution.
OS=$(uname -s)
REV=$(uname -r)
#MACH=$(uname -m)
if [ "${OS}" = "SunOS" ] ; then
OS=Solaris
@StevenWolfe
StevenWolfe / zfs-online-disks.sh
Created April 2, 2015 14:30
Bash script to return a list of online disks in a ZFS pool
#!/bin/bash
# Return a list of online disks for a storage pool
ONLINE=$(zpool status $1 | grep -Po "\S*(?=\s*ONLINE)")
DEVICES=()
while read -r line; do
if ! [ -b "/dev/disk/by-id/$line" ]; then
continue
@StevenWolfe
StevenWolfe / git_big_file.rb
Created October 8, 2014 14:19
Ruby script used to identify large files in a git repository, even if they aren't in HEAD. Taken from: http://stackoverflow.com/a/7945209/60724
#!/usr/bin/env ruby -w
head, treshold = ARGV
head ||= 'HEAD'
Megabyte = 1000 ** 2
treshold = (treshold || 0.1).to_f * Megabyte
big_files = {}
IO.popen("git rev-list #{head}", 'r') do |rev_list|
rev_list.each_line do |commit|