Initial checkin of www stuff

This commit is contained in:
dfs
1997-01-16 04:00:26 +00:00
parent d0be59edff
commit 0f167686d9
13 changed files with 574 additions and 0 deletions

66
www/Makefile Normal file
View File

@@ -0,0 +1,66 @@
# Makefile for installing WWW server calendar scripts
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: Makefile,v 1.1 1997-01-16 04:00:26 dfs Exp $
# The complete name of your www host. Example: www.mycompany.com
WWWHOST = www.skoll.ca
# WWWHOST = www.mycompany.com
# The complete path to where the scripts actually live.
SCRIPTDIR = /var/lib/httpd/cgi-bin
# SCRIPTDIR = /home/dfs/Remind/www/TEST
# Where the scripts live as seen from the outside world. If
# they live in WWWHOST/cgi-bin, supply /cgi-bin
CGIDIR = /cgi-bin
# Location. Typically, a city name. Example: Ottawa
LOCATION = Ottawa
# LOCATION = New York
# Where do Remind and Rem2PS executables live?
REMIND = /usr/local/bin/remind
REM2PS = /usr/local/bin/rem2ps
# Don't change stuff below here.
# --------------------------------------------------------------------
all:
@echo "Edit the Makefile; then type 'make install' to install"
@echo "the www server scripts."
# OK, it's abominable. But it works...
install:
cp calps hebdate hebps moon sunrise sunset $(SCRIPTDIR)
chmod 755 $(SCRIPTDIR)/calps $(SCRIPTDIR)/hebdate $(SCRIPTDIR)/hebps $(SCRIPTDIR)/moon $(SCRIPTDIR)/sunrise $(SCRIPTDIR)/sunset
sed -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' < cal_dispatch-DIST > $(SCRIPTDIR)/cal_dispatch
chmod 755 $(SCRIPTDIR)/cal_dispatch
sed -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' < hebdate.rem-DIST > $(SCRIPTDIR)/hebdate.rem
chmod 644 $(SCRIPTDIR)/hebdate.rem
sed -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' < moon.rem-DIST > $(SCRIPTDIR)/moon.rem
chmod 644 $(SCRIPTDIR)/moon.rem
sed -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' < sunrise.rem-DIST > $(SCRIPTDIR)/sunrise.rem
chmod 644 $(SCRIPTDIR)/sunrise.rem
sed -e 's/Ottawa/$(LOCATION)/g' \
-e 's@http://your.machine/your.dir@http://$(WWWHOST)$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' < sunset.rem-DIST > $(SCRIPTDIR)/sunset.rem
chmod 644 $(SCRIPTDIR)/sunset.rem

41
www/README Normal file
View File

@@ -0,0 +1,41 @@
README
$Id: README,v 1.1 1997-01-16 04:00:26 dfs Exp $
HTML Hebrew Calendar Server
This is a very rudimentary Hebrew calendar server for the WWW. It supplies
local sunrise and sunset times, moon phases, upcoming Jewish holidays,
and PostScript calendars.
To install it, you need the Remind package, available via ftp from
ftp://ftp.doe.carleton.ca/pub/remind-3.0. You should install Remind,
setting the lattitude, longitude, location and time zone as appropriate
for your machine.
Once you have Remind installed, follow these steps to set up your WWW server.
1) Unpack all of the files into a convenient directory
2) edit "cal_dispatch" as instructed in the comments at the beginning
of the file.
3) Do "grep -i HREF *" to find all the hypertext links. Edit them
to point to the proper place on your system. The links should be
set as follows:
http://your.system.name/your_bin_name/cal_dispatch?what
Where "what" is one of:
sunrise, sunset, hebdate, calps, moon or hebps.
You must have the ability to execute cal_dispatch from within your
WWW server; consult your system administrator for details/permission.
4) Do "grep -i ottawa *" to find all references to "Ottawa" in the
scripts. Change them as appropriate for your location.
5) TEST ALL YOUR LINKS THOROUGHLY
6) Enjoy!

74
www/cal_dispatch-DIST Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/sh
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# CAL_DISPATCH -- Shell script for CGI directory to dispatch calendar
# commands.
#
# $Id: cal_dispatch-DIST,v 1.1 1997-01-16 04:00:26 dfs Exp $
#
# WARNING WARNING WARNING -- If your /bin/sh is really GNU's "bash",
# make sure you don't have a buggy version which treats char 0xFF as
# a command separator -- it is a security risk!
#########################
#
# Parameters for you to change
#
#########################
# Set DIR to the directory in which all the scripts live. They must all
# be in the same directory. The scripts are:
# cal_dispatch, cal_ps, hebdate, hebps, moon, sunrise and sunset.
# In addition, the reminder files hebbg.ps, hebdate.rem, moon.rem,
# sunrise.rem and sunset.rem must live in $DIR.
DIR=%SCRIPTDIR%
export DIR
# Set REMIND to the full pathname of the Remind executable.
REMIND=%REMIND%
export REMIND
# Set REM2PS to the full pathname of the rem2ps executable
REM2PS=%REM2PS%
export REM2PS
#########################
#
# Don't change anything after this.
#
#########################
if [ "$1" = "" ] ; then
exit 0
fi
case "$1" in
sunrise)
exec $DIR/sunrise
;;
sunset)
exec $DIR/sunset
;;
hebdate)
exec $DIR/hebdate
;;
calps)
exec $DIR/calps
;;
moon)
exec $DIR/moon
;;
hebps)
exec $DIR/hebps
;;
esac
exit 0

13
www/calps Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# PostScript calendar shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: calps,v 1.1 1997-01-16 04:00:27 dfs Exp $
echo "Content-type: application/postscript"
echo
$REMIND -p /dev/null | $REM2PS -e -c3
exit 0

26
www/hebdate Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
# Hebrew date shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: hebdate,v 1.1 1997-01-16 04:00:27 dfs Exp $
echo Content-type: text/html
cat <<EOM
<HTML>
<HEAD>
<TITLE>Hebrew date</TITLE>
</HEAD>
<BODY>
<H1>Hebrew date</H1>
EOM
$REMIND -arqh $DIR/hebdate.rem
echo "</BODY>"
echo "</HTML>"
exit 0

173
www/hebdate.rem-DIST Normal file
View File

@@ -0,0 +1,173 @@
# Hebrew date reminder file
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: hebdate.rem-DIST,v 1.1 1997-01-16 04:00:27 dfs Exp $
BANNER %
IF !$PSCAL
FSET _hstr(x) HEBDAY(x) + " " + HEBMON(x) + ", " + HEBYEAR(x)
FSET msgsuffix(x) "<P>"
MSG The Hebrew date for today, %d %m, %y, is [_hstr(today())]. %
MSG And the Hebrew date for tomorrow is [_hstr(today()+1)]. %
fset msgprefix(x) iif($NumTrig==OldTrig, "<H2>Upcoming Holidays</H2>"+char(13,10),"")
set oldtrig $numtrig
ENDIF
#JHOLS
##########################################################################
# #
# This portion of the file contains reminders for Jewish holidays. The #
# dates were obtained from "The First Jewish Catalog" by Richard Siegel #
# and Michael and Sharon Strassfeld, published by the Jewish Publication #
# Society of America. The Reform version of the calendar was guessed #
# at by David Skoll based on experience. Additional corrections were #
# made from the paper "Calendrical Calculations" by Nachum Dershowitz #
# and Edward M. Reingold. Any further corrections are welcome. #
# #
##########################################################################
# --- HERE ARE THE JEWISH HOLIDAYS ---
# Set the variable InIsrael to 1 if you live in Israel. Otherwise,
# you get the Diaspora versions of Jewish holidays
SET InIsrael 0
# Set the variable Reform to 1 if you want the Reform version of the
# Jewish calendar. Otherwise, you get the traditional version
SET Reform 0
# Convenient function definition to save typing
FSET _h(x, y) TRIGGER(HEBDATE(x,y))
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
FSET _PastSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, \
TRIGGER(_h2(x,y)), \
TRIGGER(_h2(x,y)+1))
# Default values in case InIsrael and Reform are not set
SET InIsrael VALUE("InIsrael", 0)
SET Reform VALUE("Reform", 0)
[_h(1, "Tishrey")] ++12 MSG %"Rosh Hashana 1%" is %b.
# No RH-2 or Tzom Gedalia in Reform
IF !Reform
[_h(2, "Tishrey")] ++12 MSG %"Rosh Hashana 2%" is %b.
[_PastSat(3, "Tishrey")] ++12 MSG %"Tzom Gedalia%" is %b.
ENDIF
[_h(10, "Tishrey")] ++12 MSG %"Yom Kippur%" is %b.
[_h(15, "Tishrey")] ++12 MSG %"Sukkot 1%" is %b.
IF !InIsrael
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
ENDIF
[_h(21, "Tishrey")] ++12 MSG %"Hashana Rabba%" is %b.
[_h(22, "Tishrey")] ++12 MSG %"Shemini Atzeret%" is %b.
IF InIsrael
[_h(22, "Tishrey")] ++12 MSG %"Simchat Torah%" is %b.
ELSE
[_h(23, "Tishrey")] ++12 MSG %"Simchat Torah%" is %b.
ENDIF
# Because Kislev can change length, we must be more careful about Chanukah
FSET _chan(x) TRIGGER(HEBDATE(24, "Kislev", today()-9)+x)
[_chan(1)] ++12 MSG %"Chanukah 1%" is %b.
[_chan(2)] MSG %"Chanukah 2%"
[_chan(3)] MSG %"Chanukah 3%"
[_chan(4)] MSG %"Chanukah 4%"
[_chan(5)] MSG %"Chanukah 5%"
[_chan(6)] MSG %"Chanukah 6%"
[_chan(7)] MSG %"Chanukah 7%"
[_chan(8)] MSG %"Chanukah 8%"
# Not sure about Reform's position on the next one.
IF !Reform
# The fast is moved to the 11th if the 10th is a Saturday
REM [_PastSat(10, "Tevet")] MSG %"Tzom Tevet%" is %b.
ENDIF
[_h(15, "Shvat")] ++12 MSG %"Tu B'Shvat%" is %b.
[_h(15, "Adar A")] ++12 MSG %"Purim Katan%" is %b.
# If Purim is on Sunday, then Fast of Esther is 11 Adar.
IF WKDAYNUM(_h2(13, "Adar")) != 6
REM [TRIGGER(_h2(13, "Adar"))] ++12 MSG %"Fast of Esther%" is %b.
ELSE
REM [TRIGGER(_h2(11, "Adar"))] ++12 MSG %"Fast of Esther%" is %b.
ENDIF
[_h(14, "Adar")] ++12 MSG %"Purim%" is %b.
[_h(15, "Nisan")] ++12 MSG %"Pesach%" is %b.
IF !InIsrael
[_h(16, "Nisan")] MSG %"Pesach 2%" is %b.
ENDIF
[_h(21, "Nisan")] MSG %"Pesach 7%" is %b.
IF !InIsrael && !Reform
[_h(22, "Nisan")] MSG %"Pesach 8%" is %b.
ENDIF
[_h(27, "Nisan")] ++12 MSG %"Yom HaShoah%" is %b.
[_h(4, "Iyar")] ++12 MSG %"Yom HaZikaron%" is %b.
[_h(5, "Iyar")] ++12 MSG %"Yom Ha'atzmaut%" is %b.
# Not sure about Reform's position on Lag B'Omer
IF !Reform
[_h(18, "Iyar")] ++12 MSG %"Lag B'Omer%" is %b.
ENDIF
[_h(28, "Iyar")] ++12 MSG %"Yom Yerushalayim%" is %b.
[_h(6, "Sivan")] ++12 MSG %"Shavuot%" is %b.
IF !InIsrael && !Reform
[_h(7, "Sivan")] MSG %"Shavuot 2%" is %b.
ENDIF
# Fairly sure Reform Jews don't observe the next two
IF !Reform
# Tzom Tamuz and Tish'a B'Av are moved to Sunday if they normally
# fall on a Saturday
[_PastSat(17, "Tamuz")] ++12 MSG %"Tzom Tammuz%" is %b.
[_PastSat(9, "Av")] ++12 MSG %"Tish'a B'Av%" is %b.
ENDIF
fset msgprefix(x) ""
# Counting the omer - do the whole spiel, i.e:
# "This is the xth day of the omer, being y weeks and z days of the omer."
# Nice Remind programming example here!
SET ostart HEBDATE(16, "Nisan", TODAY()-50)
IF ostart <= TODAY() && (TODAY() - ostart < 49)
SET odays TODAY()-ostart+1
IF odays < 7
MSG %"%"Today is the [ORD(odays)] day of the Omer.
ELSE
IF !(odays % 7)
MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays / 7] [PLURAL(odays/7, "week")] of the Omer.
ELSE
MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays/7] [PLURAL(odays/7, "week")] and [odays%7] [PLURAL(odays%7, "day")] of the Omer.
ENDIF
ENDIF
CAL [ORD(odays)] of Omer
ENDIF
IF !$PSCAL
REM 20 ++40 msg Click <a HREF="http://your.machine/your.dir/cal_dispatch?hebps">here</a> to get a PostScript calendar (about 35KB) for %m %y, complete with Hebrew dates, Jewish holidays, and moon phases for Ottawa. (This takes a few seconds to generate.)
ELSE
REM Sat PS [psshade(95)]
[trigger(moondate(0))] PS [psmoon(0)]
[trigger(moondate(1))] PS [psmoon(1)]
[trigger(moondate(2))] PS [psmoon(2)]
[trigger(moondate(3))] PS [psmoon(3)]
REM PS Border Border moveto /DayFont findfont 10 scalefont setfont ([hebday(today())] [hebmon(today())]) show
ENDIF

17
www/hebps Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# Hebrew PostScript calendar shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: hebps,v 1.1 1997-01-16 04:00:27 dfs Exp $
# Figure out the month: If day <= 20, use this month; otherwise, use
# next month.
echo "Content-type: application/postscript"
$REMIND - <<EOR
BANNER %
REM 20 ++40 RUN $REMIND -p $DIR/hebdate.rem %m %y | $REM2PS -e -c3
EOR
exit 0

15
www/moon Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# Moon shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: moon,v 1.1 1997-01-16 04:00:27 dfs Exp $
echo Content-type: text/html
echo
echo "<HTML>"
$REMIND $DIR/moon.rem
echo "</HTML>"
exit 0

34
www/moon.rem-DIST Normal file
View File

@@ -0,0 +1,34 @@
# File for giving moon phase info.
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: moon.rem-DIST,v 1.1 1997-01-16 04:00:28 dfs Exp $
set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Moon over Ottawa</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Moon over Ottawa</H1>
set ndate moondate(0)
set ntime moontime(0)
set fdate moondate(2)
set ftime moontime(2)
fset t(x) wkday(x)+", "+day(x)+" "+mon(x)+", "+year(x)
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
if ndate < fdate
msg The next new moon is on [t(ndate)] at [ntime], Ottawa time.<P>
msg The next full moon is on [t(fdate)] at [ftime], Ottawa time.<P>
else
msg The next full moon is on [t(fdate)] at [ftime], Ottawa time.<P>
msg The next new moon is on [t(ndate)] at [ntime], Ottawa time.<P>
endif

15
www/sunrise Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# Sunrise shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: sunrise,v 1.1 1997-01-16 04:00:28 dfs Exp $
echo Content-type: text/html
echo
echo "<HTML>"
$REMIND -arqh $DIR/sunrise.rem
echo "</HTML>"
exit 0

42
www/sunrise.rem-DIST Executable file
View File

@@ -0,0 +1,42 @@
# File for giving sunrise info
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: sunrise.rem-DIST,v 1.1 1997-01-16 04:00:28 dfs Exp $
set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Sunrise in Ottawa</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Sunrise in Ottawa</H1>
set tod sunrise(today())
set tom sunrise(today()+1)
set len1 sunset(today())-sunrise(today())
set len2 sunset(today()+1)-sunrise(today()+1)
set dlen len2-len1
set slen iif(dlen==0, "the same length as", dlen<0, abs(dlen)+plural(abs(dlen)," minute", " minutes")+" shorter than", dlen+plural(dlen, " minute", " minutes")+" longer than")
set diff tod-now
set adiff abs(diff)
set hdiff adiff/60
set mdiff adiff%60
set mstr iif(mdiff==0, "", mdiff == 1, "1 minute", mdiff + " minutes")
set hstr iif(hdiff==0, "", hdiff == 1, "1 hour", hdiff + " hours")
set astr iif(mdiff!=0 && hdiff!=0, " and ", "")
set fn iif(diff==0, "now", diff <0, "ago", "from now")
set iw iif(diff<0, "was", "is")
set aw iif(tod==tom, " as well.", ".")
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
msg Sunrise today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunrise tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>
msg </BODY>

15
www/sunset Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# Sunset shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: sunset,v 1.1 1997-01-16 04:00:28 dfs Exp $
echo Content-type: text/html
echo
echo "<HTML>"
$REMIND -arqh $DIR/sunset.rem
echo "</HTML>"
exit 0

43
www/sunset.rem-DIST Normal file
View File

@@ -0,0 +1,43 @@
# File for giving sunset info
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# $Id: sunset.rem-DIST,v 1.1 1997-01-16 04:00:28 dfs Exp $
set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Sunset in Ottawa</TITLE>%
MSG </HEAD>%
MSG <BODY>
MSG <H1>Sunset in Ottawa</H1>
set tod sunset(today())
set tom sunset(today()+1)
set len1 sunset(today())-sunrise(today())
set len2 sunset(today()+1)-sunrise(today()+1)
set dlen len2-len1
set slen iif(dlen==0, "the same length as", dlen<0, abs(dlen)+plural(abs(dlen)," minute", " minutes")+" shorter than", dlen+plural(dlen, " minute", " minutes")+" longer than")
set diff tod-now
set adiff abs(diff)
set hdiff adiff/60
set mdiff adiff%60
set mstr iif(mdiff==0, "", mdiff == 1, "1 minute", mdiff + " minutes")
set hstr iif(hdiff==0, "", hdiff == 1, "1 hour", hdiff + " hours")
set astr iif(mdiff!=0 && hdiff!=0, " and ", "")
set fn iif(diff==0, "now", diff <0, "ago", "from now")
set iw iif(diff<0, "was", "is")
set aw iif(tod==tom, " as well.", ".")
msg Today is %w, %d %m, %y.<P>
msg The local time in Ottawa is [now].<P>
msg Sunset today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunset tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>
msg </BODY>