Skip to content

Instantly share code, notes, and snippets.

@qmahoney
Last active December 18, 2020 20:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qmahoney/ec6c02176f0fe897b6d8c4169e8fa0cc to your computer and use it in GitHub Desktop.
Save qmahoney/ec6c02176f0fe897b6d8c4169e8fa0cc to your computer and use it in GitHub Desktop.
Fake Athena header page
#!/bin/bash
# Copy banner.ps and owl.ps from:
# http://athena10.mit.edu/trac/browser/trunk/third/lprng/athena?rev=13556
echo "/user (`whoami`) def" > vars.ps
echo "/host (`hostname`) def" >> vars.ps
echo "/queuejob () def" >> vars.ps
echo "/date (`date +"%A, %e %B %Y %H:%M:%S"`) def" >> vars.ps
echo "/motd () def" >> vars.ps
# /graph /biggraph /hex /loglog /polar /staff /bigstaff /blank
echo "/bannertype /graph def" >> vars.ps
cat vars.ps owl.ps banner.ps | ps2pdf - header.pdf
@qmahoney
Copy link
Author

qmahoney commented Jun 3, 2016

And in case you ever wondered, here are some snippets from banner.ps:

% pick a random graph
/dorandom {
    statusdict/pagecount get exec srand    % Seed off the pagecount.
    [graphweights {{dup} repeat pop} forall] dup length
    rand exch mod get
    dup graphdict exch known {graphdict exch get exec} {dograph} ifelse
} bind def
/graphweights <<
    /graph      8
    /biggraph   1
    /hex        1
    /loglog     1
    /polar      1
    /staff      1
    /bigstaff   1
    /blank      1
>> def

@jcbarret
Copy link

jcbarret commented Jun 4, 2016

Oh man, this brought back such nostalgia. Two small notes:

  1. the rev of banner.ps you link to doesn't have the musical staff types, but you can get them from rev 13556.
  2. if anybody else is really homesick because they live in the world of A4 (which is superior, btw) you can make things right with the diff below. I briefly considered editing everything to make them metric scaled instead of 1/4" etc, but then realised I was going crazy.
Jeffreys-iMac:athena-header jcbarret$ diff banner.ps ~/Downloads/banner.ps 
17,20c17,18
< /inch { 72 mul } def
<  << /PageSize [ 8.3 inch 11.7 inch     ] /ImagingBBox null >> setpagedevice
< /inchheight 11.7 def
< /inchwidth 8.3 def

---
> /inchheight 11 def
> /inchwidth 8.5 def
23a22
> /inch { 72 mul } def
117,120c116,119
< /pagetop height .525 inch sub def
< /pagebot .525 inch def
< /pageleft .345 inch def
< /pageright width .345 inch sub def

---
> /pagetop height .5 inch sub def
> /pagebot .5 inch def
> /pageleft .5 inch def
> /pageright width .5 inch sub def

@2n3906
Copy link

2n3906 commented Jun 7, 2016

I'm going to start printing these at work.

@qmahoney
Copy link
Author

Awesome, @jcbarret! And thanks, I fixed the revision.

Also, I had the date format wrong. It's %e instead of %d, and there's an extra space between the year and the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment