|
Warning: this is a htmlized version!
The original is across this link. |
#######
#
# E-scripts on Perl, Apache and cgis.
#
# 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/a/e/perl.e>
# or at <http://angg.twu.net/e/perl.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/a/.emacs[.html]>,
# <http://angg.twu.net/a/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
#######
#
# opcodes
#
#######
pdsc /debian/main/source/interpreters/perl_5.004.04-6.dsc
cd /usr/src/perl-5.004.04
#
# (find-fline "/usr/src/perl-5.004.04/debian/rules" "-D optimize='-O2' ")
debian/rules binary |& tee odrb
#######
#
# Indexing
#
#######
cd /usr/lib/perl5/
find * -type f | grep -v '\.so$\|\.a$' > .files
#######
#
# promit
#
#######
# (find-fline "~/PERL/promit")
# (setq w3-reuse-buffers 'yes)
# (w3-open-local "/snarf/http/agora.leeds.ac.uk/Perl/start.html")
http://agora.leeds.ac.uk/Perl/start.html
Operações importantes: limpa os espaços,
cd /usr/lib/perl5/
pod2man CGI.pm | groff -Tascii -man | l
echo foobarplic | sed s/o/O/g
echo foobarplic | sed 's/[oa]//g'
# (find-fline "~/PERL/mysed")
#######
#
# CGI.pm
#
#######
# (find-fline "/usr/doc/perl/examples/cgi/")
# (find-pl5file "")
# (find-pl5file "CGI/")
# (find-pl5file "CGI.pm")
# (find-pl5file "CGI.pm" "=head1 DEBUGGING")
# (find-pl5file "CGI.pm" "strong")
# (find-pl5file "CGI.pm" "as_string")
# (find-fline "/etc/apache/")
# (find-fline "/etc/apache/httpd.conf")
# (find-fline "/etc/apache/srm.conf" "/var/www")
# (find-fline "/etc/apache/srm.conf" "AddHandler cgi-script .cgi")
# (find-fline "/usr/doc/perl/examples/cgi/")
# (find-fline "/var/www/perlex/")
rm -Rv /var/www/perlex/
mkdir /var/www/perlex/
cd /var/www/perlex/
cp -iv /usr/doc/perl/examples/cgi/* .
gzip -dv *
perl RunMeFirst
chmod 755 *.cgi
chown edrx:edrx -Rc /var/www/perlex
# (w3-fetch "http://0/perlex/")
lynx http://0.0.0.0/perlex/
# (find-fline "/var/www/perlex/tryit.cgi")
cd /var/www/perlex/
tryit.cgi ''
tryit.cgi name=Edrx%20Foo color=Blue
# (find-pl5podfile "perlfaq4.pod")
# (find-pl5podfile "perlfaq5.pod")
# (find-pl5podfile "perlfaq6.pod")
# (find-pl5podfile "perlfaq7.pod")
# (find-pl5podfile "perlfaq8.pod")
# (find-pl5podfile "perlfaq9.pod" "send/read mail")
dpkg -i ~/HASH/mailtools
# (find-pl5file "Mail/")
# (find-pl5file "Mail/Send.pm")
# (find-pl5file "auto/Mail/")
# (find-fline "~/PERL/m")
use Mail::Internet;
use Mail::Header;
# say which mail host to use
$ENV{SMTPHOSTS} = 'mail.frii.com';
# create headers
$header = new Mail::Header;
$header->add('From', 'gnat@frii.com');
$header->add('Subject', 'Testing');
$header->add('To', 'gnat@frii.com');
# create body
$body = 'This is a test, ignore';
# create mail object
$mail = new Mail::Internet(undef, Header => $header, Body => \[$body]);
# send it
$mail->smtpsend or die;
cd /var/www/perlex/
a2ps -o ~/o.ps -M A4dj -6 -A --highlight-level=none $(
cat index.html |
perl -e 'foreach $li (<STDIN>) {$li =~ s/.*"(.*.cgi)".*/$1/ && print $li;}')
cd
rm o.p[0-9][0-9]
gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH o.ps
rm o.zip; zip o.zip o.p0?
laf o.zip
cat index.html |
perl -e 'foreach $li (<STDIN>) { print $li;}'
# (find-pl5file "CGI.pm")
# (find-pl5file "CGI.pm")
# (find-pl5file "pod/perlmod.pod")
qualified
# (w3-open-local "/usr/doc/HOWTO/html/Java-CGI-HOWTO.html")
#####
#
# dwww
#
#####
# (find-hamm "dwww")
######
#
# Embedding Perl in text
#
######
#!/usr/bin/perl
print "a$BO\n";
print 'b$BO\n';
print 'c', 'foo';
print "\n\n\n";
(defun p ()
(interactive)
(write-region (get-register ?b) (get-register ?e) "~/PERL/p")
(set-file-modes "~/PERL/p" 511))
#!/usr/bin/perl
$_ = "foo_bar";
print "Ok\n" if /.*foo.*/;
print /.*o\(.*a\).*/;
print "hello", "\n";
print ($a = [1, 2, 3]), "\n";
# (find-fline "~/PERL/tut0")
#!/usr/bin/perl
# (set-file-modes (buffer-file-name) 511)
######
#
# Docs
#
######
/snarf/ftp/agora.leeds.ac.uk/scs/doc/whole-perl-tutorial.readme
/snarf/http/www.eecs.nwu.edu/perl/perl.html
(find-fline "~/ZHTML/texps.ht")
(find-fline "/snarf/ftp/agora.leeds.ac.uk/scs/doc/whole-perl-tutorial.txt.gz")
(find-fline "/usr/doc/perl/examples")
(find-fline "/usr/doc/perl/examples/cgi/")
#######
#
# PROMIT
#
#######
Enrique,
Temos um pepino no PROMIT que eu gostaria de dar uma força e pensei se
o Zico não podia tentar resolver esta. Vê o que você acha.
Quem quer se associar ao PROMIT precisa se candidatar e enviar 3 URLs
com trabalhos desenvolvidos. Uma comissão vai analisar o trabalho do
sujeito e dar notas que vão reprovar ou aprovar a associação.
A coisa funcionaria da seguinte forma:
Estariam nomeados até três pessoas de cada área (comunicação,
tecnologia e design). Numa página teríamos os links para o trabalho do
sujeito e um pulldown com notas de 1 até 10. Os jurados teriam o
compromisso de visitar esta página constantemente (sugiro colocar como
home do browser) O primeiro de cada área que aparecer para olhar dá
sua nota. Com uma nota de cada área faz-se a média final. Com a média
final temos a aprovação ou reprovação do candidato. Candidatos que
receberem qualquer nota inferior a 2 são eliminados. Candidatos com
média >= 6 são aprovados.
Minha idéia é ter uma página dinâmica que inclui os novos candidatos e
suas URLs. Do lado tem espaço para notas nas três categorias. No
final, o sistema faz a média e aprovando, manda um e-mail para o
camarada. Reprovando, a diretoria vai ter que entrar em contato e
conversar...
candidato->curl1,curl2,curl3
Comandos possíveis (módulo correções): cr - um candidato se registra,
já dando as suas três urls. Logo antes dele confirmar o registro ele
ganha uma página de onde ele pode visitar as suas três urls e apertar
o botão vermelho que faz o registro mesmo. jr - juiz registra - ele
ganha um número de registro e uma lista de urls esperando julgamento.
Pode haver algum sistema de locking em que uma página é marcada como
"em julgamento"; os juízes podem pôr comentários a qualquer momento.
jnv - o juiz número tal vota a nota tanto para a página tal. Só a
primeira nota conta, as outras são só guardadas (notas e comentários
são guardados junto com a hora em que aconteceram).
A história do sistema é uma série de linhas tipo
h1 c1r u1a u1b u1c - na hora 1 o candidato 1 registrou as urls
u1a, u1b, u1c
h2 j1r - na hora 2 o juiz 1 se registra (e ganha seu
número)
h3 j1 a1.u1b - na hora 3 o juiz 1 põe o aviso 1 na url u1b
h4 c2r u2a u2b u2c - na hora 4 o candidato 2 se registra
h5 j1 v1.u1b - na hora 5 o juiz 1 põe a nota v1 na url u1b
#######
#
# a2ps on some docs
#
#######
l ~/TCL/spawn-send-expect-interact
a2ps -8 -M A4dj -o ~/o.ps /usr/lib/perl5/CGI.pm
rm ~/o.p[0-9][0-9]
cd
gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH o.ps
rm o.zip; zip o.zip o.p0{1,2,3,4,5,6,7}
rm o.zip; zip o.zip o.p{0{8,9},1{0,1}}
# (find-node "(a2ps)Top")
# (find-node "(a2ps)Sheets Options")
# (find-fline "/usr/share/a2ps/sheets/")
# (find-fline "/usr/share/a2ps/sheets/perl.ssh")
#######
#
#
#
#######
cd /usr/lib/perl5/
etags $(find * -name '*.p[ml]')
# (code-c-d "pl5" "/usr/lib/perl5/")
# (find-pl5file "CGI.pm")
# (find-enode "Programs")
# (find-enode "Font Lock")
# (global-font-lock-mode t)
# (list-faces-display)
# (find-pl5file "i386-linux/5.004/DynaLoader.pm")
# (find-pl5file "i386-linux/5.004/auto/DynaLoader/")
# (find-pl5file "pod/perlxs.pod")
# (find-pl5file "pod/perlxstut.pod")
######
#
# perl-tk
#
######
# (find-fline "/usr/doc/perl-tk/")
# (find-fline "/usr/lib/perl5/Tk/")
# (code-c-d "ptk" "/usr/src/perl-tk-400.202/")
# (find-ptkfile "Manifest")
# (find-ptkfile "")
debsource /debian/main/source/interpreters perl-tk 400.202 -9
cd /usr/src/perl-tk-400.202/
cd /usr/src/perl-tk-400.202/demos/
widget
#####
#
# Sending MIME'd mail with MIME::Lite (and zsh)
#
#####
# «mimelite_zsh1»
# Old version:
function mailfile () {
TO=$1 FILE=$2 perl -e '
use lib "$ENV{HOME}/PERL/";
use MIME::Lite;
$msg = new MIME::Lite
# From => $ENV{"FROM"},
To => $ENV{"TO"},
Subject => $ENV{"FILE"},
Data => "";
attach $msg
Encoding => "base64",
Type => "BINARY",
Path => $ENV{"FILE"},
Filename => $ENV{"FILE"};
if (open SENDMAIL, "|/usr/sbin/sendmail -t -oi -oem") {
$msg->print(\*SENDMAIL);
close SENDMAIL;
} else {
print "Erro interno no sendmail: !=$!, ?=$?.\n";
}'
}
# Demo:
cd ~/GIMP/; mailfile edrx tmp.jpg
# «mimelite_zsh2»
# New version:
# Note that I'm using "su -s /usr/sbin/sendmail edrx --" instead of
# simply "/usr/sbin/sendmail".
function email_mimelite () {
perl -e 'use lib "$ENV{HOME}/PERL/"; use MIME::Lite;
'$1'
if (open SENDMAIL, "|su -s /usr/sbin/sendmail edrx -- -t -oi -oem") {
$msg->print(\*SENDMAIL); close SENDMAIL;
} else { print "Erro interno no sendmail: !=$!, ?=$?.\n";
}'
}
function email850 () {
850toiso | TO=$1 SUBJ=$2 email_mimelite '
undef $/;
$msg = new MIME::Lite
To => $ENV{"TO"},
Subject => $ENV{"SUBJ"},
Encoding => "quoted-printable",
Data => <>;'
}
function emailfile () {
TO=$1 FILE=$2 email_mimelite '
$msg = new MIME::Lite
To => $ENV{"TO"},
Subject => $ENV{"FILE"},
Data => "";
attach $msg
Encoding => "base64",
Type => "BINARY",
Path => $ENV{"FILE"},
Filename => $ENV{"FILE"};'
}
# Demos:
email850 edrx 'no subject' < ~/PERSONAL/99jun24
cd ~/GIMP/; emailfile edrx tmp.jpg
#####
#
# CPAN
# 99nov27
#
#####
# (find-fline "~/ICON/lslR2find.icn")
# (find-fline "$SDEBIAN/ls-lR")
# (find-fline "$SDEBIAN/ls-lR.i")
# (find-fline "$SCPAN/ls-lR")
# (find-fline "$SCPAN/ls-lR.i")
psne $FCPAN/ls-lR.gz
cd $SCPAN
gzip -dv ls-lR.gz
cd $SCPAN
~/ICON/lslR2find2 25 33 47 < ls-lR > ls-lR.i
psne $FCPAN/authors/id/LDS/CGI.pm-2.56.tar.gz
cd $SCPAN
~/ICON/lslR2find 2 -10 < ls-lR |& l -S
~/ICON/lslR2find 1 -10 < ls-lR |& l -S
~/ICON/lslR2find 0 -10 < ls-lR |& l -S
~/ICON/lslR2find 0 -8 < ls-lR |& l -S
cd $SCPAN
~/ICON/lslR2find2 25 33 46 < ls-lR |& l -S
~/ICON/lslR2find2 26 33 47 < ls-lR |& l -S
~/ICON/lslR2find2 27 34 48 < ls-lR |& l -S