Skip to content

Instantly share code, notes, and snippets.

@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|