From: Colin Watson Date: Tue, 20 Aug 2002 14:11:35 +0000 (+0000) Subject: Move AFE-related programs into a separate directory. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=5e1cbbe765ffc75d99c0acdbf00f5c9ef6d107bc Move AFE-related programs into a separate directory. --- diff --git a/afe-stats b/afe-stats deleted file mode 100755 index 669ff97..0000000 --- a/afe-stats +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -statnews --from=`date -d '1 week ago' +%d/%m/%Y` --nocapitalize alt.fan.eddings diff --git a/afec-faq b/afec-faq deleted file mode 100755 index a234904..0000000 --- a/afec-faq +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -# Post the alt.fan.eddings.creative FAQ every fortnight -cd $HOME/afe/daemons -$HOME/bin/crondiv 2 afec-faq.log inews -hS afec-faq.txt diff --git a/afeweb-backup b/afeweb-backup deleted file mode 100755 index d836c52..0000000 --- a/afeweb-backup +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh - -YEARTHISWEEK=`date +%Y-w%V` -YEARLASTWEEK=`date -d '1 week ago' +%Y-w%V` -DAY=`date +%w | sed 's/0/7/'` - -LABDIR=/tmp/afeweb.$YEARTHISWEEK-$DAY -if [ $DAY -eq 1 ]; then - OLDTAR=$HOME/backups/afeweb-$YEARLASTWEEK.tar.gz - NEWTAR=$HOME/backups/afeweb-$YEARTHISWEEK.tar.gz -else - OLDTAR=$HOME/backups/afeweb-$YEARTHISWEEK.tar.gz - unset NEWTAR -fi -DIFFGZ=$HOME/backups/afeweb-$YEARTHISWEEK-$DAY.diff.gz -TOPDIR=tolhoneth -SOURCEPARENT=/var/www -SOURCEDIR=tolhoneth - -if [ -f $OLDTAR ]; then - # Extract old tarball and set up diffing environment - mkdir $LABDIR - cd $LABDIR - tar xzf $OLDTAR - mv $TOPDIR $TOPDIR.orig - ln -s $SOURCEPARENT/$SOURCEDIR $TOPDIR - - # Do the diff and clean up - diff -Naru $TOPDIR.orig $TOPDIR | gzip > $DIFFGZ - cd - - rm -rf $LABDIR -fi - -if [ "$NEWTAR" ]; then - # First day of the week, so build a new tarball - cd $SOURCEPARENT - tar czf $NEWTAR $SOURCEDIR - cd - -fi - diff --git a/archive-news.pl b/archive-news.pl deleted file mode 100755 index 4f6f44b..0000000 --- a/archive-news.pl +++ /dev/null @@ -1,62 +0,0 @@ -#! /usr/bin/perl -w -use diagnostics; -use strict; - -use Net::NNTP; - -my $nntp; - -sub usage () -{ - print STDERR <<"EOF"; -Usage: $0 hostname newsgroup-name archive-directory -EOF - exit 1; -} - -sub bail ($) -{ - my $msg = shift; - $nntp->quit; - print STDERR "$msg\n"; - exit 1; -} - -my $host = shift or usage; -my $group = shift or usage; -my $archive = shift or usage; --d $archive or usage; - -opendir ARCHIVE, $archive or die "can't opendir $archive: $!"; -my @list = grep m/^\d+$/, readdir ARCHIVE; -closedir ARCHIVE; - -@list = sort { $a <=> $b } @list; -my $start = scalar @list ? $list[$#list] + 1 : 0; - -$nntp = Net::NNTP->new($host); -# Bah, password in clear, oh well, it's only passworded to keep the -# howling masses out anyway ... -#$nntp->authinfo('afe', 'MyTest'); - -my ($narticles, $first, $last, $name) = $nntp->group($group); -(defined $first and defined $last) or bail "Couldn't set group to $group"; - -exit if $last <= $start; -$start = $first if $first > $start; - -for my $index ($start..$last) -{ - my $article = $nntp->article($index); - if (defined $article) - { - open ARTICLE, ">$archive/$index" - or die "can't open $archive/$index for writing: $!"; - print ARTICLE join '', @$article; - close ARTICLE; - } - #print STDERR "$group $index\n"; -} - -$nntp->quit; - diff --git a/countafe b/countafe deleted file mode 100755 index b2ea8a9..0000000 --- a/countafe +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -e -echo -n "$* " -grep -c "$*" afe-posters diff --git a/faq-pointer b/faq-pointer deleted file mode 100755 index cbd76f3..0000000 --- a/faq-pointer +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -# Post the alt.fan.eddings FAQ pointer every six days -cd $HOME/afe/daemons -$HOME/bin/crondiv 6 faq-pointer.log inews -hS faq-pointer.txt diff --git a/faq2html.pl b/faq2html.pl deleted file mode 100755 index 15305de..0000000 --- a/faq2html.pl +++ /dev/null @@ -1,445 +0,0 @@ -#! /usr/bin/perl -w -use strict; -require 5.000; -use lib qw(.); -use Style qw(html_header html_footer); - -# The AFE FAQ HTMLizer -# Perl version written by Kamion; based on a sed script by Aquarius - -sub usage () -{ - print STDERR <<"EOF"; -Usage: $0 index-filename [up-URL] < faq-document - -URLs may be absolute or relative. - -EOF - exit 1; -} - -sub html_escape (\$) -{ - my $line = shift; - return unless defined $$line; - $$line =~ s/\&/&/g; - $$line =~ s//>/g; - $$line =~ s/"/"/g; - $$line =~ s/æ/æ/g; - return $$line; -} - -#my $sts_link = "http://riva.ucam.org/~kamion/archive-bin/" . -# "article.pl?msgid=5n0qq5\$d9p\@mercury.dur.ac.uk"; -my $sts_link = 'http://groups.google.com/groups?' . - 'q=Easter+Egg&ic=1&selm=5n0qq5%24d9p%40mercury.dur.ac.uk'; - -# Paragraph to format and undefine, followed optionally by open and close tags. -sub print_paragraph (\$;$$) -{ - my $para = shift; - return unless defined $$para && $$para !~ /^\s*$/; - my $open_tags = shift; - my $close_tags = shift; - - # Make URLs links - $$para =~ s#(http:(?:[^\ \&<]|\&(?!gt;))*) - #$1#gx; - - # Make all text within pairs of underscores outside URLs emphasized - $$para =~ s[_((?:[^_.-])+\.?)_ - (?![^"]*">|[^<]*)][$1]gx; - - # Similarly, strengthen bold text within asterisks - $$para =~ s[\*((?:[^*.])+\.?)\* - (?![^"]*">|[^<]*)][$1]gx; - - # Easter egg - $$para =~ s|(Sephrenia the Styric)|$1|g; - - $$para = "$open_tags$$para" if defined $open_tags; - $$para .= $close_tags if defined $close_tags; - - print "$$para\n"; - undef $$para; -} - -my $index_file = shift or usage; -my $up_url = shift; - -open CONTROL, ">control.html" or die "Can't write to control.html: $!"; -select CONTROL; - -html_header "Revision information", $index_file; -print "\n"; - -my $changes_done = 0; - -print "
\n";
-while (<>)
-{
-    $changes_done = 1 if (/^Archive-name:/);
-    next unless $changes_done;
-    chomp;
-    html_escape $_;
-    last if (/^\s*$/);
-    unless (/^([^:]+:)\s*(.+)$/)
-    {
-	warn "Non-header line found in control section: $_";
-	next;
-    }
-    print "$_\n";
-}
-print "
\n\n"; - -html_footer $index_file; - -open INDEX, ">$index_file" or die "Can't write to $index_file: $!"; -select INDEX; - -html_header "Contents", $up_url; -print "\n"; - -print "

\n"; -while (<>) -{ - last if /^\s*$/; - html_escape $_; - print; -} -print "

\n\n"; - -print "

Revision information

\n"; - -my $paragraph; -my $listentry = 0; -my $level = 0; -my @lastvalues = (); - -while (<>) -{ - chomp; - s/^\s*//; - html_escape $_; - # Stop at TOC-body separator - if (/--------/) - { - print_paragraph $paragraph, "", $listentry ? "" : ""; - last; - } - # Convert headings to links - my $line = $_; - if ($line =~ /([0-9]+)((?:.[0-9]+)*)[\)\s]/) - { - my $firstcomp = $1; - my $heading = "$1$2"; - my @components = split /\./, $heading; - if (@components > 0) - { - $line =~ /\s+(.*)$/g; - my $linetail = $1; - print_paragraph $paragraph, "", $listentry ? "" : ""; - - # Change level of ordered list if necessary - if (@components > $level) - { - print "
    \n" x (@components - $level); - } - elsif (@components < $level) - { - print "
\n" x ($level - @components); - } - #print "

\n\n" if @components == 1 && $level > 0; - print "\n
\n\n" if @components == 1 && $level > 0; - $level = @components; - $#lastvalues = $level; - #print "

\n" if $level == 1; - - # Reformat the current line - my $value = $components[$#components]; - if (defined $lastvalues[$level] && - $lastvalues[$level] + 1 != $value) - { - warn "Missing item in contents before $heading"; - print "

  • "; - } - elsif ($value != 1) - { - print "
  • "; - } - else - { - print "
  • "; - } - $lastvalues[$level] = $value; - print "\n"; - $paragraph = $linetail; - $listentry = 1; - next; - } - } - elsif (/^[A-Z][^a-z]+$/) - { - print_paragraph $paragraph, "", $listentry ? "" : ""; - if ($level == 0) - { - print "\n

    $_

    \n\n"; - } - else - { - #print "

    \n\n"; - print "\n\n" x ($level - 1); - print "\n" if $level == 1; - print "

    $_

    \n\n"; - print "
      \n" x ($level - 1); - #print "

      \n"; - $#lastvalues = 0; - } - $listentry = 0; - next; - } - elsif (/^$/) - { - print_paragraph $paragraph, "", $listentry ? "" : ""; - $listentry = 0; - next; - } - print_paragraph $paragraph; - $paragraph = $_; -} - -# Do all the necessary end tags -#print "

      \n" if $level > 0; -print "\n
      \n" if $level > 0; -print "\n"; -print "
    \n\n" x $level; - -html_footer $up_url; -select STDOUT; -close INDEX; - -$paragraph = <>; -my $oldsection; -my $section; -my $section_open = 0; -my $num_sections = $lastvalues[1]; -my $in_heading = 0; -my $in_h2 = 0; -$level = 0; -$#lastvalues = -1; - -my $heading_pat = qr/^\s*([0-9]+(?:.[0-9]+)*)\)\s+/; - -while (<>) -{ - s/\s+\n/\n/; - html_escape $_; - - if (/^\s*([0-9]+)\)\s/) - { - chomp $paragraph if defined $paragraph; - if ($section_open) - { - if ($in_heading) - { - print_paragraph $paragraph, "", ""; - } - else - { - print_paragraph $paragraph, "

    \n", "\n

    "; - } - } - $in_heading = $in_h2 = 0; - $oldsection = $section; - $section = $1; - print "\n" if $section_open; - print "\n\n" x $level if $section_open; - html_footer $index_file, - ($oldsection > 1) ? - ("part" . ($oldsection - 1) . ".html") : - undef, - "part" . ($oldsection + 1) . ".html" - if $section_open; - open SECTION, ">part$section.html" or - die "Couldn't write to part$section.html: $!"; - select SECTION; - html_header "section $section", - $index_file, - "part" . ($section - 1) . ".html", - ($section < $num_sections) ? - ("part" . ($section + 1) . ".html") : - undef; - $section_open = 1; - $level = 0; - $#lastvalues = -1; - } - - # Convert headings to anchors in list items - if (/$heading_pat/) - { - my $heading = $1; - my @components = split /\./, $heading; - chomp $paragraph if defined $paragraph; - if ($in_heading) - { - print_paragraph $paragraph, "", "\n"; - } - else - { - print_paragraph $paragraph, "

    \n", "\n

    \n"; - } - $in_h2 = 0; - - # Change level of ordered list if necessary - if (@components > $level) - { - print "
      \n\n" x (@components - $level); - } - elsif (@components < $level) - { - print "
    \n\n" x ($level - @components); - } - $level = @components; - $#lastvalues = $level; - - my $value = $components[$#components]; - if (@components == 1) - { - chomp; - s|$heading_pat|
  • |; - $in_h2 = 1; - } - elsif (defined $lastvalues[$level] && - $lastvalues[$level] + 1 != $value) - { - warn "Missing item in main document before $heading"; - s|$heading_pat|
  • |; - } - elsif ($value != 1) - { - s|$heading_pat|
  • |; - } - else - { - s|$heading_pat|
  • |; - } - $lastvalues[$level] = $value; - - warn "Heading $heading encountered outside a section" - unless defined $section; - warn "Heading $heading encountered in section $section" - if defined $section && $heading !~ /^$section(?:\.|$)/; - - $in_heading = 1; - } - - # Mark unnumbered headings - if (/^([A-Z][^a-z]*[A-Z])\n/) - { - chomp; - $paragraph = $_; - - print "\n\n" x ($level - 1); - print "\n" if $level != 1; - print_paragraph $paragraph, "

    ", "

    "; - $in_heading = $in_h2 = 0; - print "\n
      \n" x ($level - 1); - $#lastvalues = 0; - - $_ = ""; - } - - # If this is a paragraph delimiter of some kind (usually a blank line), - # print the preceding paragraph, handling things we recognize as tables. - if (defined $paragraph && - (/^\n/ || ($in_heading && $paragraph =~ /]*>.{0,40}$/))) - { - if (($paragraph =~ /ISBN +[0-9]-/ && - $paragraph =~ /\((?:hc|pb|trade pb)\)/) - || $paragraph =~ /c\/o Del Rey Books/ - || $paragraph =~ /esper\.net$/m) - { - $paragraph =~ s/\n/
      \n/g; - } - else - { - # We have to split up the paragraph and work line-by-line here; - # multi-line regexps are really hard to get right. - my @parlines = split /\n/, $paragraph; - my $prevline; - foreach my $parline (@parlines) - { - unless (defined $prevline) - { - $prevline = \$parline; - next; - } - if ($parline =~ /^(\s*)((?:\w\)| - \[\w\]| - \w+(?:\s+\w+)?:\s*http).*| - \<http(?:[^&]|\&(?!gt;))*\>)$/x) - { - $parline = "$1$2
      "; - $$prevline .= "
      " if $$prevline !~ /
      $/; - } - $prevline = \$parline; - } - $paragraph = (join "\n", @parlines) . "\n"; - $paragraph =~ s/:$/:
      /gm; - } - chomp $paragraph; - $paragraph =~ s/(\S) +/$1 /g unless /
      /; - if ($in_h2) - { - print_paragraph $paragraph, "", "
  • \n"; - $in_h2 = 0; - } - else - { - if ($in_heading) - { - print_paragraph $paragraph, "", ""; - } - else - { - print_paragraph $paragraph, "

    \n", "\n

    "; - } - } - $in_heading = 0; - $paragraph = "$_" unless /^\n?$/; - } - elsif (defined $paragraph) - { - $paragraph .= "$_"; - } - else - { - $paragraph = "$_" unless /^\n?$/; - } -} - -if ($section_open) -{ - chomp $paragraph if defined $paragraph; - if ($in_heading) - { - print_paragraph $paragraph, "", "
    "; - } - else - { - print_paragraph $paragraph, "

    \n", "\n

    "; - } - print "\n"; - print "\n\n" x $level; - - html_footer $index_file, - ($section > 1) ? ("part" . ($section - 1) . ".html") : undef, - undef; - close SECTION if $section_open; -} -else -{ - warn "No sections encountered"; -} - diff --git a/horja b/horja deleted file mode 100755 index e56129d..0000000 --- a/horja +++ /dev/null @@ -1,4 +0,0 @@ -grep -v ^# birthdays.txt | grep '[^/]*'/$(date +%m/%d) | tr '\t' ' ' | sed \ -'s|/../.. *|\\|'|awk -F\\ '{A='$(date +%Y)'-$1; gsub("['\''\"( ]","\\\\&", \ -$2);srand();system("sed "($1=="XXXX"?"/AGE/,/^/d":"s/AGE/"A"/")" message." \ -"txt | sed s/NAME/"$2"/|cat - horja"(rand()>10?"":".sig")" | inews -hOS");}' diff --git a/mordja b/mordja deleted file mode 100755 index 10a1755..0000000 --- a/mordja +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -e - -# Usage: mordja to-address subject file - -export PATH=/usr/bin:/bin - -cd ~/afe/daemons/mordja -{ cat "$3"; echo '-- '; cat .signature; } | mutt -F .muttrc -s "Re: $2" "$1" - diff --git a/mordja-zip b/mordja-zip deleted file mode 100755 index 4542b2b..0000000 --- a/mordja-zip +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -e - -# Usage: mordja to-address subject file - -export PATH=/usr/bin:/bin - -cd ~/afe/daemons/mordja -{ echo '-- '; cat .signature; } | mutt -F .muttrc -s "Re: $2" "$1" -a "$3" - diff --git a/prune-sessions b/prune-sessions deleted file mode 100755 index 215d96a..0000000 --- a/prune-sessions +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -cd $HOME/public_html/kamion/archive-bin -exec ./prune-sessions.pl 96 diff --git a/run-horja b/run-horja deleted file mode 100755 index 069fea4..0000000 --- a/run-horja +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/bash - -# Run the alt.fan.eddings Birthday Daemon -cd $HOME/afe/daemons -export PATH=$HOME/bin:$PATH -$HOME/bin/horja diff --git a/silver-suggestions b/silver-suggestions deleted file mode 100755 index 2657001..0000000 --- a/silver-suggestions +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -# Post the Silver Suggestions every fortnight -cd $HOME/afe/daemons -$HOME/bin/crondiv 2 silver-suggestions.log inews -hS silver-suggestions.txt diff --git a/tabulateafe b/tabulateafe deleted file mode 100755 index 1178433..0000000 --- a/tabulateafe +++ /dev/null @@ -1 +0,0 @@ -cut -d' ' -f2- afe-posters | sort | uniq | sed -e 's/"/\\"/g' | sed -e 's/ /\\ /g' | sed -e s/\'/\\\\\'/g | xargs -n 1 countafe