####### # # E-scripts on maintaining my home page. # # 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 # or at . # See also , # , # , # , # and . # ####### # «.full_upload» (to "full_upload") # «.upload_changes» (to "upload_changes") # «.upload-eev» (to "upload-eev") # «.upload-rsync» (to "upload-rsync") # «.lstoindexhtml_lua» (to "lstoindexhtml_lua") # «.rumi_dl_angg_install» (to "rumi_dl_angg_install") # «.rumi_dl_angg_compare» (to "rumi_dl_angg_compare") # «.rumi_upl_to_gmail» (to "rumi_upl_to_gmail") # «.angg_dl_rumi_compare» (to "angg_dl_rumi_compare") # «.compare-home-and-tourism» (to "compare-home-and-tourism") # «.compare-produce-o.tgz» (to "compare-produce-o.tgz") # «.compare-tp-and-home» (to "compare-tp-and-home") # «.add-extras-make-o.tgz» (to "add-extras-make-o.tgz") # «.compare-o.tgz-and-home» (to "compare-o.tgz-and-home") # «.NOTCL» (to "NOTCL") # «.quick-upload-to-zumbi» (to "quick-upload-to-zumbi") # «.vcsa2pnm_icon» (to "vcsa2pnm_icon") # «.vcsa2pnm» (to "vcsa2pnm") # «.capture_screen» (to "capture_screen") # «.math.th-files» (to "math.th-files") # «.mathstuff.pack» (to "mathstuff.pack") # «.cgis_on_twu» (to "cgis_on_twu") # «.info2www_twu» (to "info2www_twu") # «.man2html» (to "man2html") # «.eeman» (to "eeman") # «.slow_html-twu» (to "slow_html-twu") # «.zsh-on-twu» (to "zsh-on-twu") # «.lua50-on-twu» (to "lua50-on-twu") # «.test_unpacking» (to "test_unpacking") # «.tp» (to "tp") # «.apt_repository» (to "apt_repository") # «.checking_broken_links» (to "checking_broken_links") # «.makeapacheindex» (to "makeapacheindex") # «.upload-edrx.tgz-with-rsync» (to "upload-edrx.tgz-with-rsync") # «.download-edrx.tgz-and-sync» (to "download-edrx.tgz-and-sync") # «.upload-o.tgz» (to "upload-o.tgz") # «.download-o.tgz-and-sync» (to "download-o.tgz-and-sync") # (find-efunction 'eejump) upload-e-w-rsync persephone ----------------> angg (edrx.tgz) ^ (8J) | dl-o.tgz-|(8888J) (88J)|dl-edrx.tgz and-sync| |-and-sync | upload-o.tgz v gmail (o.tgz) <------------ sweetjane (888J) ##### # # Uploading the full page # 99dec12 # ##### # «full_upload» (to ".full_upload") # make the bundle, upload to twu, generate things there # makeL cd ~/TH/L/ make -f a/s/Makefile a/s/edrx.tgz anonftp angg.twu.net 'lcd a/s/' 'put edrx.tgz' 'quit' # # Always update ~/pagetwu.tgz after a full upload cp ~/TH/L/a/s/edrx.tgz ~/pagetwu.tgz # # «twu_make_page» # At twu (with zsh; use sshtwu and eevt): makepage # (find-angg ".zshrc" "makepage") # To upload directly to sucuri: # makeLedrxtgz scpsucuri ~/TH/L/edrx.tgz edrx@sucuri: # ##### # # Partial uploads # 99dec27 # ##### # «upload_changes» (to ".upload_changes") # (find-angg ".emacs" "upload-changes") # makeLedrxtgz rm -Rv /tmp/oldpage/ rm -Rv /tmp/newpage/ mkdir /tmp/oldpage/ cd /tmp/oldpage/ tar -xvzf ~/pagetwu.tgz mkdir /tmp/newpage/ cd /tmp/newpage/ tar -xvzf ~/TH/L/edrx.tgz # Delete the files that haven't changed: cd /tmp/newpage/ for i in $(find . -type f -or -type l); do cmp $i ../oldpage/$i && rm -v $i done # Pack the changed files and upload them. cd /tmp/newpage/ tar -cvzf /tmp/pagechanges.tgz $(find . -type f -or -type l) laf /tmp/pagechanges.tgz anonftp angg.twu.net 'lcd /tmp' 'put pagechanges.tgz' 'quit' # (find-angg ".zshrc" "scp") # scpsucuri /tmp/pagechanges.tgz edrx@sucuri:pagechanges.tgz # # If all went well then update our notion of what's in twu. cp ~/TH/L/edrx.tgz ~/pagetwu.tgz # # For when I want to upload everything: makeLedrxtgz cd ~/TH/L/ anonftp angg.twu.net 'put edrx.tgz' 'quit' # ##### # # Partial uploads using rsync # 2005jul19 # ##### # «upload-eev» (to ".upload-eev") # # Remake eev-current.tar.gz cd ~/eev-current/ # (find-eevfile "Makefile" "htmls:") # make htmls # make CVSEMACS=$HOME/bigsrc/emacspreunicode/emacs/src/emacs htmls make CVSEMACS=$HOME/bigsrc/emacs/src/emacs htmls makeL cd ~/eev-current/ rm -v /tmp/eev-current.tar.gz make /tmp/eev-current.tar.gz cp -v /tmp/eev-current.tar.gz ~/TH/L/eev-current/ cp -v /tmp/eev-current.tar.gz ~/TH/L/ # (find-es "page" "lstoindexhtml_lua") for i in $(cd ~/TH/L/ && find .* * -type d); do cd ~/TH/L/$i && LC_COLLATE=C lstoindexhtml_lua_maybe $i done # # (find-angg ".zshrc" "eev-current-upload") eev-current-upload # # «upload-rsync» (to ".upload-rsync") # Make edrx.tar and update the one in angg.twu.net from it using rsync # «upload-edrx.tgz-with-rsync» (to ".upload-edrx.tgz-with-rsync") makeLhomeedrxtgz zcat ~/edrx.tgz > /tmp/edrx.tar laf /tmp/edrx.tar # echo 'l $passwd(twu)' > $EEG # eegpasswd \ autopasswd \ rsync -avvz -e ssh /tmp/edrx.tar edrx@angg.twu.net:edrx.tar # On twu: ## rm -Rf ~/public_html/ 2>&1 | head -n 1000 # makepagefromtar # # (find-angg ".zshrc" "makepagefromtar")  (fvwm-sloppy-focus)  (eebgTWU)  (fvwm-click-to-focus) zsh #zsh30 cd; tar -xvf edrx.tar; rezshrc {makepagefromtar; makepageindexhtmls} |& tee ~/ompft # (find-fline "/edrx@angg.twu.net:ompft") # (find-fline "/ftp:edrx@angg.twu.net:ompft")  (eebgTWU) zsh {makepagefromtar; makepageindexhtmls} |& tee ~/ompft # «lstoindexhtml_lua» (to ".lstoindexhtml_lua") for i in $(cd ~/public_html && find .* * -type d); do cd ~/public_html/$i && LC_COLLATE=C lstoindexhtml_lua_maybe $i .favicon.png done # makeLedrxtgz cd ~/TH/L/ # (find-angg ".zshrc" "remote-accounts") echo 'l $passwd(puc)' > $EEG; eegpasswd scp edrx.tgz edrx@$SUCURI: # # (eev "Scp edrx@angg.twu.net:ompft /tmp/ompft") # (find-fline "/tmp/ompft") # (find-man "1 rsync" "by sending only the differences") # (find-man "1 rsync" "-z, --compress") # (find-man "1 rsync" "-W, --whole-file\n") # (find-man "1 rsync" "--no-whole-file\n") ##### # # compare ~ with the tourism package, produce an o.tgz with the changes # 2006jun23 # ##### # «compare-home-and-tourism» (to ".compare-home-and-tourism") # # Unpack ~/edrx.tgz (the tourism package, fetched from twu) into # /tmp/TP/, and produce (find-fline "/tmp/.tp.files") rm -Rv /tmp/TP/ mkdir /tmp/TP/ tar -xvzf ~/edrx.tgz -C /tmp/TP/ # cd /tmp/TP/ && find -type f | sort | cut -b 3- > /tmp/.tp.files cd /tmp/TP/ && find $('ls' -A) -type f | sort > /tmp/.tp.files # Produce (find-fline "/tmp/.tp.files.changed") # and (find-fline "/tmp/.tp.files.changed.e") # (find-angg "LUA/lua50init.lua") cd /tmp/TP/ lua50 -e ' HOME = getenv("HOME") files = split(readfile("/tmp/.tp.files")) for i=1,getn(files) do local fname = files[i] local fname2 = HOME.."/"..fname f1 = readfile(fname) f2 = readfile(fname2) if f1 ~= f2 then print(fname) end end ' | tee /tmp/.tp.files.changed for i in $( /tmp/.here.files comm /tmp/.tp.files /tmp/.here.files > /tmp/.tp.files.comm comm -1 -3 /tmp/.tp.files /tmp/.here.files | tee /tmp/.tp.files.new # (find-man "1 comm") # (find-node "(coreutils)comm invocation") # (find-sh "comm -1 -3 /tmp/.tp.files /tmp/.here.files") # Damn, this is broken - some symlink thing. # (find-fline "/tmp/TP/eev-current/" "eeg") # (find-fline "/tmp/HERE/eev-current/" "eeg") # (find-fline "/tmp/.tp.files") # (find-fline "/tmp/.tp.files.changed") # (find-fline "/tmp/.tp.files.comm") # # «compare-produce-o.tgz» (to ".compare-produce-o.tgz") # Produce the o.tgz. # The eekill is because it is usually "uploaded" to gmail. # The second line lists extra files; atm I always adjust it by hand. # Currently (jun2006) I only run this block at sweetjane. # (find-es "sweetjane") cd tar -cvzf /tmp/o.tgz $(cat /tmp/.tp.files.changed) \ ORG/*.org e/oracle.e e/swig.e e/dialog.e TITAN/titanl.c bin/fastcmp.lua laf /tmp/o.tgz # (find-fline "/tmp/o.tgz") # (eekill "/tmp/o.tgz") # ##### # # sync between rumi and angg (and persephone) # 2007apr18 # ##### # «rumi_dl_angg_install» (to ".rumi_dl_angg_install") # At rumi download angg's edrx.tgz and unpack/install it at "~/": #  (eepitch-shell) mkdir /tmp/page/ cd /tmp/page/ wget -O edrx-angg.tgz http://angg.twu.net/edrx.tgz mkdir /tmp/page/angg/ tar -C /tmp/page/angg/ -xvzf /tmp/page/edrx-angg.tgz # # Unpack on ~: tar -C ~ -xvzf /tmp/page/edrx-angg.tgz # «rumi_dl_angg_compare» (to ".rumi_dl_angg_compare") # At rumi download angg's edrx.tgz and compare its files with the ones at ~ # (find-angg "LUA/quickdiff.lua") #  (eepitch-shell) mkdir /tmp/page/ cd /tmp/page/ wget -O edrx-angg.tgz http://angg.twu.net/edrx.tgz mkdir /tmp/page/angg/ tar -C /tmp/page/angg/ -xvzf /tmp/page/edrx-angg.tgz #  (eepitch-shell) makeLedrxtgz cp -v ~/TH/L/edrx.tgz /tmp/page/edrx-rumi.tgz rm -Rv /tmp/page/rumi/ mkdir /tmp/page/rumi/ tar -C /tmp/page/rumi/ -xvzf /tmp/page/edrx-rumi.tgz # # (find-angg "LUA/quickdiff.lua") # # Then: # (find-sh "~/LUA/quickdiff.lua | sort | tee /tmp/page/odiff") # (find-fline "/tmp/page/odiff") # To compare and update files - manually - use this: # (find-efunction 'find-anggrumidiff-links) # «rumi_upl_to_gmail» (to ".rumi_upl_to_gmail") # From rumi prepare a /tmp/rumi.tgz and upload it to gmail. # The list of files in the A=(...) is extracted from # (find-fline "/tmp/page/odiff") # by: # (find-sh "egrep '^(changed:)' /tmp/page/odiff | awk '{print $2}'") # (eekill (find-sh0 "egrep '^(changed:)' /tmp/page/odiff | awk '{print $2}'")) # and the "odiff" file is prepared by the "rumi_dl_angg_compare" block, above. # A=( .emacs TH/rrj4.blogme e/apache.e e/mail.e eev-current/eev-mini-steps.el ) cd tar -cvzf /tmp/rumi.tgz $A svn/adm/ TODO ORG/index.org RUMI/ LOGS/ laf /tmp/rumi.tgz # (find-fline "/tmp/rumi.tgz") # (eekill "/tmp/rumi.tgz") # # «angg_dl_rumi_compare» (to ".angg_dl_rumi_compare") # At persephone, when angg is in sync with persephone, download a # /tmp/rumi.tgz from gmail; this .tgz should contain newer versions of # some files (because I modified them at work - on rumi), and then # compare these newer version with the ones at angg by hand, using # find-anggrumidiff-links on the output of a "find". # # Unpack /tmp/rumi.tgz at angg: #  (eepitch-shell) makeLedrxtgz mkdir /tmp/page/ cp -v ~/TH/L/edrx.tgz /tmp/page/edrx-angg.tgz cp -v /tmp/rumi.tgz /tmp/page/edrx-rumi.tgz mkdir /tmp/page/angg/ tar -C /tmp/page/angg/ -xvzf /tmp/page/edrx-angg.tgz mkdir /tmp/page/rumi/ tar -C /tmp/page/rumi/ -xvzf /tmp/page/edrx-rumi.tgz # (find-sh "cd /tmp/page/rumi/ && find -type f | cut -b 3-")  (eepitch-shell) # Optional: unpack RUMI/ # (find-fline "/tmp/page/edrx-rumi.tgz" "RUMI/") cd tar -tvzf /tmp/page/edrx-rumi.tgz RUMI/ tar -xvzf /tmp/page/edrx-rumi.tgz RUMI/ # (find-fline "~/RUMI/") # (find-blogme3file "rumimake.lua") ##### # # compare angg.twu.net/edrx.tgz with the stuff in ~ (in sweetjane) # 2006jul03 # ##### # I run this in machines that are not persephone to produce a set of # changes that should be applied (by hand, always) at persephone. # More precisely: when I work at a machine that is not my home machine # ("persephone") - for example, when I'm at my machine at work # ("sweetjane") - I do most things that I do when I'm home: I can # change the files that go into edrx.tgz, I can change the list of # those files (at Files.tcl), I can run makeL from time to time to # produce an html version of my page locally, etc; but then the # edrx.tgz produced at sweetjane becomes out-of-sync with the edrx.tgz # from persephone, and there are updates at sweetjane that I would # like to propagated to persephone... # More explanations later. # «compare-tp-and-home» (to ".compare-tp-and-home") # «download-edrx.tgz-and-sync» (to ".download-edrx.tgz-and-sync") # cd /tmp/ wget http://angg.twu.net/edrx.tgz # # Produce: (find-fline "/tmp/.files.changed") # (find-fline "/tmp/.files.changed.e") # (find-fline "/tmp/edrx.tgz") rm -Rv /tmp/tp/ mkdir /tmp/tp/ tar -C /tmp/tp/ -xvzf /tmp/edrx.tgz cd /tmp/tp/ find $('ls' -A) -type f | sort | tee /tmp/.files.tp | \ fastcmp.lua /tmp/tp/ ~/ | tee /tmp/.files.changed | \ gsub.lua '^(.*)$' '# (find-tkdiff "/tmp/tp/" "~/" "%1")' | \ tee /tmp/.files.changed.e # # «upload-o.tgz» (to ".upload-o.tgz") makeLedrxtgz # # Produce: (find-fline "/tmp/.files.new") # Requires: ~/TH/L/edrx.tgz # (eev "makeLedrxtgz") rm -Rv /tmp/here/ mkdir /tmp/here/ tar -xvzf ~/TH/L/edrx.tgz -C /tmp/here/ cd /tmp/here/ && find $('ls' -A) -type f | sort > /tmp/.files.here comm /tmp/.files.tp /tmp/.files.here > /tmp/.files.comm comm -1 -3 /tmp/.files.tp /tmp/.files.here | tee /tmp/.files.here.new # # «add-extras-make-o.tgz» (to ".add-extras-make-o.tgz") # (find-fline "~/ORG/") # (find-fline "~/TITAN/") # (find-fline "~/MEDIADOR/") cd print -l ORG/*.org MEDIADOR/*.{e,sh,svg} \ MEDIADOR/{admin,billing,interface}/ \ TITAN/*.{lua,e,c,h} TITAN/Makefile \ | grep -v _wrap \ | sort | tee /tmp/.files.extra tar -cvzf /tmp/o.tgz $( cat /tmp/.files.changed /tmp/.files.here.new /tmp/.files.extra ) # # Now export the o.tgz, by uploading it to gmail... # (find-fline "/tmp/o.tgz") # (eekill "/tmp/o.tgz") # # «compare-o.tgz-and-home» (to ".compare-o.tgz-and-home") # «download-o.tgz-and-sync» (to ".download-o.tgz-and-sync") # Compare /tmp/o.tgz and the files at ~. # I run this at persephone to sync its files with the ones at sweetjane. rm -Rv /tmp/there/ mkdir /tmp/there/ tar -C /tmp/there/ -xvzf /tmp/o.tgz tar -tzf /tmp/o.tgz | \ gsub.lua '^(.*)$' '# (find-tkdiff "/tmp/there/" "~/" "%1")' | \ tee /tmp/.files.there.e # # (find-fline "/tmp/.files.there.e") ##### # # NOTCL # 2008jan18 # ##### # «NOTCL» (to ".NOTCL") # (find-angg "TH/Makefile" "NOTCL") # (find-angg ".zshrc" "makeL") # (find-blogme3file "anggmake.lua") # (find-THLfile "TH/Makefile") # (find-THLfile "TH/Makefile" "$(TH_HTMLS)") # (find-THLfile "TH/Makefile.auto") # (find-THLfile "TH/Makefile.auto" "TH_HTMLS =")  (eepitch-shell)  (eepitch-kill)  (eepitch-shell) makeLedrxtgz  (eepitch-shell)  (eepitch-kill)  (eepitch-shell) rm -R /tmp/testL/ mkdir /tmp/testL/ cd /tmp/testL/ tar -xzf ~/TH/L/edrx.tgz make -f TH/Makefile NOTCL=1 # file:///tmp/testL/emacs.html ##### # # a quick way to upload my page to zumbi # 2008jan18 # ##### # «quick-upload-to-zumbi» (to ".quick-upload-to-zumbi") # (find-angg ".zshrc" "lstoindexhtml_lua_maybe") # (find-THLfile "blogme3/index.html")  (eepitch-shell)  (eepitch-kill)  (eepitch-shell) makeLedrxtgz cd ~/TH/L/ find -type f | grep index.html rm -v $(find -type f | grep index.html) makeL find . -type d | cut -b3- | sort lstoindexhtml_lua_dirs $(find . -type d | cut -b3- | sort) laf blogme3/index.html tar -cf /tmp/THL.tar .  (eepitch-zumbi)  (eepitch-kill)  (eepitch-zumbi) cd ~/public_html/ mkdir -p ~/public_html/TH/L/ cd ~/public_html/TH/L/ tar -xvf ~/THL.tar # (ee-cp "/tmp/THL.tar" (ee-zumbifile "THL.tar") 'over) # http://zumbi/~edrx/TH/L/ # http://zumbi/~edrx/TH/L/blogme3/ # http://zumbi/~edrx/TH/L/e/sisrot.e.html ##### # # upload my page to angelfire, from twu # 00feb11 # ##### # (find-fline "~/.netrc # (find-fline "edrx@angg.twu.net:.netrc") # at angg: cd grep angelfire ~/.netrc | tee ~/o anonftp angg.twu.net 'put .netrc' 'chmod 600 .netrc' 'quit' # twu stuff: # Run the block below at twu, using "sshtwu |& tee ~/oa" (we tee at # angg, to make the log more accessible). Note that twu has no expect, # and so we can't use my anonftp script. cd ~/public_html/ (echo hash on echo prompt off find * -type d | awk '{print "mkdir ", $1}' find * -type f | sort | awk '{printf "!echo %s :\nput %s %s\n", $1, $1, $1}' ) > ~/o ftp ftp.angelfire.com < ~/o exit ###### # # vcsa2pnm (screenshots of vts; Icon version) # 99sep15 # ###### # «vcsa2pnm_icon» (to ".vcsa2pnm_icon") # (find-fline "~/ICON/vcsa2pnm.icn") cd ~/ICON/ icont -s vcsa2pnm # vcsa2pnm > /tmp/v.pnm vcsa2pnm /home/root/C/math1.8 2 > /tmp/v.pnm display /tmp/v.pnm cd ~/ICON/ icont -s vcsa2pnm ~/ICON/vcsa2pnm /home/root/C/math1.8 2 \ | convert - /tmp/v.png laf /tmp cd /tmp zgv # (find-vldifile "pnmtopng.list") # (find-fline "/usr/doc/pnmtopng/") ###### # # vcsa2pnm (mktclapp version) # 99oct04 # ###### # «vcsa2pnm» (to ".vcsa2pnm") # (find-fline "~/MTA/vtutil.tcl") # (find-fline "~/.emacs") # (find-fline "/etc/inittab" "kbrequest") # (find-fline "~/bin/kbrequest") cd ~/MTA/ vtutil vcsa2pnm /dev/vcsa1 256 8 math1.8 /tmp/1.pnm convert /tmp/1.pnm /tmp/1.png laf /tmp/1* # Timing: cd ~/MTA/ time vtutil vcsa2pnm /dev/vcsa1 256 8 math1.8 /tmp/1.pnm time pnmtopng /tmp/1.pnm > /tmp/1.png time pnmtopng < /tmp/1.pnm > /tmp/1.png time convert /tmp/1.pnm /tmp/1c.png laf /tmp/1* # "convert" is faster and compresses color output better. # 99dec06: but when I tried to use these pngs in netscape I noticed # that it (netscape 4.5) really really really doesn't like the pngs # generated by convert; so, use the one created by pnmtopng for # anything serious. # Old command line (obsolete): # ./vtutil.tcl vcsa2pnm math2.8 8 /dev/vcsa1 /tmp/1.pnm ##### # # Binding Alt-Up to a screen-capture script # 99dec06 # ##### # «capture_screen» (to ".capture_screen") # (find-fline "/etc/inittab" "kbrequest") # (find-fline "~/bin/kbrequest") if [[ -e /tmp/ncaptures ]]; then N=$( /tmp/ncaptures cd /home/root/MTA/ ./vtutil.tcl vcsa2pnm math2.8 8 /dev/vcsa1 /tmp/$N.pnm /usr/X11R6/bin/convert /tmp/$N.pnm /tmp/$N.png rm /tmp/$N.pnm exit ##### # # Condensing forms # ##### # «condensing_forms» # (find-enode "Regexps") # (find-fline "~/TH/search.th") (query-replace-regexp "^