Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

View a Lord of the Rings timeline easter egg in calendar UNIX
Just for fun ... Lord of the Rings (LotR) is quite the story and now quite a cinematic experience as well. Seems at least one of the those that contributed to the BSD Unix kernel OS X utilizes thought so too. To see the LotR event timeline built into OS X, do this: Open the Terminal (in your Applications -> Utilities folder). Copy and paste the following, then hit enter at the terminal prompt:
 cat /usr/share/calendar/calendar.history | grep "LOTR"
Timely and fun, imho. :)
    •    
  • Currently 2.75 / 5
  You rated: 5 / 5 (8 votes cast)
 
[36,857 views]  

View a Lord of the Rings timeline easter egg in calendar | 20 comments | Create New Account
Click here to return to the 'View a Lord of the Rings timeline easter egg in calendar' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View a Lord of the Rings timeline easter egg in calendar
Authored by: langer on Jan 13, '04 11:12:51AM

It's there in Debian Linux, too.



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: jocknerd on Jan 13, '04 11:56:47AM

The events are in my Debian as well, but the (LOTR) isn't in there. So I can grep on Frodo but not LOTR.

---
OS X 10.2
Apple Styling, Unix Power



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: OriEri on Jan 13, '04 07:06:37PM

I wonder how far back this goes. This is a typical geeky thing, and I bet it goes back into the 70's. You know, I bet by seeing which versions of *nixes have it and which don't you could pretty precisely figure out the date based on when the branch of the tree that has it split off from the others. Now I just need a login into some more flavors of UNIX machines. Anyone wanna try Solaris?



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: OriEri on Jan 13, '04 07:08:42PM

P.S.

http://www.levenez.com/unix/history.html



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: merlyn on Jan 13, '04 11:26:56AM

cat /usr/share/calendar/calendar.history | grep "LOTR"
That's what we call in the business a Useless Use of Cat. Perhaps to speed up both your fingers and your computer, you could have typed that as:

grep LOTR /usr/share/calendar/calendar.history
Almost every use of "cat SINGLEFILE | ...somecommand..." is wrong. Learn!

[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: SOX on Jan 13, '04 12:11:06PM

How about
cat somefile | cpio



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: Djehuti on Jan 13, '04 12:13:58PM

cpio < somefile



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: foobar104 on Jan 13, '04 02:47:12PM
Almost every use of "cat SINGLEFILE | ...somecommand..." is wrong. Learn!

If anybody was wondering why UNIX hasn't taken over the world, there you go.

There is absolutely nothing wrong about this use of cat. No, it's not necessary, but it works just fine. In this particular instance, it's my preferred idiom for searching a single file, because I can't reliable remember whether grep's command-line syntax is "grep pattern file" or "grep file pattern." In other words, I can't remember whether to think "search for this in that" or "search that for this."

With cat and a pipe, I don't have to.

UNIX is great. UNIX is fantastic. People who look at a perfectly good way of doing something with UNIX and fly off the handle, call it wrong, and command those who use it to "Learn!" kinda suck, however.

[ Reply to This | # ]

View a Lord of the Rings timeline easter egg in calendar
Authored by: SeanAhern on Jan 13, '04 04:52:03PM
I can't reliable remember whether grep's command-line syntax is "grep pattern file" or "grep file pattern."

Here's a way that I remember. Grep searches multiple files for one pattern. That means that you specify the pattern first, then a bunch of files. "grep pat *" searches all files for the pattern "pat". With this in mind, it's relatively easily to reminder, since "grep * pat" is simply never seen.

Don't know if this helps, but it works for me.

---
-Sean

[ Reply to This | # ]

View a Lord of the Rings timeline easter egg in calendar
Authored by: ToadSprocket on Jan 13, '04 03:27:00PM

Define Wrong. Did it Work? Yes. That's the beauty of UNIX, so many ways to get the job done. Consider that maybe he didn't know what he was grepping for in the first place. He 'cat's the file, then sees the "LOTR" string, hits up arrow, and tags his '| grep' command at the end of his previous command. Anyhow... who cares. Get off your high horse.



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: lukec on Jan 13, '04 04:15:08PM

You're right in that it is unnecessary to use 'cat' in many cases. If I were writing a shell script I would be very scrutinous of the excessive usage of 'cat' or 'grep' or 'awk' (or any other tool) especially in a loop. With experience comes a more evolved usage of the command line.

Consider that the novice CL user will get much faster results if they program in a way that is intuitive to them. The 5 additional miliseconds it takes to spawn an additional instance of cat is quite negligable compare to the 5 extra seconds it would take to change their original code to adhere to the 'correct' way of doing things.

You want speed ? program in C or assembly.

All who are new to the command line - Keep up the good work!

Luke



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: dhrakar on Jan 13, '04 08:55:42PM
Another perfectly valid reason to use cat foo | grep is when you need an alias for quickly getting information out of a log. For example, I have several aliases (I use the AT&T ksh for my shell) that look like:
alias gethist 'cat /var/log/foo.log | grep'
This allows me to type only gethist dude to grep 'dude' out of the foo.log log. Saves typing the log path out...

Another use is for looking into files that I do not have read permission on (I'm a user consultant here at work and frequently need to look at user and/or system files). Since I do not have sudo (e.g. root) access to the grep command, I often wind up doing sudo cat /root/owned/file | grep foo. This way only cat has to run as root.

[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: fuerst on Jan 15, '04 06:14:17AM
alias gethist 'grep \!^ /var/log/foo.log' would do the same, but optimized.

[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: fuerst on Jan 15, '04 06:17:09AM
Try
alias gethist 'grep \!^ /var/log/system.log'
. I forgot the backslash away in my first post..

[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: VEGx on Jan 14, '04 11:07:00AM

cat file | grep "word"

It maybe "useless" in most times, but it's handy sometimes. For me at least. this way I can just hit up-arrow and modify the last word... I hate to "navigate" in the command line... if it's a word in the middle it's such a pain...
[Read: I grep often `edict' the english/Japanese dictionary and Terminal.app doesn't like the multi column glyphs all that much... so you are navigating "blindly" because were you see the cursor is not where you really are...]



[ Reply to This | # ]
View a Lord of the Rings timeline easter egg in calendar
Authored by: hrbrmstr on Jan 13, '04 12:58:01PM
For those who would like to possibly expand upon this, you can install the perl module "Date::Tolkien::Shire" and get programmatic access to the historical Middle Earth timeline for any given date.

perl.com has an article that shows usage, and you can add it to the local perl library by opening up a terminal and entering:
sudo perl -MCPAN -e "install Date::Tolkien::Shire"
If you've never done a module install from CPAN before, you might want to do a:
sudo perl -MCPAN -e shell
first to setup CPAN access.

It's fun to add it to login profiles, web pages and mail signatures.

---
Mind the gap...

[ Reply to This | # ]

Errors in LOTR Timeline
Authored by: leejoramo on Jan 13, '04 02:22:17PM
This hint shows that the destruction of the Ring occurred:

03/18 Destruction of the Ring (LOTR)

but in fact it occurred on March 25th.

Lee Joramo

[ Reply to This | # ]
Errors in LOTR Timeline
Authored by: derrickbass on Jan 14, '04 02:04:41AM

Well, there are differences between "Shire Reckoning" and the modern calendar (which is discussed at great length in Appendix D of the trilogy). Basically, all their months were 30 days long and extra holidays were added at various points of the year to fill out the calendar. Moreover, the year did not start at the same point as ours. According to the appendix "our New Year's Day corresponded more or less to the Shire January 9."

So, Shire March 25 occurs 76 days after our New Year's (30 + 30 + 25-9), which gets you March 18. I think.

QED.

Now back to real work.



[ Reply to This | # ]
Complete LOTR Chronology
Authored by: Mike Perry on Jan 13, '04 04:28:22PM
Egads, I hope the Tolkien estate doesn't get wind of this, start acting like SCO about Linux, and file a copyright infringement lawsuit against this innocent bit of fun. I spent almost a year in Seattle's federal court fighting their absurd claim that only they can publish a chronology or other reference to LOTR. Faced with the distinct possibility of losing at the summary judgment stage, they settled out-of-court last spring.

If you're interested, Untangling Tolkien, the first book-length (251 page) chronology of LOTR, is out and selling on Amazon.com and elsewhere. You can get more details at http://www.inklingbooks.com/

If someone would like to create useful software with a LOTR theme, I'd be happy to agree to the use of material from the book. Just contact me through the website above. One person has floated the idea for a Shire calendar.

If you live near Seattle, you can hear Gimli/John Rhys-Davis speak this Saturday. (Details at www.discovery.org). I'll be at a table signing copies of the book. Good thing I was asked. The tickets are a bit pricey ($30) for my budget.

--Mike Perry

[ Reply to This | # ]

View a Lord of the Rings timeline easter egg in calendar
Authored by: Spartacus on Jan 15, '04 05:14:49AM

They thoroughly misspelled King Elessar's name, though.



[ Reply to This | # ]