Advertisement
Guest User

BOFH Excuses

a guest
Sep 27th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.01 KB | None | 0 0
  1. #!/bin/python
  2.  
  3. """
  4. bofh.py: A Bastard Operator From Hell excuse generator.
  5. """
  6.  
  7. import notify2, random
  8.  
  9. # Odds of printing the optional fourth word, (0-100)
  10. FOUR_PCT = 10
  11.  
  12. FIRST = [
  13.     "Temporary", "Intermittant", "Partial", "Redundant", "Total",
  14.     "Multiplexed", "Inherent", "Duplicated", "Dual-Homed", "Synchronous",
  15.     "Bidirectional", "Serial", "Asynchronous", "Multiple", "Replicated",
  16.     "Non-Replicated", "Unregistered", "Non-Specific", "Generic", "Migrated",
  17.     "Localised", "Resignalled", "Dereferenced", "Nullified", "Aborted",
  18.     "Serious", "Minor", "Major", "Extraneous", "Illegal", "Insufficient",
  19.     "Viral", "Unsupported", "Outmoded", "Legacy", "Permanent", "Invalid",
  20.     "Deprecated", "Virtual", "Unreportable", "Undetermined", "Undiagnosable",
  21.     "Unfiltered", "Static", "Dynamic", "Delayed", "Immediate", "Nonfatal",
  22.     "Fatal", "Non-Valid", "Unvalidated", "Non-Static", "Unreplicatable",
  23.     "Non-Serious"
  24. ]
  25.  
  26. SECOND = [
  27.     "Array", "Systems", "Hardware", "Software", "Firmware", "Backplane",
  28.     "Logic-Subsystem", "Integrity", "Subsystem", "Memory", "Comms",
  29.     "Integrity", "Checksum", "Protocol", "Parity", "Bus", "Timing",
  30.     "Synchronisation", "Topology", "Transmission", "Reception", "Stack",
  31.     "Framing", "Code", "Programming", "Peripheral", "Environmental", "Loading",
  32.     "Operation", "Parameter", "Syntax", "Initialisation", "Execution",
  33.     "Resource", "Encryption", "Decryption", "File", "Precondition",
  34.     "Authentication", "Paging", "Swapfile", "Service", "Gateway", "Request",
  35.     "Proxy", "Media", "Registry", "Configuration", "Metadata", "Streaming",
  36.     "Retrieval", "Installation", "Library", "Handler"
  37. ]
  38.  
  39. THIRD = [
  40.     "Interruption", "Destabilisation", "Destruction", "Desynchronisation",
  41.     "Failure", "Dereferencing", "Overflow", "Underflow", "NMI", "Interrupt",
  42.     "Corruption", "Anomaly", "Seizure", "Override", "Reclock", "Rejection",
  43.     "Invalidation", "Halt", "Exhaustion", "Infection", "Incompatibility",
  44.     "Timeout", "Expiry", "Unavailability", "Bug", "Condition", "Crash", "Dump",
  45.     "Crashdump", "Stackdump", "Problem", "Lockout"
  46. ]
  47.  
  48. FOURTH = [
  49.     "Error", "Problem", "Warning", "Signal", "Flag"
  50. ]
  51.  
  52.  
  53. def generate_excuse():
  54.     if (random.randint(0, 100) <= FOUR_PCT):
  55.         four_words = True
  56.     else:
  57.         four_words = False
  58.  
  59.     if four_words:
  60.         return "{} {} {} {}".format(
  61.             FIRST[random.randrange(0, len(FIRST))],
  62.             SECOND[random.randrange(0, len(SECOND))],
  63.             THIRD[random.randrange(0, len(THIRD))],
  64.             FOURTH[random.randrange(0, len(FOURTH))]
  65.         )
  66.    
  67.     else:
  68.         return "{} {} {}".format(
  69.             FIRST[random.randrange(0, len(FIRST))],
  70.             SECOND[random.randrange(0, len(SECOND))],
  71.             THIRD[random.randrange(0, len(THIRD))]
  72.         )
  73.  
  74. def main():
  75.     notify2.init("BOFH")
  76.     n = notify2.Notification(
  77.         "BOFH Excuse",
  78.         generate_excuse(),
  79.         "security-low"
  80.     ).show()
  81.  
  82.  
  83. if __name__ == "__main__":
  84.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement