The Function: askapache_calendar
Note the screenshot is awesome due to my custom .vimrc. It is missing the randomized color in the code below.
Download OpenBSD Calendars
By default this script will use any calendars in your home directory ~/.calendars
. If that directory does not exist when you call this function, it will tell you it is installing the calendars for you. It grabs the list of calendars straight from here. Here is the list:
- calendar.all
- calendar.birthday
- calendar.canada
- calendar.christian
- calendar.computer
- calendar.croatian
- calendar.discord
- calendar.fictional
- calendar.french
- calendar.german
- calendar.history
- calendar.holiday
- calendar.judaic
- calendar.music
- calendar.openbsd
- calendar.pagan
- calendar.russian
- calendar.space
- calendar.ushistory
- calendar.usholiday
- calendar.world
Calendar Function Examples
Illustrating the random color output.
Source Code for Calendar Function
Download askapache_calendar.sh
#!/bin/bash # Updated: Thu May 16 21:07:54 2013 # @ http://www.askapache.com/linux/show-events-occurred-day-linux.html # Copyright (C) 2013 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. function askapache_calendar () { if [[ ! -d ~/.calendar ]]; then echo "INSTALLING CALENDARS TO ~/.calendar"; local U=http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/calendar/calendars/ OPWD=$PWD; mkdir -pv ~/.calendar; cd ~/.calendar curl -# $(for f in $(curl -sSo - $U | sed '/">calendar\./!d; s,^.*;<a href="\./\([^"]\+\)".*$,\1,g'); do echo -n " -O $U$f"; done); cd $OPWD echo "CALENDARS INSTALLED"; fi local COLOR=$( echo -en $(( $RANDOM % ${1:-$RANDOM} + 1 )) ); echo -en "`tput setaf $COLOR`"; sed -n "/$(date +%m\\/%d\\\|%b\*\ %d)/p" ~/.calendar/c* echo -en "`tput sgr0`" }
…Show Events that Occurred on this day in the Past… originally appeared on AskApache.com
The post Show Events that Occurred on this day in the Past appeared first on AskApache.