A tale about Perl array vs scalar context and `fortune` has gone missing from the internet (edit: found it, see below). I'll do my best to recount it.
The story goes a kid in high school setup a web page that displayed fortunes from, well, fortune. He did this via a Perl CGI program. One day, fortune spit out the following quote just as a teacher was viewing the page:
I put the shotgun in an Adidas bag and padded it out with four pairs of tennis socks, not my style at all, but that was what I was aiming for: If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy. So I decided to get as crude as possible. These days, thought, you have to be pretty technical before you can even aspire to
crudeness. I'd had to turn both those twelve-gauge shells from brass stock, on the lathe, and then load then myself; I'd had to dig up an old microfiche with instructions for hand-loading cartridges; I'd had to build a lever-action press to seat the primers -all very tricky. But I knew they'd work. -- Johnny Mnemonic
Unfortunately due to the kid mistaking scalar vs array context, only the first line of the paragraph was displayed: I put the shotgun in an Adidas bag and padded it out with four pairs of tennis socks.
Missing the attribution, the teacher did not recognize this as a book quote. This resulted in police being called on the kid. Fortunately it was resolved w/o incident.
Now, I may be misremembering the story which isn't mine. I vaguely recall that maybe it was something Tom Christiansen used to tell? Maybe it appeared on Slashdot? Maybe it's apocryphal? I can't find the original.
The supplied fortune databases have been attacked, in order to correct orthographical and grammatical errors, and particularly to reduce redundancy and repetition and redundancy. But especially to avoid repetitiousness. This has not been a complete success. In the process, some fortunes may also have been lost.
Finding humor in a man page warms the heck out of my heart.
Sit right back and I'll tell you a tale. Fortune is a parasite glommed over the original intents of the Architecture of what is now known as Fortune.
Originally as the high gods intended the whole mess was nothing but a Rolodex, a box of index cards, etc.
You see, the first line of the '%' delimited records would be a 'LAST FIRST PHONE' and the rest would be for instance 'SMITH, JOE 867-5309' on the rest would be 'wife Mary, 3 kids (Joseph, Adam, Beth), maybe address, etc.'.
The '.dat' portion created by the 'strfile' would take that file and alphabetize it and then keep the 'seek' offsets in the file for each record. This let you have a big (for the time) Rolodex with fast retrieval upon search. Binary tree and all that, plus fast read of whole record because ... binary search, read one line match or not then difference between match and next record would be bytes needed to read (minus 1 for the '%'.
Fortune 'fortune(6)' started life as an address book,The random and multiple files and all that jazz was just a bunch of repurposing that took over and became a life of it's own. Nobody uses the 'first line sort' bit of 'strfile' program. Mostly the original has vanished into the wind, I have no clue what the command line thing was to bring up the Rolodex/Index Card of somebody was.
The 'man' page doesn't do it justice, but nobody really cares, and I like many others have a '~/quotes' file that is automated and hot-key bound to selecting a bit of text and preassing a couple of keys. If you know the https://en.wikipedia.org/wiki/Reservoir_sampling thing, you dont' even need the '.dat' file for the random bit.
A while ago I made a fortune database that draws from Marcus Aurelius's Meditations. I used to have a tmux pane that ran them on my work session boot script :)
I adopted the fortunes-it package on debian, after I think over 20 years of neglect.
Debian ships the offensive fortunes in a separate .deb so it needs to be installed on purpose, and it's not recommended by the regular one. But it's there.
I actually moved a bunch of stuff into the offensive section, or just removed them. Humour has changed a lot since the last time that package had been touched. Political jokes made little sense, talking about stuff that happened when I was a child and didn't really follow politics.
I was sad that some offensive cowsay ascii arts were removed, but I won't pick that fight so I just got them from the archive and made a .deb that I manually install on my own machines.
The story goes a kid in high school setup a web page that displayed fortunes from, well, fortune. He did this via a Perl CGI program. One day, fortune spit out the following quote just as a teacher was viewing the page:
I put the shotgun in an Adidas bag and padded it out with four pairs of tennis socks, not my style at all, but that was what I was aiming for: If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy. So I decided to get as crude as possible. These days, thought, you have to be pretty technical before you can even aspire to crudeness. I'd had to turn both those twelve-gauge shells from brass stock, on the lathe, and then load then myself; I'd had to dig up an old microfiche with instructions for hand-loading cartridges; I'd had to build a lever-action press to seat the primers -all very tricky. But I knew they'd work. -- Johnny Mnemonic
Unfortunately due to the kid mistaking scalar vs array context, only the first line of the paragraph was displayed: I put the shotgun in an Adidas bag and padded it out with four pairs of tennis socks.
Missing the attribution, the teacher did not recognize this as a book quote. This resulted in police being called on the kid. Fortunately it was resolved w/o incident.
Now, I may be misremembering the story which isn't mine. I vaguely recall that maybe it was something Tom Christiansen used to tell? Maybe it appeared on Slashdot? Maybe it's apocryphal? I can't find the original.
Edit: Randal Schwartz recounted the story here:
https://web.archive.org/web/20070126150617/http://www.stoneh...
It was originally on Slashdot and I mostly got the details right. :-)