1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

feat(plugins): add hitchhiker plugin (#5117)

This commit is contained in:
Luiz Pericolo 2016-05-25 12:33:38 -03:00 committed by Marc Cornellà
parent 02d07f3e3d
commit d8b3e115e9
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
4 changed files with 343 additions and 0 deletions

1
plugins/hitchhiker/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
fortunes/hitchhiker.dat

View file

@ -0,0 +1,44 @@
# hitchhiker
This plugin adds quotes from The Hitchhiker's Guide to the Galaxy, from Douglas Adams.
To use it, add `hitchhiker` to the plugins array in your zshrc file:
```zsh
plugins=(... hitchhiker)
```
## Aliases
- `hitchhiker`: displays a quote from the book using `fortune`.
- `hitchhiker_cow`: displays a quote from the book using `cowthink`.
```console
$ hitchhiker_cow
_______________________________________
( "OK, so ten out of ten for style, but )
( minus several million for good )
( thinking, yeah? " )
---------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
## Requirements
- `fortune` and `strfile`.
- `cowthink` if using the `hitchhiker_cow` command.
## Credits
Fortune file: Andreas Gohr <andi@splitbrain.org> ([splitbrain.org](https://www.splitbrain.org/projects/fortunes/hg2g))
Spelling and formatting fixes: grok@resist.ca
Original quotes from:
- https://web.archive.org/web/20120106083254/http://tatooine.fortunecity.com/vonnegut/29/hitch/parhaat.html
- https://web.archive.org/web/20011112065737/http://www-personal.umd.umich.edu/~nhughes/dna/faqs/quotedir.html

View file

@ -0,0 +1,275 @@
"`...You hadn't exactly gone out of your way to call attention to them had you? I mean like actually telling anyone or anything.' `But the plans were on display...' `On display? I eventually had to go down to the cellar to find them.' `That's the display department.' `With a torch.' `Ah, well the lights had probably gone.' `So had the stairs.' `But look you found the notice didn't you?' `Yes,' said Arthur, `yes I did. It was on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying "Beware of The Leopard".'"
- Arthur singing the praises of the local council planning department.
%
"`Time is an illusion. Lunchtime doubly so.' `Very deep,' said Arthur, `you should send that in to the "Reader's Digest". They've got a page for people like you.'"
- Ford convincing Arthur to drink three pints in ten minutes at lunchtime.
%
"`This must be Thursday,' said Arthur to himself, sinking low over his beer, `I never could get the hang of Thursdays.'"
- Arthur, on what was to be his last Thursday on Earth.
%
"Pages one and two [of Zaphod's presidential speech] had been salvaged by a Damogran Frond Crested Eagle and had already become incorporated into an extraordinary new form of nest which the eagle had invented. It was constructed largely of papier mache and it was virtually impossible for a newly hatched baby eagle to break out of it. The Damogran Frond Crested Eagle had heard of the notion of survival of the species but wanted no truck with it."
- An example of Damogran wildlife.
%
"`How do you feel?' he asked him. `Like a military academy,' said Arthur, `bits of me keep passing out.'" .... `We're safe,' he said. `Oh good,' said Arthur. `We're in a small galley cabin,' said Ford, `in one of the spaceships of the Vogon Constructor Fleet.' `Ah,' said Arthur, `this is obviously some strange usage of the word "safe" that I wasn't previously aware of.'
- Arthur after his first ever teleport ride.
%
"`The best way to get a drink out of a Vogon is to stick your finger down his throat...'"
- The Book, on one of the Vogon's social inadequacies.
%
"`You'd better be prepared for the jump into hyperspace. It's unpleasantly like being drunk.' `What's so unpleasant about being drunk?' `You ask a glass of water.'"
- Arthur getting ready for his first jump into hyperspace.
%
"`You know,' said Arthur, `it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die from asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young.' `Why, what did she tell you?' `I don't know, I didn't listen.'"
- Arthur coping with certain death as best as he could.
%
"`Ford, you're turning into a penguin. Stop it.'"
- Arthur experiences the improbability drive at work.
%
"`I think you ought to know that I'm feeling very depressed.'" "`Life, don't talk to me about life.'" "`Here I am, brain the size of a planet and they ask me to take you down to the bridge. Call that "job satisfaction"? 'Cos I don't.'" "`I've got this terrible pain in all the diodes down my left side.'"
- Guess who.
%
"`If there's anything more important than my ego around, I want it caught and shot now.'"
- Zaphod.
%
"`In those days spirits were brave, the stakes were high, men were REAL men, women were REAL women, and small furry creatures from Alpha Centauri were REAL small furry creatures from Aplha Centauri.'"
- The Book getting all nostalgic.
%
"`Hey this is terrific!' Zaphod said. `Someone down there is trying to kill us!' `Terrific,' said Arthur. `But don't you see what this means?' `Yes. We are going to die.' `Yes, but apart from that.' `APART from that?' `It means we must be on to something!' `How soon can we get off it?'"
- Zaphod and Arthur in a certain death situation over Magrathea.
%
"And wow! Hey! What's this thing coming towards me very fast? Very very fast. So big and flat and round, it needs a big wide sounding word like... ow... ound... round... ground! That's it! That's a good name - ground! I wonder if it will be friends with me?"
- For the sperm whale, it wasn't.
%
"Oh no, not again."
- A bowl of petunias on it's way to certain death.
%
"`Er, hey Earthman...' `Arthur,' said Arthur. `Yeah, could you just sort of keep this robot with you and guard this end of the passageway. OK?' `Guard?' said Arthur. `What from? You just said there's no one here.' `Yeah, well, just for safety, OK?' said Zaphod. `Whose? Yours or mine?'"
- Arthur drawing the short straw on Magrathea.
%
"There are of course many problems connected with life, of which some of the most popular are `Why are people born?' `Why do they die?' `Why do they spend so much of the intervening time wearing digital watches?'"
- The Book.
%
"`Right,' said Ford, `I'm going to have a look.' He glanced round at the others. `Is no one going to say, "No you can't possibly, let me go instead"?' They all shook their heads. `Oh well.'"
- Ford attempting to be heroic whilst being seiged by Shooty and Bangbang.
%
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - The Book just recapping what happened in the last book. "`I am so amazingly cool you could keep a side of meat in me for a month. I am so hip I have difficulty seeing over my pelvis.'"
- Zaphod being cool.
%
"`You ARE Zaphod Beeblebrox?' `Yeah,' said Zaphod, `but don't shout it out or they'll all want one.' `THE Zaphod Beeblebrox?' `No, just A Zaphod Bebblebrox, didn't you hear I come in six packs?' `But sir,' it squealed, `I just heard on the sub-ether radio report. It said you were dead...' `Yeah, that's right, I just haven't stopped moving yet.'"
- Zaphod and the Guide's receptionist.
%
"The fronting for the eighty-yard-long marble-topped bar had been made by stitching together nearly twenty thousand Antarean Mosaic Lizard skins, despite the fact that the twenty thousand lizards concerned had needed them to keep their insides in."
- The Book decribing Milliways' politically incorrect decor.
%
"`...and the Universe,' continued the waiter, determined not to be deflected on his home stretch, `will explode later for your pleasure.' Ford's head swivelled slowly towards him. He spoke with feeling. `Wow,' he said, `What sort of drinks do you serve in this place?' The waiter laughed a polite little waiter's laugh. `Ah,' he said, `I think sir has perhaps misunderstood me.' `Oh, I hope not,' breathed Ford."
- Ford in paradise.
%
"Zaphod grinned two manic grins, sauntered over to the bar and bought most of it."
- Zaphod in paradise.
%
"`Maybe somebody here tipped off the Galactic Police,' said Trillian. `Everybody saw you come in.' `You mean they want to arrest me over the phone?' said Zaphod, `Could be. I'm a pretty dangerous dude when I'm cornered.' `Yeah,' said a voice from under the table [Ford's now completely rat-arsed at this point], `you go to pieces so fast people get hit by the shrapnel.'"
- Zaphod getting paranoid over a phone call.
%
"`Hand me the rap-rod, Plate Captain.' The little waiter's eyebrows wandered about his forehead in confusion. `I beg your pardon, sir?' he said. `The phone, waiter,' said Zaphod, grabbing it off him. `Shee, you guys are so unhip it's a wonder your bums don't fall off.'"
- Zaphod discovers that waiters are the least hip people in the Universe.
%
"The main reception foyer was almost empty but Ford nevertheless weaved his way through it."
- Ford making his way out of Milliways whilst under the influence of enough alcohol to make a rhino sing.
%
"`The first ten million years were the worst,' said Marvin, `and the second ten million, they were the worst too. The third ten million I didn't enjoy at all. After that I went into a bit of a decline.'"
- Marvin reflecting back on his 576,000,003,579 year career as Milliways' car park attendent.
%
"`Incidentally,' he said, `what does teleport mean?' Another moment passed. Slowly, the others turned to face him. `Probably the wrong moment to ask,' said Arthur, `It's just I remember you use the word a short while ago and I only bring it up because...' `Where,' said Ford quietly, `does it say teleport?' `Well, just over here in fact,' said Arthur, pointing at a dark control box in the rear of the cabin, `Just under the word "emergency", above the word "system" and beside the sign saying "out of order".'"
- Arthur finding an escape route from a certain death situation.
%
"I teleported home one night With Ron and Sid and Meg. Ron stole Meggie's heart away And I got Sidney's leg."
- A poem about matter transference beams.
%
"Anyone who is capable of getting themselves made President should on no account be allowed to do the job."
- Some wisdom from The Book.
%
"`We've got to find out what people want from fire, how they relate to it, what sort of image it has for them.' The crowd were tense. They were expecting something wonderful from Ford. `Stick it up your nose,' he said. `Which is precisely the sort of thing we need to know,' insisted the girl, `Do people want fire that can be fitted nasally?'"
- Ford "debating" what to do with fire with a marketing girl.
%
"The story goes that I first had the idea for THHGTTG while lying drunk in a field in Innsbruck (or `Spain' as the BBC TV publicity department authoritatively has it, probably because it's easier to spell)." - Foreward by DNA.
FORD Six pints of bitter. And quickly please, the world's about to end. BARMAN Oh yes, sir? Nice weather for it.
%
BOOK Meanwhile, the starship has landed on the surface of Magrathea and Trillian is about to make one of the most important statements of her life. Its importance is not immediately recognised by her companions. TRILL. Hey, my white mice have escaped. ZAPHOD Nuts to your white mice.
%
BOOK ...Man had always assumed that he was more intelligent than dolphins because he had achieved so much... the wheel, New York, wars, and so on, whilst all the dolphins had ever done was muck about in the water having a good time. But conversely the dolphins believed themselves to be more intelligent than man for precisely the same reasons.
%
ARTHUR What is an Algolian Zylatburger anyway? FORD They're a kind of meatburger made from the most unpleasant parts of a creature well known for its total lack of any pleasant parts. ARTHUR So you mean that the Universe does actually end not with a bang but with a Wimpy?
- Cut dialogue from Fit the Fifth.
%
BOOK There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarrely inexplicable. There is another theory which states that this has already happened.
- Introduction to Fit the Seventh.
%
FORD Tell me Arthur... ARTHUR Yes? FORD This boulder we're stuck under, how big would you say it was? Roughly? ARTHUR Oh, about the size of Coventry Cathedral. FORD Do you think we could move it? (Arthur doesn't reply) Just asking.
- Ford and Arthur in a tricky situation, Fit the Eighth.
%
BOOK What to do if you find yourself stuck in a crack in the ground underneath a giant boulder you can't move, with no hope of rescue. Consider how lucky you are that life has been good to you so far. Alternatively, if life hasn't been good to you so far, which given your current circumstances seems more likely, consider how lucky you are that it won't be troubling you much longer.
- Comforting advice for Ford and Arthur in this current situation, Fit the Eighth.
%
ZAPHOD Hey, this rock... FORD Marble... ZAPHOD Marble... FORD Ice-covered marble... ZAPHOD Right... it's as slippery as... as... What's the slipperiest thing you can think of? FORD At the moment? This marble. ZAPHOD Right. This marble is as slippery as this marble.
- Zaphod and Ford trying to get a grip on things in Brontitall, Fit the Tenth.
%
ARTHUR It's not a question of whose habitat it is, it's a question of how hard you hit it.
- Arthur pointing out one of the disadvantages of gravity, Fit the Tenth.
%
ARTHUR It probably seems a terrible thing to say, but you know what I sometimes think would be useful in these situations? LINT. What? ARTHUR A gun of some sort. LINT.2 Will this help? ARTHUR What is it? LINT.2 A gun of some sort. ARTHUR Oh, that'll help. Can you make it fire? LINT. Er... F/X DEAFENING ROAR LINT. Yes.
- Arthur and the Lintillas gaining the upper hand, Fit the Twelfth.
%
"He stood up straight and looked the world squarely in the fields and hills. To add weight to his words he stuck the rabbit bone in his hair. He spread his arms out wide. `I will go mad!' he announced."
- Arthur discovering a way of coping with life on Prehistoric Earth.
%
"`... then I decided that I was a lemon for a couple of weeks. I kept myself amused all that time jumping in and out of a gin and tonic.' Arthur cleared his throat, and then did it again. `Where,' he said, `did you...?' `Find a gin and tonic?' said Ford brightly. `I found a small lake that thought it was a gin and tonic, and jumped in and out of that. At least, I think it thought it was a gin and tonic.' `I may,' he addded with a grin which would have sent sane men scampering into the trees, `have been imagining it.'"
- Ford updating Arthur about what he's been doing for the past four years.
%
"`Eddies,' said Ford, `in the space-time continuum.' `Ah,' nodded Arthur, `is he? Is he?'"
- Arthur failing in his first lesson of galactic physics in four years.
%
"Ford grabbed him by the lapels of his dressing gown and spoke to him as slowly and distinctly and patiently as if he were somebody from a telephone company accounts department."
- Ford trying to rectify that situation.
%
"...[Arthur] leapt to his feet like an author hearing the phone ring..."
- Who says that the character of Arthur isn't autobiographical?
%
"Arthur's consciousness approached his body as from a great distance, and reluctantly. It had had some bad times in there. Slowly, nervously, it entered and settled down into its accustomed position. Arthur sat up. `Where am I?' he said. `Lord's Cricket Ground,' said Ford. `Fine,' said Arthur, and his consciousness stepped out again for a quick breather. His body flopped back on the grass."
- Arthur coping with his return to Earth as best as he could.
%
"`A curse,' said Slartibartfast, `which will engulf the Galaxy in fire and destruction, and possibly bring the Universe to a premature doom. I mean it,' he added. `Sounds like a bad time,' said Ford, `with luck I'll be drunk enough not to notice.'"
- Ford ensuring everyone knew where his priorities lay.
%
"`My doctor says that I have a malformed public-duty gland and a natural deficiency in moral fibre, and that I am therefore excused from saving Universes.'"
- Ford's last-ditch attempt to get out of helping Slartibartfast.
%
"Trillian did a little research in the ship's copy of THHGTTG. It had some advice to offer on drunkenness. `Go to it,' it said, `and good luck.' It was cross-referenced to the entry concerning the size of the Universe and ways of coping with that."
- One of the more preferable pieces of advice contained in the Guide.
%
"His eyes seemed to be popping out of his head. He wasn't certain if this was because they were trying to see more clearly, or if they simply wanted to leave at this point."QUOTEHERESTRINGMAGIC1234- Arthur trying to see who had diverted him from going to a party.
%
"Arthur yawed wildly as his skin tried to jump one way and his skeleton the other, whilst his brain tried to work out which of his ears it most wanted to crawl out of. `Bet you weren't expecting to see me again,' said the monster, which Arthur couldn't help thinking was a strange remark for it to make, seeing as he had never met the creature before. He could tell that he hadn't met the creature before from the simple fact that he was able to sleep at nights."QUOTEHERESTRINGMAGIC1234- Arthur discovering who had diverted him from going to a party.
%
"`That young girl is one of the least benightedly unintelligent organic life forms it has been my profound lack of pleasure not to be able to avoid meeting.'"QUOTEHERESTRINGMAGIC1234- Marvin's first ever compliment about anybody.
%
"Arthur hoped and prayed that there wasn't an afterlife. Then he realised there was a contradiction there and merely hoped that there wasn't an afterlife."QUOTEHERESTRINGMAGIC1234- Arthur realising that he's in a certain death situation with a supernova bomb that is shaped like a cricket ball.
%
"`Credit?' he said. `Aaaargggh...' These two words are usually coupled together in the Old Pink Dog Bar."QUOTEHERESTRINGMAGIC1234- Ford in a spot of bother.
%
"`...we might as well start with where your hand is now.' Arthur said, `So which way do I go?' `Down,' said Fenchurch, `on this occasion.' He moved his hand. `Down,' she said, `is in fact the other way.' `Oh yes.'"QUOTEHERESTRINGMAGIC1234- Arthur trying to discover which part of Fenchurch is wrong.
%
"There was a point to this story, but it has temporarily escaped the chronicler's mind."QUOTEHERESTRINGMAGIC1234- This line perhaps best sums up the whole book.
%
"The last time anybody made a list of the top hundred character attributes of New Yorkers, common sense snuck in at number 79. .... When it's fall in New York, the air smells as if someone's been frying goats in it, and if you are keen to breathe the best plan is to open a window and stick your head in a building."QUOTEHERESTRINGMAGIC1234- Nuff said??
%
"`What's been happening here?' he demanded. `Oh just the nicest things, sir, just the nicest things. can I sit on your lap please?'" "`Colin, I am going to abandon you to your fate.' `I'm so happy.'" "`It will be very, very nasty for you, and that's just too bad. Got it?' `I gurgle with pleasure.'"QUOTEHERESTRINGMAGIC1234- Ford and Colin the robot.
%
"What the hell, he thought, you're only young once, and threw himself out of the window. That would at least keep the element of surprise on his side."QUOTEHERESTRINGMAGIC1234- Ford outwitting a Vogon with a rocket launcher by going into another certain death situation.
%
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."QUOTEHERESTRINGMAGIC1234- One of the laws of computers and programming revealed.
%
"`You know they've reintroduced the death penalty for insurance company directors?' `Really?' said Arthur. `No I didn't. For what offence?' Trillian frowned. `What do you mean, offence?' `I see.'"QUOTEHERESTRINGMAGIC1234- Evidence that there will be some justice in the Universe eventually.
%
"`She hit me on the head with the rock again.' `I think I can confirm that that was my daughter.' `Sweet kid.' `You have to get to know her,' said Arthur. `She eases up does she?' `No,' said Arthur, `but you get a better sense of when to duck.'"QUOTEHERESTRINGMAGIC1234- Ford and Arthur on Random.
%
"Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun. "
%
"Ah, " said Arthur, "this is obviously some strange usage of the word safe that I wasn't previously aware of. "
%
"I don't know, " said the voice on the PA, "apathetic bloody planet, I've no sympathy at all. "
%
"Now it is such a bizarrely improbable coincidence that anything so mindboggingly useful could have evolved purely by chance that some thinkers have chosen to see it as the final and clinching proof of the non-existence of God. "The argument goes something like this: `I refuse to prove that I exist,' says God, `for proof denies faith, and without faith I am nothing.' "`But,' says Man, `The Babel fish is a dead giveaway, isn't it? It could not have evolved by chance. It proves you exist, and so therefore, by your own arguments, you don't. QED.'
%
"Prostetnic Vogon Jeltz smiled very slowly. This was done not so much for effect as because he was trying to remember the sequence of muscle movements. "
%
"OK, so ten out of ten for style, but minus several million for good thinking, yeah? "
%
"In those days spirits were brave, the stakes were high, men were real men, women were real women, and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri. "
%
"For a moment, nothing happened. Then, after a second or so, nothing continued to happen. "
%
(aikamuotojen k<>ytt<74> aikamatkustuksessa) "You can arrive (mayan arivan on-when) for any sitting you like without prior (late fore-when) reservation because you can book retrospectively, as it were when you return to your own time. (you can have on-book haventa forewhen presooning returningwenta retrohome.) "
%
"The suit into which the man's body had been stuffed looked as if it's only purpose in life was to demonstrate how difficult it was to get this sort of body into a suit. "
%
"He dropped his voice still lower. In the stillness, a fly would not have dared clear its throat. "
%
"And finally, " said Max, quieting the audience down and putting on his solemn face, "finally I believe we have with us here tonight, a party of believers, very devout believers, from the Church of the Second Coming of the Great Prophet Zarquon. " ... "There they are, " said Max, "sitting there, patiently. He said he'd come again, and he's kept you waiting a long time, so let's hope he's hurrying fellas, because he's only got eight minutes left! "
%
"As he came into the light they could see his black and gold uniform on which the buttons were so highly polished that they shone with an intensity that would have made an approaching motorist flash his lights in annoyance. "
%
"You're very sure of your facts, " he said at last, "I couldn't trust the thinking of a man who takes the Universe - if there is one - for granted. "
%
"What are you talking about? " "Never mind, eat the fruit. " "You know, this place almost looks like the Garden of Eden. " "Eat the fruit. " "Sounds quite like it too. "
%
"Rome wasn't burned in a day. "
%
"Does it worry you that you don't talk any kind of sense? "
%
"One's never alone with a rubber duck. "
%
"Another world, another day, another dawn. "
%
"He expanded his chest to make it totally clear that here was the sort of man you only dared to cross if you had a team of Sherpas with you. "
%
"It was real. At least, if it wasn't real, it did support them, and as that is what sofas are supposed to do, this, by any test that mattered, was a real sofa. "
%
Arthur said, "So which way do I go? " "Down, " said Fenchurch, "on this occasion. " He moved his hand. "Down, " she said, "is in fact the other way. " "Oh yes. "
%
"You're one hundred percent positive that the ship which is crashed on the bottom of this ocean is the ship which you said you were one hundred percent positive could one hundred percent positively never crash? "
%
"Yes, it's the right planet, all right, " he said again. "Right planet, wrong universe. "
%
"Ford had his own code of ethics. It wasn't much of one, but it was his and he stuck by it, more or less. One rule he made was never to buy his own drinks. He wasn't sure if that counted as an ethic, but you have to go with what you've got. "
%
"Arthur felt at a bit of a loss. There was a whole Galaxy of stuff out there for him, and he wondered if it was churlish of him to complain to himself that it lacked just two things: the world he was born on and the woman he loved. "
%
"What was the self-sacrifice? " "I jettisoned half of a much loved and I think irreplaceable pair of shoes. " "Why was that self-sacrifice? " "Because they were mine! " said Ford crossly. "I think we have different value systems. " "Well mine's better. " "That's according to your... oh never mind. "

View file

@ -0,0 +1,23 @@
HITCHHIKER_DIR="${0:h}/fortunes"
# Aliases
alias hitchhiker="fortune -a $HITCHHIKER_DIR"
alias hitchhiker_cow="hitchhiker | cowthink"
() {
# Don't generate hitchhiker.dat if it exists and is up-to-date
if [[ -f "$HITCHHIKER_DIR/hitchhiker.dat" ]] && ! [[ "$HITCHHIKER_DIR/hitchhiker.dat" -ot "$HITCHHIKER_DIR/hitchhiker" ]]; then
return
fi
# If strfile is not found: some systems install strfile in /usr/sbin but it's not in $PATH
if ! command -v strfile &>/dev/null && ! [[ -f /usr/sbin/strfile ]]; then
echo "[oh-my-zsh] hitchhiker depends on strfile, which is not installed" >&2
echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
return
fi
"${commands[strfile]:-/usr/sbin/strfile}" "$HITCHHIKER_DIR/hitchhiker" "$HITCHHIKER_DIR/hitchhiker.dat" >/dev/null
}
unset HITCHHIKER_DIR