2011-12-23 01:10:04 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2012-02-15 10:41:09 -07:00
|
|
|
case "$HTTP_USER_AGENT" in
|
|
|
|
*MIDP*)
|
|
|
|
TINY=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-12-23 01:10:04 -07:00
|
|
|
weather () {
|
|
|
|
curl -s 'http://rss.wunderground.com/auto/rss_full/NM/Los_Alamos.xml?units=metric' | \
|
|
|
|
awk -F ' [-:] ' '
|
|
|
|
(/Current Conditions/) {
|
|
|
|
print "<p class=\"weather\"><a href=\"http://m.wund.com/cgi-bin/findweather/getForecast?brand=mobile&query=87544\">" $2 "</a></p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
(c == 2) {
|
|
|
|
print "<p class=\"weather\">" $0 "</p>";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
(/CDATA/) {
|
|
|
|
c++;
|
|
|
|
}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
section () {
|
2012-01-06 10:13:54 -07:00
|
|
|
echo "<h2><a href=\"$2\">$1</a></h2>"
|
2011-12-23 01:10:04 -07:00
|
|
|
echo "<ul>"
|
2012-02-15 10:41:09 -07:00
|
|
|
[ "$TINY" ] && pfx="http://news.google.com/gwt/x?u="
|
2011-12-23 01:10:04 -07:00
|
|
|
curl -s "$3" | \
|
2012-01-06 10:13:54 -07:00
|
|
|
awk -F '>' -v RS='<' -v m=${4:-5} -v pfx="$pfx" '
|
2011-12-23 01:10:04 -07:00
|
|
|
(/^item[> ]/) {
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
|
|
|
|
(/^title/) {
|
|
|
|
title=$2;
|
|
|
|
}
|
|
|
|
|
|
|
|
(a && a<m+1 && /^link/) {
|
|
|
|
l=$2;
|
|
|
|
sub(/.*url=/, "", l);
|
2012-01-06 10:13:54 -07:00
|
|
|
print "<li><a href=\"" pfx l "\">" title "</a></li>";
|
2011-12-23 01:10:04 -07:00
|
|
|
}'
|
|
|
|
|
|
|
|
echo "</ul>"
|
|
|
|
}
|
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
Content-type: text/html
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Houyhnhnm</title>
|
|
|
|
<style type="text/css">
|
|
|
|
h1 {
|
|
|
|
font-size: large;
|
|
|
|
font-weight: bold;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
h2 {
|
|
|
|
font-size: large;
|
|
|
|
font-weight: normal;
|
|
|
|
font-style: italic;
|
|
|
|
}
|
2011-12-23 15:42:43 -07:00
|
|
|
.calendar {
|
|
|
|
height: 300px;
|
|
|
|
float: right;
|
2011-12-23 01:10:04 -07:00
|
|
|
}
|
|
|
|
</style>
|
2011-12-23 22:08:24 -07:00
|
|
|
<link rel="icon" type="image/png" href="portal.png">
|
|
|
|
<meta http-equiv="refresh" content="500">
|
2011-12-23 01:10:04 -07:00
|
|
|
</head>
|
|
|
|
<body>
|
2011-12-23 15:42:43 -07:00
|
|
|
EOF
|
|
|
|
|
2012-02-15 10:41:09 -07:00
|
|
|
[ "$TINY" ] || \
|
|
|
|
echo '<iframe class="calendar" src="https://www.google.com/calendar/embed?title=Calendar&showTitle=0&showDate=0&showPrint=0&showTz=0&mode=AGENDA&height=350&wkst=1&bgcolor=%23FFFFFF&src=2cdrf19kah6jkonhom8evck38c%40group.calendar.google.com&color=%23333333&src=s531giqfiotabht4qrn59tjf9g%40group.calendar.google.com&color=%231B887A&src=umtjjc250gp0m5gm8h3dn13hcc%40group.calendar.google.com&color=%236E6E41&src=dartcatcher%40gmail.com&color=%23125A12&src=laderbydames%40gmail.com&color=%2323164E&src=uulosalamos.org_gu7e0s8dsh1tn8iktt468tk95k%40group.calendar.google.com&color=%232F6309&src=en.usa%23holiday%40group.v.calendar.google.com&color=%238D6F47&ctz=America%2FDenver"></iframe>'
|
2011-12-23 15:42:43 -07:00
|
|
|
|
|
|
|
cat <<EOF
|
2012-01-06 10:13:54 -07:00
|
|
|
<form action="http://www.google.com/"><input name="q" size="12"><input type="submit" value="G"></form>
|
2011-12-23 01:10:04 -07:00
|
|
|
EOF
|
|
|
|
weather
|
2012-02-15 10:41:09 -07:00
|
|
|
section LA \
|
|
|
|
'http://ladailypost.com/' \
|
|
|
|
'http://ladailypost.com/feed/'
|
2011-12-23 01:10:04 -07:00
|
|
|
section "CSM" \
|
|
|
|
'http://www.csmonitor.com/textedition' \
|
|
|
|
'http://rss.csmonitor.com/feeds/csm'
|
|
|
|
section NPR \
|
|
|
|
'http://thin.npr.org/t.php?tid=1001' \
|
|
|
|
'http://www.npr.org/rss/rss.php?id=1001'
|
2012-01-06 10:13:54 -07:00
|
|
|
section AJE \
|
|
|
|
'http://m.aljazeera.net' \
|
|
|
|
'http://www.aljazeera.com/Services/Rss/?PostingId=2007731105943979989'
|
2011-12-23 01:10:04 -07:00
|
|
|
section "Ars Technica" \
|
|
|
|
'http://m.arstechnica.com/' \
|
|
|
|
'http://feeds.arstechnica.com/arstechnica/index?format=xml'
|
2012-01-06 10:13:54 -07:00
|
|
|
section "Top Stories" \
|
|
|
|
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en' \
|
|
|
|
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&gwt=on&output=rss'
|
|
|
|
section "World News" \
|
|
|
|
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en&topic=w' \
|
|
|
|
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=w&output=rss'
|
2011-12-23 01:10:04 -07:00
|
|
|
cat <<EOF
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOF
|