Make your terminal greet you 05-17-2013, 08:18 PM
#2
This is simple, but effective. I just got the idea, because of @MrGeek's terminal thread.
You can make your terminal greet you the right way depending on the daytime plus saying a random quote for your amusal. It might look like this:
![[Image: 2sxoxytn.png]](http://s1.directupload.net/images/130518/2sxoxytn.png)
Or this:
![[Image: 3dzysp5f.png]](http://s1.directupload.net/images/130518/3dzysp5f.png)
And this is how you do it:
1. Install cowsay and fortune
If you are on Ubuntu:
2. Put the following python script into your home
Open a text editor of your choice, copy my code into it and save it as welcome.py
3. Edit the .bashrc
Add the following line:
Now everytime you open your terminal you get an appropriate greeting.
4. Customizing
If you want another ascii picture than tux, you have to edit the last line of the python code and replace tux with i.e.: dragon, cock, snowman, elephant, milk, cow, pony, kiss, koala, gnu, skeleton, ren, moose, sheep ... (see /usr/share/cowsay/cows for the files available)
I.e. to have the dragon you will have to write:
Alternatively you can use the randomized welcome.py (shows a random ascii, if you don't like a picture, add it to the blacklist):
You can make your terminal greet you the right way depending on the daytime plus saying a random quote for your amusal. It might look like this:
![[Image: 2sxoxytn.png]](http://s1.directupload.net/images/130518/2sxoxytn.png)
Or this:
![[Image: 3dzysp5f.png]](http://s1.directupload.net/images/130518/3dzysp5f.png)
And this is how you do it:
1. Install cowsay and fortune
If you are on Ubuntu:
Code:
sudo apt-get install cowsay
sudo apt-get install fortune-mod2. Put the following python script into your home
Open a text editor of your choice, copy my code into it and save it as welcome.py
Code:
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", "tux", str + "\n\n" + fortune])3. Edit the .bashrc
Add the following line:
Code:
python welcome.pyNow everytime you open your terminal you get an appropriate greeting.
4. Customizing
If you want another ascii picture than tux, you have to edit the last line of the python code and replace tux with i.e.: dragon, cock, snowman, elephant, milk, cow, pony, kiss, koala, gnu, skeleton, ren, moose, sheep ... (see /usr/share/cowsay/cows for the files available)
I.e. to have the dragon you will have to write:
Code:
call(["cowsay", "-f", "dragon", str + "\n\n" + fortune])Alternatively you can use the randomized welcome.py (shows a random ascii, if you don't like a picture, add it to the blacklist):
Code:
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"] #put your unwanted cows in here
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])I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.
Expressed feelings are just an attempt to simulate humans.
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)