mod_spox 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/CHANGELOG +31 -1
  2. data/LICENSE +674 -0
  3. data/README.rdoc +73 -0
  4. data/bin/mod_spox +28 -28
  5. data/data/mod_spox/extras/AOLSpeak.rb +2 -3
  6. data/data/mod_spox/extras/AutoKick.rb +10 -23
  7. data/data/mod_spox/extras/AutoMode.rb +12 -23
  8. data/data/mod_spox/extras/Bash.rb +55 -0
  9. data/data/mod_spox/extras/Bouncer.rb +85 -57
  10. data/data/mod_spox/extras/Bullshit.rb +1 -1
  11. data/data/mod_spox/extras/Bytes.rb +1 -2
  12. data/data/mod_spox/extras/Confess.rb +27 -29
  13. data/data/mod_spox/extras/DCC.rb +11 -20
  14. data/data/mod_spox/extras/DevWatch.rb +21 -23
  15. data/data/mod_spox/extras/DownForEveryoneOrJustMe.rb +47 -0
  16. data/data/mod_spox/extras/EightBall.rb +1 -1
  17. data/data/mod_spox/extras/FML.rb +35 -0
  18. data/data/mod_spox/extras/Headers.rb +31 -50
  19. data/data/mod_spox/extras/Karma.rb +81 -29
  20. data/data/mod_spox/extras/Logger.rb +2 -2
  21. data/data/mod_spox/extras/LolSpeak.rb +1 -2
  22. data/data/mod_spox/extras/PhpCli.rb +138 -8
  23. data/data/mod_spox/extras/PhpFuncLookup.rb +20 -23
  24. data/data/mod_spox/extras/Pinger.rb +1 -1
  25. data/data/mod_spox/extras/Quotes.rb +8 -10
  26. data/data/mod_spox/extras/RegexTracker.rb +2 -4
  27. data/data/mod_spox/extras/Roulette.rb +20 -27
  28. data/data/mod_spox/extras/RubyCli.rb +93 -0
  29. data/data/mod_spox/extras/Search.rb +17 -3
  30. data/data/mod_spox/extras/Seen.rb +150 -0
  31. data/data/mod_spox/extras/SlashdotHeadlineGenerator.rb +500 -0
  32. data/data/mod_spox/extras/Talk.rb +2 -4
  33. data/data/mod_spox/extras/Topten.rb +10 -12
  34. data/data/mod_spox/extras/TracTicket.rb +3 -5
  35. data/data/mod_spox/extras/Translate.rb +20 -22
  36. data/data/mod_spox/extras/Twitter.rb +118 -33
  37. data/data/mod_spox/extras/UrbanDictionary.rb +8 -17
  38. data/data/mod_spox/extras/Weather.rb +1 -2
  39. data/data/mod_spox/plugins/Authenticator.rb +93 -98
  40. data/data/mod_spox/plugins/Banner.rb +26 -56
  41. data/data/mod_spox/plugins/Helper.rb +5 -6
  42. data/data/mod_spox/plugins/Initializer.rb +4 -14
  43. data/data/mod_spox/plugins/Joiner.rb +1 -1
  44. data/data/mod_spox/plugins/Nicker.rb +13 -0
  45. data/data/mod_spox/plugins/Parter.rb +2 -2
  46. data/data/mod_spox/plugins/Permissions.rb +60 -0
  47. data/data/mod_spox/plugins/PluginLoader.rb +7 -12
  48. data/data/mod_spox/plugins/Ponger.rb +51 -0
  49. data/data/mod_spox/plugins/Quitter.rb +1 -2
  50. data/data/mod_spox/plugins/Servers.rb +57 -0
  51. data/data/mod_spox/plugins/Status.rb +3 -2
  52. data/data/mod_spox/plugins/Triggers.rb +9 -9
  53. data/lib/mod_spox/Bot.rb +109 -33
  54. data/lib/mod_spox/BotConfig.rb +2 -2
  55. data/lib/mod_spox/ConfigurationWizard.rb +12 -12
  56. data/lib/mod_spox/Database.rb +1 -4
  57. data/lib/mod_spox/Exceptions.rb +26 -0
  58. data/lib/mod_spox/Helpers.rb +29 -68
  59. data/lib/mod_spox/Loader.rb +23 -24
  60. data/lib/mod_spox/Logger.rb +19 -17
  61. data/lib/mod_spox/MessageFactory.rb +50 -24
  62. data/lib/mod_spox/Pipeline.rb +21 -7
  63. data/lib/mod_spox/Plugin.rb +27 -3
  64. data/lib/mod_spox/PluginManager.rb +28 -15
  65. data/lib/mod_spox/PriorityQueue.rb +69 -0
  66. data/lib/mod_spox/Socket.rb +93 -51
  67. data/lib/mod_spox/Sockets.rb +76 -63
  68. data/lib/mod_spox/Timer.rb +21 -141
  69. data/lib/mod_spox/Version.rb +14 -0
  70. data/lib/mod_spox/handlers/BadNick.rb +1 -1
  71. data/lib/mod_spox/handlers/Bounce.rb +5 -5
  72. data/lib/mod_spox/handlers/Created.rb +13 -5
  73. data/lib/mod_spox/handlers/Handler.rb +12 -3
  74. data/lib/mod_spox/handlers/Invite.rb +14 -8
  75. data/lib/mod_spox/handlers/Join.rb +24 -20
  76. data/lib/mod_spox/handlers/Kick.rb +22 -13
  77. data/lib/mod_spox/handlers/Mode.rb +42 -36
  78. data/lib/mod_spox/handlers/Motd.rb +4 -0
  79. data/lib/mod_spox/handlers/Names.rb +66 -39
  80. data/lib/mod_spox/handlers/Nick.rb +20 -14
  81. data/lib/mod_spox/handlers/Part.rb +25 -8
  82. data/lib/mod_spox/handlers/Ping.rb +11 -5
  83. data/lib/mod_spox/handlers/Pong.rb +9 -5
  84. data/lib/mod_spox/handlers/Privmsg.rb +25 -17
  85. data/lib/mod_spox/handlers/Quit.rb +13 -8
  86. data/lib/mod_spox/handlers/Topic.rb +4 -0
  87. data/lib/mod_spox/handlers/Welcome.rb +16 -24
  88. data/lib/mod_spox/handlers/Who.rb +64 -48
  89. data/lib/mod_spox/handlers/Whois.rb +92 -60
  90. data/lib/mod_spox/messages/incoming/Nick.rb +2 -2
  91. data/lib/mod_spox/messages/incoming/Privmsg.rb +1 -1
  92. data/lib/mod_spox/messages/incoming/Whois.rb +1 -0
  93. data/lib/mod_spox/messages/internal/EstablishConnection.rb +1 -1
  94. data/lib/mod_spox/messages/internal/PluginsReady.rb +10 -0
  95. data/lib/mod_spox/messages/internal/QueueSocket.rb +8 -0
  96. data/lib/mod_spox/messages/internal/Reconnect.rb +8 -0
  97. data/lib/mod_spox/messages/internal/UnqueueSocket.rb +8 -0
  98. data/lib/mod_spox/migrations/002_persistent_sigs.rb +14 -0
  99. data/lib/mod_spox/migrations/003_auth_restructure.rb +31 -0
  100. data/lib/mod_spox/migrations/004_mode_index_fix.rb +18 -0
  101. data/lib/mod_spox/migrations/005_nick_mode_nopark.rb +18 -0
  102. data/lib/mod_spox/models/Auth.rb +16 -46
  103. data/lib/mod_spox/models/AuthMask.rb +13 -0
  104. data/lib/mod_spox/models/Channel.rb +46 -27
  105. data/lib/mod_spox/models/Config.rb +10 -19
  106. data/lib/mod_spox/models/Group.rb +20 -8
  107. data/lib/mod_spox/models/Models.rb +1 -1
  108. data/lib/mod_spox/models/Nick.rb +105 -113
  109. data/lib/mod_spox/models/NickMode.rb +23 -9
  110. data/lib/mod_spox/models/Server.rb +12 -1
  111. data/lib/mod_spox/models/Setting.rb +12 -16
  112. data/lib/mod_spox/models/Signature.rb +28 -8
  113. data/tests/BotHolder.rb +24 -0
  114. data/tests/handlers/tc_BadNick.rb +21 -0
  115. data/tests/handlers/tc_Created.rb +24 -0
  116. data/tests/handlers/tc_Invite.rb +50 -0
  117. data/tests/handlers/tc_Join.rb +33 -0
  118. data/tests/handlers/tc_Kick.rb +32 -0
  119. data/tests/handlers/tc_Mode.rb +85 -0
  120. data/tests/handlers/tc_Names.rb +35 -0
  121. data/tests/handlers/tc_Nick.rb +55 -0
  122. data/tests/handlers/tc_Part.rb +44 -0
  123. data/tests/handlers/tc_Ping.rb +40 -0
  124. data/tests/handlers/tc_Pong.rb +28 -0
  125. data/tests/handlers/tc_Privmsg.rb +85 -0
  126. data/tests/handlers/tc_Quit.rb +40 -0
  127. data/tests/handlers/tc_Who.rb +50 -0
  128. data/tests/handlers/tc_Whois.rb +61 -0
  129. data/tests/models/tc_Auth.rb +34 -0
  130. data/tests/models/tc_Channel.rb +52 -0
  131. data/tests/models/tc_Config.rb +19 -0
  132. data/tests/models/tc_Nick.rb +142 -0
  133. data/tests/models/tc_NickMode.rb +40 -0
  134. data/tests/models/tc_Setting.rb +21 -0
  135. data/tests/models/tc_Signature.rb +14 -0
  136. data/tests/run_tests.rb +4 -0
  137. metadata +284 -212
  138. data/README +0 -36
  139. data/lib/mod_spox/Cache.rb +0 -57
  140. data/lib/mod_spox/Monitors.rb +0 -84
  141. data/lib/mod_spox/Pool.rb +0 -164
  142. data/lib/mod_spox/models/AuthGroup.rb +0 -16
  143. data/lib/mod_spox/models/ChannelMode.rb +0 -14
  144. data/lib/mod_spox/models/NickChannel.rb +0 -45
  145. data/lib/mod_spox/models/NickGroup.rb +0 -16
@@ -0,0 +1,500 @@
1
+ # ex: set ts=4 et:
2
+
3
+ # Slashdot Headline Generator
4
+ # keep nerds happy on those long network outages
5
+ # by pizza
6
+
7
+ class SlashdotHeadlineGenerator < ModSpox::Plugin
8
+ def initialize(pipeline)
9
+ super
10
+ add_sig(:sig => 'fake/.(?: (\d))?', :method => :random, :desc => 'Slashdot Headline Generator', :params => [:count])
11
+ add_sig(:sig => 'fake/.(?: (' + HeadlineGenerator.new.topics.keys.sort.join("|") + '))?', :method => :topic, :desc => 'Slashdot Headline Generator', :params => [:topic])
12
+ end
13
+
14
+ def random(m, params)
15
+ begin
16
+ params[:count] = params[:count].to_i
17
+ params[:count] = 1 if params[:count] < 1
18
+ params[:count] = 5 if params[:count] > 5
19
+ hg = HeadlineGenerator.new
20
+ say = ""
21
+ params[:count].times { say += hg.headline() + "\n" }
22
+ reply m.replyto, say
23
+ rescue Object => boom
24
+ error m.replyto, "Whoops. #{boom}"
25
+ end
26
+ end
27
+
28
+ def topic(m, params)
29
+ begin
30
+ reply m.replyto, HeadlineGenerator.new.topic(params[:topic])
31
+ rescue Object => boom
32
+ error m.replyto, "Whoops. #{boom}"
33
+ end
34
+ end
35
+ end
36
+
37
+ class HeadlineGenerator
38
+
39
+ def initialize()
40
+ @topics = {
41
+ #"apache" => { lambda{ Apache },
42
+ "apple" => lambda{ Apple() },
43
+ "ask" => lambda{ AskSlashdot() },
44
+ #backslash"" => lambda{ BackSlash() },
45
+ "book" => lambda{ BookReview() },
46
+ "bsd" => lambda{ BSD() },
47
+ "business" => lambda{ Business() },
48
+ "dev" => lambda{ Developers() },
49
+ #"entertainment" => lambda{ Entertainment() }
50
+ #"features" => lambda{ Features() },
51
+ "games" => lambda{ Games() },
52
+ #"geeksinspace" => lambda{ GeeksInSpace() },
53
+ "hardware" => lambda{ Hardware() },
54
+ #"idle" => lambda{ Idle() },
55
+ "interview" => lambda{ Interviews() },
56
+ "it" => lambda{ IT() },
57
+ "linux" => lambda{ Linux() },
58
+ #"media" => lambda{ Media() },
59
+ "news" => lambda{ News() },
60
+ #"polls" => lambda{ Polls() },
61
+ #"politics" => lambda{ Politics() },
62
+ "science" => lambda{ Science() },
63
+ "space" => lambda{ Space() },
64
+ "tech" => lambda{ Technology() },
65
+ "yro" => lambda{ YourRightsOnline() }
66
+ }
67
+ end
68
+
69
+ def topics()
70
+ @topics
71
+ end
72
+
73
+ def headline()
74
+ @topics[any(@topics.keys)].call
75
+ end
76
+
77
+ def topic(what)
78
+ if (@topics.key?(what))
79
+ @topics[what].call
80
+ else
81
+ headline()
82
+ end
83
+ end
84
+
85
+ def Apple()
86
+ foo = rand(3)
87
+ if(foo == 0)
88
+ "New " + AppleProduct() + " Release Features " + GoodBrowserFeature()
89
+ elsif(foo == 1)
90
+ "Apple " + AppleHireFire()
91
+ else
92
+ any([ "Turn", "Transform", "Hack" ]) + " Your " + AppleHardware() + " Into A " + any([ "Fishbowl", "Phaser", "RC Car", "Robot", "Webserver", "Vibrator", "Calculator", "Toaster", "Waterboard", "Coffee Machine", "Doorstop", "Brick" ])
93
+ end
94
+ end
95
+
96
+ def AppleHireFire()
97
+ any([ "Hires", "Re-Hires", "Eying", "Steals" ]) + [ " Former", "" ][rand(2)] + " " + TechCompany() + " " + Profession()
98
+ end
99
+
100
+ def AppleProduct() any([ lambda{ AppleSoftware() }, lambda{ AppleHardware() } ]).call; end
101
+ def AppleSoftware() any([ "OS9", "OS X", "iTunes", "iLife", "SnowLeopard", "Cheetah", "Panther" ]); end
102
+ def AppleHardware() any([ "iMac", "iPod", "iPhone", "MacBook", "Mighty Mouse", "Mac Mini", "Airport" ]); end
103
+
104
+ def AskSlashdot()
105
+ any([ "Encrypting", "Porting", "Taking Over", "Forking", "Selling", "Buying", "Saving", "Archiving" ]) + " " +
106
+ any([ "Abandoned", "Open Source", "Free", "Slow", "Closed Source", "Web-based", "Obsolete" ]) + " " +
107
+ any([ "Hardware", "Software", "Projects", "Drivers", "Operating Systems", "Frameworks", "Programming Languages", "Coffee Machines", "Missile Guidance Software", "Filesystems", "Media" ]) + "?"
108
+ end
109
+
110
+ def BookReview() "Book Review: " + BookReviewAdjective() + " " + ProgrammingLanguageOrFramework() end
111
+
112
+ def BookReviewAdjective()
113
+ if (0 == rand(2))
114
+ TechnoAdjective()
115
+ else
116
+ any([ "Ass-Out", "Balls-to-the-Walls", "Inside-Out", "Upside-down", "Kludge Your Way Through", "Learn Just Enough To Be Dangerous:", "Pig-Latin", "Buzzword-Compliant", "Outdated", "Ineffective" ])
117
+ end
118
+ end
119
+
120
+ def BSD()
121
+ os = NerdOS()
122
+ os + " " + OSVersion(os) + " " + NerdOSSuffix()
123
+ end
124
+
125
+ def Business()
126
+ foo = rand(5)
127
+ if(foo == 0)
128
+ Google()
129
+ elsif(foo == 1)
130
+ Microsoft()
131
+ elsif(foo == 2)
132
+ TechCompany() + " Unveils Potential " + VenerableProduct() + " Killer"
133
+ elsif(foo == 3)
134
+ TechCompany() + " " +
135
+ any([ "Considering", "Possibly" ]) + " " +
136
+ any([ "Purchasing", "Alliance with", "Merging with"]) + " " +
137
+ TechCompany() + "?"
138
+ else
139
+ TechCompany() + " Patents " + Patentable()
140
+ end
141
+ end
142
+
143
+ def Developers() any([ lambda{ MozillaDitchFeature() }, lambda{ IsDead() }, lambda{ BugPatched() }, lambda{ GNU() } ]).call; end
144
+
145
+ def IsDead() "Are " + NerdTopic().sub(/y$/, "ie") + "s " + DeadWords() + "?"; end
146
+ def BugPatched() LongTime()[0..-2] +"-Old Bug Discovered in " + NerdOS() + ", Patched in " + ShortTime() + "s"; end
147
+ def GNU() any([ lambda{ Stallman() } ]).call; end
148
+ def Stallman()
149
+ "Richard Stallman " +
150
+ any([ "Slams", "Decries", "Demonizes" ]) +
151
+ " Use of " +
152
+ any([ "Closed-Source", "Proprietary", "Web-based", "Ascii-Only", "Unicode", "English-Only" ]) + " " +
153
+ any([ "Software", "Hardware", "Firmware", "USB Sticks", "CDs", "Operating Systems" ]) +
154
+ " As " +
155
+ any([ "Capitalistic", "Fundamentally Unfree", "Stupid", "'Worse Than Hitler'" ])
156
+ end
157
+
158
+ def Games()
159
+ Game() + " " +
160
+ any([ "Breaks Everyone's Favorite", "Enhances", "Features New", "Promises Better", "Reconsiders", "Redesigns", "Restricts", "Rethinks", "Will Change How You Think About" ]) + " " +
161
+ any(["AI", "Weapons", "Cheats", "Controls", "Easter Eggs", "Graphics", "Levels", "Team-based Cooperation" ])
162
+ end
163
+
164
+ def Hardware()
165
+ any([ "ATI", "NVidia", "Open Source Graphics Collective" ]) + " " +
166
+ any([ "Secretly", "Purportedly", "Possibly", "Admittedly" ]) + " " +
167
+ any([ "Considers", "Cancels", "Reveals" ]) + " " +
168
+ any([ "Porting", "Adding Pipelines to", "Adding Cores to", "Open Sourcing", "New Features in", "Adding Shaders to", "Adding Raytracing to", "Upgrade to", "Production of" ]) + " " +
169
+ RandomGraphicsCardProduct()
170
+ end
171
+
172
+ def GraphicsPrefix() any([ "Open", "Phys", "GP", "Direct" ]); end
173
+ def GraphicsSuffix() any([ "X", "GL", "Gfx" ]); end
174
+ def RandomGraphicsCardProduct() GraphicsPrefix() + GraphicsSuffix() + [ "", ((rand(7)+2)*100).to_s ][rand(2)]; end
175
+
176
+ def IT()
177
+ foo = rand(2)
178
+ if foo == 0
179
+ TechnoAdjective() + " " +
180
+ any([ "Programming", "Studying", "Training", "Administration" ]) + " " +
181
+ any([ "Rituals", "Secrets", "Habits", "Theories", "Stories", "Experiences", "Close Calls" ])
182
+ else
183
+ "What's Your Favorite " + NerdTopic() + "?"
184
+ end
185
+ end
186
+
187
+ def Game() GameTitle() + " " + GameVersion() end
188
+ def GameTitle() any([ "Quake", "Doom", "The Sims", "Half-Life", "Call of Duty", "Warcraft", "TeamFortress", "Halo", "Guitar Hero", "Grand Theft Auto", "Final Fantasy" ]); end
189
+
190
+ def Interviews() "Ask " + TechOrganization() + " " + Profession() + " " + RandomName() end
191
+
192
+ def Linux() any([ lambda{ LinuxOS() }, lambda{ TorvaldsQuote() } ]).call; end
193
+
194
+ def LinuxOS() "Linux " + LinuxVersion() + " " + NerdOSSuffix() end
195
+ def LinuxVersion() "2.6." + (rand(185)+15).to_s; end
196
+
197
+
198
+ def TorvaldsQuote()
199
+ "Torvalds to " +
200
+ any([ "Users", "Administrators", "Everyone", "the Media", "Long-time Contributors", "Linux Volunteers", "Hard-working Subsystem Maintainers", "Linux Community" ]) + ": " +
201
+ any([ "Piss Off!", "You're All Stupid", "Bite Me", "You Are Idiots", "Shut Up" ])
202
+ end
203
+
204
+ def News() any([ lambda{ WebsiteOutage() }, lambda{ InaneNewsQuestion() } ]).call; end
205
+
206
+ def InaneNewsQuestion()
207
+ any([ "Do We Really Want", "Do We Really Need", "Don't We Have Enough" ]) + " " +
208
+ any([ "ISPs", "Vendors", "Software Companies", "Monopolies", "Advertisers", "DRM", "Watermarks", "Trademarks" ]) + " " +
209
+ any([ "Filtering", "In", "Monitoring", "Embedded in" ]) + " " +
210
+ any([ "Desktops", "Software", "the Workplace", "Entertainment", "Source Code", "Networks", "Schools", "Games" ]) + "?"
211
+ end
212
+
213
+ def Science() any([ lambda{ Physics() }, lambda{ Math() }, lambda{ Science() } ]).call; end
214
+
215
+ def Technology() any([ lambda{ SoftwareVS() }, lambda{ Top10() } ]).call; end
216
+
217
+ def SoftwareVS() SoftwareProduct() + " " + any([ "Takes On", "vs.", "Now Supports", "Drops Support for" ]) + " " + any([ "PDF", "Graphics", "Plaintext", "the Internet", "Email", "Unicode" ]); end
218
+
219
+ def Top10()
220
+ "Top 10 " +
221
+ any([ "Hottest", "Disastrous", "Best", "Worst", "Biggest", "Stupidest" ]) + " " +
222
+ any([ "Applications", "Operating Systems", "Programming Languages", "IDEs", "Debuggers", "PCs", "Products", "Technologies", "Decisions in Software" ])
223
+ end
224
+
225
+ def SoftwareProduct() any([ "MS Word", "Excel", "Visio", "Acrobat", "Photoshop", "Lotus Notes", "OpenOffice", "GNU Cash" ]); end
226
+ def YourRightsOnline() any([ lambda{ Encryption() }, lambda{ FileSharing() }, lambda{ UserDataStolen() }, lambda{ TinfoilHat() } ]).call; end
227
+ def Encryption() "Researchers Break " + TechnoRate() + " " + any(["Encryption", "Transmission", "Internet2" ]) + " Record"; end
228
+
229
+ def UserDataStolen()
230
+ any([ "Bank", "Corporation", "University", "Government", "Military" ]) + " " +
231
+ any([ "Misplaces USB Stick Containing", "Loses Harddrives Containing", "Sells Tape Drive Containing", "Mistakenly Gives Away", "Website Exposes" ]) + " " +
232
+ (rand(500)).to_s + " Million " +
233
+ any([ "Credit Card Numbers", "Social Security Numbers", "User Passwords" ])
234
+ end
235
+
236
+ def TinfoilHat()
237
+ any([
238
+ "Is " + (rand(20)+5).to_s + "-Gauge Tinfoil Really Thick Enough?",
239
+ GovOrg() + " Monitors Your " + PersonalThing(),
240
+ "Encrypting Your " + PersonalThing() + " Won't Thwart " + GovOrg(),
241
+ "Wouldn't " + any([ "You", "Aliens", "Your Mom", "Your Grandmother", "Your Boss" ]) + " Use " + NerdOS() + "?"
242
+ ])
243
+ end
244
+
245
+ def Microsoft()
246
+ any([
247
+ lambda{ Windows() },
248
+ lambda{ WindowsUpdate() },
249
+ lambda{ MicrosoftEvil() },
250
+ lambda{ MicrosoftRandom() }
251
+ ]).call
252
+ end
253
+
254
+ def Windows() WindowsPrefix() + " Windows " + WindowsVersion() end
255
+
256
+ def MicrosoftEvil()
257
+ "Microsoft's " +
258
+ any([ "Patents", "Pricing Policies", "Monopolistic Tactics", "Insecure Software", "High Prices" ]) + " " +
259
+ any([ "Crippling", "Destroying", "Maiming", "Hurting", "Poisoning", "Degrading" ]) + " " +
260
+ any([ "the Internet", "Operating Systems", "the Software Industry", "Society", "Open Source", "Blind Children", "Communities", "the Environment", "Users", "an Entire Generation" ])
261
+ end
262
+
263
+ def WindowsUpdate()
264
+ "Latest Windows " +
265
+ any([ "Patch", "Update", "Service Pack" ]) + " " +
266
+ any([ "Causes More Problems Than It Solves", "Destroys Network", "Contains Virus", "Is a Mess", "Less Than Optimal" ])
267
+ end
268
+
269
+ def MicrosoftRandom() "Microsoft " + EvilVerb() + " " + Victims() end
270
+ def FileSharing()
271
+ any([
272
+ lambda{EvilOrg() + " " + EvilVerb() + " " + Victims() },
273
+ lambda{ RIAA() }
274
+ ]).call
275
+ end
276
+
277
+ def RIAA()
278
+ foo = rand(2)
279
+ if (0 == foo)
280
+ "RIAA's " +
281
+ any([ "Next", "Newest", "Latest" ]) + " " +
282
+ any([ "Dirty", "Dubious", "Abominable", "Horrific", "Ludicruous", "Unconstitutional" ]) + " " +
283
+ any([ "Method", "Tactic", "Trick" ]) + ": " +
284
+ any([ "Pre-Sale", "Thought-based", "Random", "Thought-Crime", "Probabilistic", "Automated", "Pre-Pirating", "EULA-based" ]) + " " +
285
+ any([ "Taxes", "Lawsuits", "Trials", "Executions", "Waterboarding" ])
286
+ else
287
+ any([ "The Pirate Bay", "TPB" ]) + " " +
288
+ any([ "Continue", "Are Still At It", "Haven't Given In", "Haven't Given Up" ]) + " " +
289
+ any([ "Despite Being", "Even Though They Are" ]) + " " +
290
+ any([ "Homeless", "In Jail", "Dead", "in Somalia", "in Parliament", "Now Born-Again Christians", "Surrounded", "Wanted Dead or Alive", "Computerless" ])
291
+ end
292
+ end
293
+
294
+ def Google()
295
+ foo = rand(4)
296
+ if(foo == 0)
297
+ x = MundaneApp()
298
+ "New Google G" + x.sub(" ","") + " Beta Doesn't Just Reinvent the " + x
299
+ elsif(foo == 1)
300
+ "Google's Long-Awaited Web-based " + MundaneApp() + " Enters Beta"
301
+ elsif(foo == 2)
302
+ "Google's Next Recruits: World's Elite " + RandomProfession() + "s"
303
+ else
304
+ "Google Does It Again"
305
+ end
306
+ end
307
+
308
+ def WebsiteOutage() Website() + " Experiences " + ShortTime() + " Outage, Users " + BadNoun() end
309
+
310
+ def MozillaDitchFeature() "Mozilla To Ditch Firefox's " + GoodBrowserFeature() + " Support For Experimental " + StupidFuturisticFirefoxFeature() end
311
+
312
+ def NerdOSSuffix()
313
+ foo = rand(4)
314
+ if(foo == 0)
315
+ "Now Supports " + ArcaneFeature()
316
+ elsif(foo == 1)
317
+ any([ "Voted Best", "Smash Hit", "Cracked" ]) + " At " + NerdCon()
318
+ elsif(foo == 2)
319
+ "Forked"
320
+ else
321
+ "Released"
322
+ end
323
+ end
324
+
325
+ def Space()
326
+ any([
327
+ lambda{ SpaceRevelation() },
328
+ lambda{ SpaceCountry() },
329
+ lambda{ SpaceGeneric() },
330
+ lambda{
331
+ any([ "Probe", "Mission" ]) + " " +
332
+ any([ "Encounters", "Confronts" ]) + " " +
333
+ any([ "Strange", "Debilitating", "Horrifying", "Unexpected", "Damaging" ]) + " " +
334
+ any([ "Turbulence", "Smell", "Sights", "Residue" ]) + " " +
335
+ any([ "on", "Near", "In Vicinity of" ]) + " " +
336
+ any([ "Uranus" ])
337
+ }
338
+ ]).call
339
+ end
340
+
341
+ def SpaceRevelation()
342
+ any([ "CO2", "Water", "Ice", "Fossils", "Methane", "Rocks", "Storms", "Canals", "Artifacts", "Impact Craters", "Strange Patterns" ]) +
343
+ " On " +
344
+ any([ "Moon", "Mars", "Phobos", "Deimos", "Io", "Europa", "Ganymede", "Jupiter", "Saturn", "the Sun" ]) + " " +
345
+ any([ "Could", "May" ]) + " " +
346
+ any([ "Indicate", "Signal", "Foretell", "Affect", "Hint at", "Explain the End of" ]) + " " +
347
+ any([ "Life as We Know It", "Early Life", "the Early Solar System", "Alien Dinosaurs", "Future Space Travel", "Acient Biosphere", "Sunspots", "Mystery Transmissions" ])
348
+ end
349
+
350
+ def SpaceCountry()
351
+ any([ "U.S.", "Canada", "Russia", "China", "Europe" ]) + " " +
352
+ any([ "On Path To", "Takes Aim at", "Looks Towards", "Contemplating" ]) + " " +
353
+ any([ "Moonbase", "Advanced Satellites", "Mars Exploration", "Mars Missions", "Mars Colony" ])
354
+ end
355
+
356
+ def SpaceGeneric()
357
+ [ SpaceAgency(), SpaceVessel(), SpaceVerb(), SpaceBullshit() ].join(" ")
358
+ end
359
+
360
+ def Physics()
361
+ foo = rand(1+1-0)
362
+ if foo == 0
363
+ any([ "Elusive", "Virtual", "Quantum", "Puzzling", "\"Impossible\"" ]) + " " +
364
+ PhysicsBullshit() +
365
+ " Particle " +
366
+ any([ "Discovered", "Never Existed", "Theorized", "Modeled", "Observed", "Detected" ])
367
+ else
368
+ ParticleAccelerator()
369
+ end
370
+ end
371
+
372
+ def ParticleAccelerator()
373
+ foo = rand(3)
374
+ if(foo == 0)
375
+ LastName() + " Particle Accelerator Data Will Take " + LongTime() + " to Process"
376
+ elsif(foo == 1)
377
+ "Particle Accelerator " + any([ "Repairs", "Upgrade", "Construction", "Tune Up", "Systems Test", "Reboot" ]) + " Will " + any([ "Take " + LongTime(), "Cost $" + BigNumber() ])
378
+ else
379
+ LastName() + " Particle Accelerator Bug Means " + LongTime()[0..-2] + " Delay"
380
+ end
381
+ end
382
+
383
+ def Math()
384
+ [
385
+ any([ "New", "Existing", "Surprising", "Optimized", "Powerful", "Exponential" ]),
386
+ any([ "Pattern", "Algorithm", "Power Series", "Financial Model", "Sequence", "Non-Euclidean Geometery" ]),
387
+ any([ "Discovered in", "Found in", "Explains", "Simplifies", "Derived From", "Sheds Light on", "Changes Our Understanding of", "Has Huge Ramifications for" ]),
388
+ any([ "Prime Numbers", "Stock Market", "Financial Markets", "Evolution", "the Cosmos", "Spacetime", "String Theory", "Fluid Dynamics", "Soap Bubbles", "Knots", "Turbulence" ])
389
+ ].join(" ")
390
+ end
391
+
392
+ def NerdOS()
393
+ foo = rand(3)
394
+ if(foo == 0)
395
+ "Linux"
396
+ elsif(foo == 1)
397
+ RandomBSD()
398
+ else
399
+ RandomOS()
400
+ end
401
+ end
402
+
403
+ def BigNumber() (rand(990)+10).to_s + " " + any([ "Million", "Billion", "Trillion" ]); end
404
+
405
+
406
+ def ProgrammingLanguageOrFramework() any([ lambda{ ProgrammingLanguage() }, lambda{ Framework() } ]).call; end
407
+ def ShortTime() (rand(59)+1).to_s + " " + ShortTimeUnit() end
408
+ def LongTime() (rand(6)+5).to_s + " " + LongTimeUnit() end
409
+ def RandomBSD() Prefix() + "BSD"; end
410
+ def RandomOS() Prefix() + "OS"; end
411
+
412
+ def GameVersion() (2+rand(8)).to_s; end
413
+
414
+ def SimpleVersion() rand(10).to_s; end
415
+
416
+ def OSVersion(os)
417
+ if("Linux" == os)
418
+ LinuxVersion()
419
+ else
420
+ Version()
421
+ end
422
+ end
423
+
424
+
425
+ def Version()
426
+ ver = SimpleVersion() + "." + SimpleVersion()
427
+ if rand(2) == 0
428
+ ver = ver + "." + SimpleVersion()
429
+ end
430
+ ver
431
+ end
432
+
433
+ def ArcaneFeature() TechnoAdjective() + " " + TechnoNoun() + " " + TechnoVerb() end
434
+ def NerdCon() Prefix() + "Con"; end
435
+ def StupidSoftwareName() Consonant().to_s.upcase() + Vowel() + Vowel() + Consonant() + Vowel() end
436
+
437
+ def any(l); l[rand(l.length)]; end
438
+
439
+ def WindowsPrefix()
440
+ any([
441
+ "Critical Vulnerability Discovered in",
442
+ "Microsoft Discontinues Support for",
443
+ "Hackers Poke Holes in",
444
+ "Linux Performance Trumps",
445
+ "What Can't You Do In Linux You Can Do In"
446
+ ])
447
+ end
448
+
449
+ def Prefix() any([ "Free", "Net", "Open", "Source", "Nerd", "StarTrek", "React", "Hacker", "Wifi", "Shmoo", "Foo" ]); end
450
+ def NerdTopic() any([ "Text Editor", "Regular Expression", "Database Query", "Functional Programming Language", "Hacking Technique", "Stack-Smasher", "Cmdline", "Keyboard Shortcut", "Spam Solution", "Algorithm", "x86 Opcode", "DRM Workaround", "Filesharing Strategy", "Micro-Optimization", "Design Pattern" ]); end
451
+ def VenerableProduct () any([ "Google", "Oracle", "Relational Database", "Windows", "Wifi", "TCP", "HTTP", "Search Engine", "Desktop", "Server" ]); end
452
+ def TechnoAdjective() any([ "Recursive", "Front-end", "Back-end", "Object-Oriented", "Extreme", "Efficient", "Optimized", "Obfuscated", "Flash-based", "Cached", "Content-based", "Effective", "P=NP", "P!=NP", "Linear", "Functional", "O(log n)", "O(n)", "O(n^2)" ]); end
453
+ def TechnoNoun() any([ "Filesystem", "Kernel", "Module", "Dependency", "Touchscreen", "Pen Input", "USB", "Serial Port", "SCSI", "Storage", "TCP", "CPU", "Network" ]); end
454
+ def TechnoVerb() any([ "Unloading", "Loading", "Injection", "Healing", "Filtering", "Balancing" ]); end
455
+ def WindowsVersion() any([ "3.11", "95", "98", "ME", "XP", "Server 2003", "Vista", "7" ]); end
456
+ def ProgrammingLanguage() any([ "PHP", "Perl", "Python", "Ruby", "Lisp", "Lua" ]); end
457
+ def Framework() any([ "Drupal", "PHPMyAdmin", "Rails", "Django", "Twisted", "Google Gears", "MySQL" ]); end
458
+ def Website() any([ "CNN.com", "Facebook", "Digg", "Youtube", "MSNBC.com", "Yahoo.com", "Google.com", "GMail", "Twitter" ]); end
459
+ def TechCompany() any([ "Oracle", "Microsoft", "Sun", "Hewlett Packard", "Dell", "Yahoo!", "IBM" ]); end
460
+ def BadNoun() any([ "Angry", "Confused", "Oblivious", "Scared" ]); end
461
+ def ShortTimeUnit() any([ "Second", "Minute", "Hour" ]); end
462
+ def LongTimeUnit() any([ "Days", "Weeks", "Months", "Years", "Decades" ]); end
463
+ def EvilOrg() any([ "MPAA", "RIAA", "ISP" ]); end
464
+ def EvilVerb() any([ "Sues", "Hates", "Blocks", "Rootkits", "Monitors", "Cancels" ]); end
465
+ def Victims() any([ "Customers", "Contractors", "Users", "Visitors", "Children", "Computerless Grandmother" ]); end
466
+ def MundaneApp() any([ "Email", "Word Processor", "Text Editor", "Spreadsheet", "BIOS", "Database" ]); end
467
+ def SpaceAgency() any([ "NASA", "European Space Agency", "China" ]); end
468
+ def SpaceVessel() any([ "Shuttle", "Probe", "Satellite", "Rocket", "RamJet" ]); end
469
+ def SpaceVerb() any([ "Launched Toward", "Deploys", "Repairs", "Loses", "Headed For", "Docks With", "Links Up To" ]); end
470
+ def SpaceBullshit() any([ "Important Bolt", "Heatshield", "Experiment", "Sensor", "Orbit", "Mars", "Jupiter", "Saturn", "Uranus" ]); end
471
+ def Vowel() any("aeiou".split(//)); end
472
+ def Consonant() any("bcdfghjklmnpqrtvwxyz".split(//)); end
473
+ def GoodBrowserFeature() any([ "URLs", "Links", "Text", "Image", "Icons", "Mouse Pointer", "Tabs", "Extensions", "Multithreading", "HTTP/1.1", "Mouse Gestures", "Audio Support", "Scrolling" ]); end
474
+ def StupidFuturisticFirefoxFeature() any([ "Awesome Bar", "3D Hologram", "Klingon Language Support", "Invisible Icons", "Upside-Down Pages", "Single Pixel", "Neural Interface", "Joystick" ]); end
475
+ def PhysicsBullshit() any([ "Quasi", "Zig-Zag", "Upside-Down", "Triple-Flavored", "Inside-Out" ]); end
476
+ def Rate() "/" + any([ "sec", "min", "hr" ]); end
477
+ def Amount() any([ "kbit", "Mbit", "GBit", "Tbit", "Pbit", "Ybit" ]); end
478
+ def TechnoRate() (100+rand(900)).to_s + " " + Amount() + Rate() end
479
+ def RandomProfession() any([ "Janitor", "Gardener", "Architect", "Rollerskater", "Superintendent", "Chef", "Bicyclist", "Juggler", "Comedian" ]); end
480
+
481
+ def TechOrganization() StupidSoftwareName() + any(["Soft", "!", "Studios", " Corp"]); end
482
+ def Profession() any([ "CEO", "President", "Founder", "Chairman", "Project Lead", "Guru", "Architect", "Designer", "Creator", "Programmer" ]); end
483
+ def RandomName() FirstName() + " " + LastName() end
484
+ def FirstName() any([ "Arthur", "Bob", "Carl", "David", "Earl", "Fred", "George", "Harold", "Ivan", "Julia", "Kevin", "Larry", "Margaret", "Michael", "Nancy", "Rory", "Ted", "Tracy" ]); end
485
+ def LastName() any([ "Anderson", "Blevins", "Carmack", "Daniels", "Johnson", "Kelvin", "Morris", "Neilson", "Savage", "Smith" ]); end
486
+
487
+ def Patentable() MundaneComputerVerb() + " " + MundaneComputerNoun() end
488
+ def MundaneComputerVerb() any([ "Coloring", "Resizing", "Sorting", "Linking", "Printing", "Retrieving", "Storing" ]); end
489
+ def MundaneComputerNoun() any([ "Harddrives", "Text", "Images", "Messages", "Email" ]); end
490
+
491
+ def GovOrg() any([ "CIA", "NSA", "NRO", "FBI", "Military", "DARPA", "Management" ]); end
492
+ def PersonalThing() any([ "Phone Calls", "Emails", "Handwriting", "HAM Radio Broadcasts", "Dreams", "Nocturnal Emissions" ]); end
493
+ def DeadWords() any([ "Dead", "Obsolete", "Finished", "Worth It", "Valuable", "On the Way Out", "Stupid", "Done For" ]); end
494
+
495
+ end
496
+
497
+ #500.times{ puts HeadlineGenerator.new.topic("yro") }
498
+ #puts HeadlineGenerator.new.topic("yro")
499
+ #puts HeadlineGenerator.new.topics.keys.sort.join("|")
500
+