Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts on keeping my local "mirror" of parts of the internet
#   (on /snarf).
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/snarf.e>
#           or at <http://angg.twu.net/e/snarf.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######




#####
#
# psne
#
#####

# (find-fline "~/.zshrc" "function psne")
# (find-fline "~/.psne.log")
# (find-fline "$S/.psne.log")
# (find-es "wget" "wget_patch_potato")



#####
#
# Removing empty dirs
#
#####

cd /snarf
# find * -type d | perl -nle 'print ":$_:";'
find * -type d -depth | perl -nle 'rmdir && print $_;'



#####
#
# Updating ~/osnl
#
#####

find /snarf/ -type f -or -type l |
  sort > ~/osnl

# (find-fline "~/osnl")



#####
#
# exile
#
#####

# (find-fline "~/TCL/exile")

proc readfile {fname} {
  set channel [open $fname r]; set bigstr [read $channel]; close $channel
  return $bigstr
}
proc writefile {fname bigstr} {
  set channel [open $fname w]; puts -nonewline $channel $bigstr; close $channel
}

proc sys {args} { puts [join $args]; puts [eval exec -- $args] }
set lines [split [read stdin] "\n"]
foreach line $lines {
  if [regexp "^ " $line] {
    if [regexp "^ /snarf/(.*)/(.*)\$" $line {} pdir fname] {
      sys mkdir -p /esnarf/$pdir/
      sys mv -fv /snarf/$pdir/$fname /esnarf/$pdir/
    } else {
      puts "??: $line"
    }
  }
}



agrep '^ ' ~/osnl | eet


# (find-fline "~/osnl" "danu")
# (find-fline "~/osnl" "bliss")



######
#
# freshmeat
#
######

(for i in 0{1,2,3,4,5,6,7,8,9} {1,2}{1,2,3,4,5,6,7,8,9} 3{0,1}; do
  psne http://ct.us.mirrors.freshmeat.net/news/1999/05/$i/
done) |& tee o

cd $S/http/www.freshmeat.net/news/1999/05/
for i in $(find * -type f | grep '\.html$'); do
  echo $i
  unhtml < $i > $i.txt
done

cd $S/http/www.freshmeat.net/news/1999/05/
agrep -i blade $(find * -type f | grep '\.html.txt$' | sort -r)




######
#
# debian
#
######

# (find-es "net" "netselect")
# (find-es "net" "debian_mirrors")

mynetselect $(cat /usr/doc/netselect/examples/debian-ftp-mirrors)
# (find-fline "~/o2")

psne $FDEBIAN_CDROM/ls-lR.gz

cd $SDEBIAN
gzip -dv ls-lR.gz
~/ICON/lslR2find < ls-lR > ls-lR.i




#####
#
# Comparing two snarf directories
#
#####

cd /hda3/snarf
find * -type f > /tmp/o.hda3 &
cd /hdd2/snarf
find * -type f > /tmp/o.hdd2 &

cat /tmp/o.hda3 /tmp/o.hdd2 | sort | uniq -d > /tmp/o.both
# (find-fline "/tmp/o.both")
# (find-pl5pod "func" "unlink LIST")

cd /hda3/snarf/ \
  && cat /tmp/o.both \
   | perl -nle 'unlink && print $_;' \
   |& tee ~/o

cd /hda3/snarf/ \
  && find * -type d -depth \
   | perl -nle 'rmdir && print $_;'

cd /hda3/snarf/ \
  && find * -type l \
   | perl -nle 'unlink && print $_;'

cd /hda3/snarf/ \
  && for i in $(find * -type f); do
     laf /snarf/$i
  done


cd /hda3/snarf/
# (find-pl5pod "func" "mkdir FILENAME,MODE")
# (find-pl5pod "func" "C<0777> for directories")
find * -type d \
  | perl -nle 'mkdir "/snarf/$_", 0777;'
read
for i in $(find * -type f); do
  cp -v $i /snarf/$i
done

# (find-fline "/hda3/snarf/ftp/metalab.unc.edu/pub/docs/books/gutenberg/etext91/moby.zip")



#  Local Variables:
#  coding:               no-conversion
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  ee-charset-indicator: "Ñ"
#  End: