Insert Futurama header

Problem this snippet solves:

Insert a randomly selected Futurama quote into HTTP response traffic as an X- header. Apologies to Slashdot (http://mattiasgeniar.be/2008/08/28/there-are-http-headers-and-then-there-are-http-headers/)

Silly, useless, a waste of CPU, but meant solely for your own very important amusement.

Note: This is for BigIP 10.x only.

How to use this snippet:

  1. Place the futurama_quotes.class file on your BigIP in /var/class (make sure the permissions to the file make it readable; you may need to do a "chmod a+r /var/class/futurama_quotes.class" to get them right depending on how you uploaded/created the file).
  2. Create an external data group pointing to the file. In iRules:Data Group List, click create. Name the class "futurama_quotes", and set the type to "External File".

    • Path: /var/class/futurama_quotes.class
    • File Contents: String
    • Separator: leave the default
    • Access Mode: Read Only
  3. Add the rule to any VS with a HTTP profile, and sit back in the sweet knowledge that you're supplying the unwashed masses with humor they will likely never see.

Code :

when CLIENT_ACCEPTED {
set futurama_quote_list_size [class size futurama_quotes]
set random_index [expr {int (rand() * $futurama_quote_list_size)}]
set futurama_header [class element -name $random_index futurama_quotes]
set futurama_text [class element -value $random_index futurama_quotes]
}

when HTTP_RESPONSE {
HTTP::header insert X-$futurama_header "$futurama_text"
}

# External Class File
# Feel free to edit this class list in this Wiki if you have other favorite quotes!

"Bender" := "Bite my shiny metal ass!",
"Bender" := "I only know enough binary to ask where the bathroom is.",
"Bender" := "Gimme your biggest, strongest, cheapest drink.",
"Leela" := "This is by a wide margin the least likely thing that has ever happened.",
"Leela" := "This toads the wet sprocket.",
"Fry" := "You mean Bender is the evil Bender? I'm shocked! Shocked! Well not that shocked.",
"Fry" := "I must be a robot. Why else would human women refuse to date me?",
"Bender" := "They're tormenting me with uptempo singing and dancing!",
"Farnsworth" := "Sweet zombie Jesus!",
"Fry" := "I have more important things to do today than laugh and clap my hands.",
"Bender" := "Hooray, we don't have to do anything!",
"Bender" := "OK, but I don't want anyone thinking we're robosexuals.",
"Bender" := "Down with Bender!",
"Fry" := "No, no, I was just picking my nose.",
"Bender" := "I'm a fraud. A poor, lazy, sexy fraud.",
"Bender" := "There! That oughtta convert a few tailgaters.",
"Bender" := "Try this, kids at home!",
"Fry" := "Please, Mr. Nixon! We're appealing to your sense of decency!",
"Fry" := "These new hands are great. I'm gonna break them in tonight.",
"Bender" := "Shooting DNA at each other to make babies. I find it offensive!",
"Bender" := "Are you familiar with the old robot saying 'does not compute'?",
"Fry" := "Leela, Bender, we're going grave.",
"Bender" := "Now that's hospital dancing.",
"Bender" := "What do you mean 'we', flesh-tube?",
"Zoidberg" := "Hooray!",
"Farnsworth" := "Good news, everyone!",
"Bender" := "Lies, lies and slander!",
"Fry" := "I'll be whatever I wanna do.",
"Bender" := "This is the worst kind of discrimination. The kind against me!",
"Leela" := "You buy one pound of underwear and you're on their list forever.",
"Zoidberg" := "Friends! Help! A guinea pig tricked me!",
"Wong" := "Hey, let's go car shopping! My parents said if I got all B's they'd buy me a bar. And I got all C's!",
"Branigan" := "I've never heard of such a brutal and shocking injustice that I cared so little about.",
"Morbo" := "Kittens give Morbo gas.",
"Fry" := "It's just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?",
"Bender" := "Oh. Your. God.",
"Leela" := "At the risk of sounding negative, no.",
"Farnsworth" := "Everyone's always in favour of saving Hitler's brain. But when you put it in the body of a great white shark, ooohh! Suddenly you've gone too far!",
"Zoidberg" := "I don't trust that doctor. I bet I've lost more patients than he's even treated.",
"Branigan" := "If we hit that bullseye, the rest of the dominos will fall like a house of cards. Checkmate.",
"Fry" := "But existing is basically all I do!",
"Bender" := "I'm Bender, baby, please insert liquor!",
"Leela" := "Alright, This is the third hose fight I've broken up today, and the second using actual hoses.",
"Farnsworth" := "Yes, it's a perfect scale model of the universe's largest bottle. I put a tiny spaceship inside to keep it from being boring.",
"Zoidberg" := "Oh, I am SO into you!",
"Branigan" := "You win again, gravity!",
"Fry" := "Valentine's Day's coming? Aw crap! I forgot to get a girlfriend again!",
"Fry" := "My folks were always on me to groom myself and wear underpants. What am I, the pope?",
"Bender" := "You may need to metaphorically make a deal with the devil. By 'devil' I mean robot devil and by 'metaphorically' I mean get your coat.",
"Leela" := "Look Fry, you're a man and I'm a woman. We're just too different.",
"Bender" := "I say the whole world must learn of our peaceful ways. BY FORCE!",
"Bender" := "I've gone too far! Who does that guy think I am?",
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment