Skip to content

Instantly share code, notes, and snippets.

@FiXato
Last active May 23, 2022 12:12
Show Gist options
  • Save FiXato/77968 to your computer and use it in GitHub Desktop.
Save FiXato/77968 to your computer and use it in GitHub Desktop.
Your random BOFH excuse calendar.
#!/usr/bin/env ruby
# encoding: utf-8
# Your random BOFH excuse calendar.
# Based upon the The Bastard Operator From Hell Stories written by Simon Paul Travaglia.
# And the list compiled by Jeff Ballard, http://jeffballard.us/
# Get the excuses from http://pages.cs.wisc.edu/~ballard/bofh/excuses
fp = File.expand_path('~/bin/bofh/excuses.txt')
lines = File.readlines(fp)
nr = rand(lines.size)
excuse = lines[nr].strip
# Choose one of {multiple,options} (thanks Narnach!):
excuse.gsub!(/\{.+?\}/) {|options| options.gsub(/\{|\}/,'').split(",").rand}
puts '[#%i] %s (%i chars)' % [nr,excuse,excuse.size]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment