Showing posts with label Calendar. Show all posts
Showing posts with label Calendar. 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, October 24, 2008

gcalcli - Google Calendar on the Command Line

gcalcli gives you access to your Google Calendar on the command line. You can retrieve your calendar information for multiple calendars and in various formats. gcalcli can be found in the repositories for Ubuntu Hardy and Ibex.

If your Distro does not have gcalcli in it's repositories, instructions can be found here. gcalcli is written in python and just has a few dependencies for an easy install.

Once installed you may need to create a .gcalclirc file in your home directory. The file should be configured like this:

[gcalcli]
<config-item>: <value>
<config-item>: <value>
...

Mine looks like this:

[gcalcli]
user: username@gmail.com
pw: password
cals: all

Obviously, use your own Google Calendar username and password in the file. I have several calendars that follow, like a US Holiday calendar, a family birthday calendar and my Wife's calendar. I wanted to have access to all the calendars so I indicated that as an option in the config file. There are several other options that can be included within this configuration file specifically having different colors for each calendar.

On my laptop running CrunchBang! Linux, gcalcli was not correctly reading
the .gcalclirc file. So, I created the following alias in my .bashrc file:

alias gcalcli = "/usr/bin/gcalcli --user=username@gmail.com --pw=password"

This seemed like a reasonable work around for now.

To view my calendar I simply type:

$ gcalcli agenda


Notice my calendar in blue and my wife's calendar in magenta.
Using the agenda option without parameters will list one week of calendar information. You can include a date range to customize the output.

$ gcalcli agenda 11/15 11/31

This will give you all calendar items between 11/15 and 11/31 of the current year.

To view your calendar in a matrix with borders, type the following:

$ gcalcli calw

The calw option without parameters will display the current week's calendar items. You can add parameters to increase your ranges view.

$ gcalcli calw 3


This will display the current week and the following 2 weeks.

You can post to your calendar as well using the quick option in the following syntax.

$ gcalcli quick "10/31 7 pm Halloween Party"


This will create a calendar for a Halloween Party on 10/31 at 7 pm.
Please see the gcalcli site for more things you can do with this neat little app, including adding calendar items to gnu screen and receiving notices. For all you GUI lovers you can even use gcalcli to display your calendar items in conky.

Now you can do all your scheduling and calendaring on the CLI.