Showing posts with label weather. Show all posts
Showing posts with label weather. Show all posts

Monday, March 1, 2010

My .bashrc File Part 1 - Useful Information

I thought it would fun to have a short series regarding my .bashrc file. Feel free to share any cool aspects or insights from your .bashrc file during this series. A short disclaimer for this series, regarding most of what I will be sharing with you is NOT original content. I've copied most aspects of my .bashrc from others who have been so kind to share their cool ideas. Now, lets begin.

I want to focus the first apart of this series on having bash display useful information in an easily accessible and concise way. For example, the first thing I do each morning is run my "update" script which displays the time, my schedule for the day and the weather, which looks something like this:

Hello jared, How are you today?

Current Date and Time:

Fri Feb 26 09:00:40 MST 2010

Your Schedule:
Mon Feb 22 12:00am Zone 4
Fri Feb 26 12:00am Safety Kids Fair

6:30am Scriptures
11:00am Preschool time
Sat Feb 27 9:30am Food Co-op Pick up

Current Weather Conditons:

Current conditions at UT (KSLC)
Last updated Feb 26, 2010 - 10:53 AM EST / 2010.02.26 1553 UTC
Wind: from the SSE (160 degrees) at 13 MPH (11 KT)
Sky conditions: mostly cloudy
Temperature: 35.1 F (1.7 C)
Relative Humidity: 69%
City Forecast for Salt Lake City, UT


Here is the script I use in my .bashrc file.

function update() # Current date, time, weather and calendar
(
echo -e "\nHello $USER, How are you today?"
echo -e "\nCurrent Date and Time: $NC " ; date
echo -e "\nYour Schedule: $NC " ; gcalcli agenda head
echo -e "\nCurrent Weather Conditons: $NC " ; weather head -n 7
echo ""
)

Let me run through this function. As you can see it's all just echo commands spewing out the information I desire. I begin by having bash say "Hello" to me. Just because it's a shell doesn't mean it can't be polite. Next it displays the current date and time which is followed by my schedule for the day. My schedule is produced by a cool little app called gcalcli which was a Google summer of code project that displays your google calendar on the command line. I blogged about this app previously here. I then finish things up with the weather using the weather-utils application. I have the weather command set up as an alias (which I'll cover in another segment) to display my local weather.

As mentioned previously, this is the first command I type into the terminal when I first wake up, which gives me a quick and concise outlook for the day.

Well, I hope this was interesting to some of you. My next installment will cover displaying useful system information. So until then... enjoy!

Friday, November 7, 2008

How's the Weather up there? CLI weather app.

weather-util gives you local weather readings on the command line. If you are running Ubuntu you can easily install this handy little application by typing the following in the command line.

$apt-get install weather-util
To retrieve local weather information you will need to know your local weather id which can be found at the National Weather Service. Your id is a 4 digit letter code which identifies your city or area. I live in Salt Lake City, Utah and my id is KSLC.

Once you have your id the syntax is fairly straight forward.

$weather -id=KSLC
Which outputs the following:

Current conditions at UT (KSLC)
Last updated Nov 07, 2008 - 09:53 AM EST / 2008.11.07 1453 UTC
Wind: from the SE (140 degrees) at 8 MPH (7 KT)
Sky conditions: mostly cloudy
Temperature: 39.9 F (4.4 C)
Relative Humidity: 62%

You can get a forecast using the -f option.

Current conditions at UT (KSLC)
Last updated Nov 20, 2008 - 08:53 AM EST / 2008.11.20 1353 UTC
Wind: Calm
Sky conditions: partly cloudy
Temperature: 32.0 F (0.0 C)
Relative Humidity: 85%
Issued Thursday morning - Nov 20, 2008
Thursday... Sunny, high 55, 0% chance of precipitation.
Thursday night... Low 30, 10% chance of precipitation.
Friday... Sunny, high 43, 0% chance of precipitation.
Friday night... Low 21.
Saturday... High 45.


Now you have no excuse to be caught out in the cold unprepared. If you can muster up some creative juices I'm sure you could easily get the output to display in conky.