Last active
May 23, 2022 12:12
-
-
Save FiXato/77968 to your computer and use it in GitHub Desktop.
Your random BOFH excuse calendar.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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