I just wrote a simple script to realize a terminal that greets me depending on the daytime and shows a random quote. It might look like this:
Or this:
And this is how you do it:
Install cowsay and fortune
Save this as welcome.py in your home (or somewhere else). Modify it for your needs (i.e. instead of tux in the last line choose something else, like dragon, cock, snowman, elephant, milk, cow, pony, kiss, koala, gnu, skeleton, ren, moose, sheep ... (see /usr/share/cowsay/cows for the files available)
import getpass
from datetime import datetime
from subprocess import call, Popen, PIPE
user = getpass.getuser()
hour = datetime.time(datetime.now()).hour
if hour >= 22:
str = "Sleep Well, " + user + "!"
elif hour >= 18:
str = "Good Evening, " + user + "!"
elif hour >= 14:
str = "Good Afternoon, " + user + "!"
elif hour >= 12:
str = "Enjoy Your Meal, " + user + "!"
else:
str = "Good Morning, " + user + "!"
fortune = Popen(["fortune"], stdout=PIPE).communicate()[0]
call(["cowsay", "-f", "dragon", str + "\n\n" + fortune])
Add the following line to .bashrc (if you didn't save the .py in your home, you will have to edit the path)
python welcome.py
Now everytime you open your terminal you get an appropriate greeting and a random quote.
Alternatively you can use this randomized welcome.py (shows a random ascii art). Note the blacklist, where you can add your unwanted cows.
import getpass
import random
from datetime import datetime
from subprocess import call, Popen, PIPE
from os import listdir
from os.path import isfile, join
blacklist = ["beavis.zen", "ghostbusters", "elephant-in-snake", "unipony", "daemon", "sodomized-sheep", "eyes", "kosh", "calvin", "gnu", "kiss", "turkey", "turtle", "pony", "mutilated", "head-in"]
cowpath = "/usr/share/cowsay/cows"
cows = [ f[:-4] for f in listdir(cowpath) if isfile(join(cowpath,f)) and f.endswith(".cow") and f[:-4] not in blacklist ]
user = getpass.getuser()
hour = datetime.time(datetime.now()).hour
random_cow = random.choice(cows)
say_or_think = random.choice(["say", "think"])
if hour >= 22:
str = "Sleep Well, " + user + "!"
elif hour >= 18:
str = "Good Evening, " + user + "!"
elif hour >= 14:
str = "Good Afternoon, " + user + "!"
elif hour >= 12:
str = "Enjoy Your Meal, " + user + "!"
else:
str = "Good Morning, " + user + "!"
fortune = Popen(["fortune"], stdout=PIPE).communicate()[0]
call(["cow" + say_or_think, "-f", random_cow, str + "\n\n" + fortune])