|
Warning: this is a htmlized version!
The original is across this link. |
#######
#
# E-scripts sobre as contas da minha família.
#
# 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/contas.e>
# or at <http://angg.twu.net/e/contas.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/>.
#
#######
# (find-fline "~/orcamento")
# (find-esfile "localnet.e")
cd /boot/angg/
insmod 8390.o
insmod ne.o
ifconfig eth0 10.0.0.1
route add -net 10.0.0.0
cd /boot/angg/
insmod nfs.o
/etc/init.d/nfs-server start
cd /boot/angg/
insmod smbfs.o
smbmount //smilochs/c /smilc -I 10.0.0.2 -n
smbmount //smilochs/d /smild -I 10.0.0.2 -n
tr -d \\r < /smilc/edrx/oe.txt | tr \\t ° > /tmp/oe
# (find-fline "/tmp/oe")
proc unexcel {str dest} {
set str [string trim $str]
regsub -all {\.} $str "" str ;# 1.234,00 -> 1234,00
if [regexp {^\((.*)\)$} $str {} middle] { ;# (200) -> -200
set str -$middle
}
regsub -all "," $str "." str ;# 1234,00 -> 1234.00
if [regexp -- {-?[0-9]+(\.[0-9]+)?} $str] { ;# looks like a number?
upvar $dest x; set x $str; return 1 ;# set dest to it, return 1
} else {
return 0 ;# else return 0
}
}
proc adjlens {lens list} {
foreach str $list len $lens {
if {$len=="" || $len<[string length $str]} {
set len [string length $str]
}
lappend newlens $len
}
return $newlens
}
set lens {}
set lines [split [exec cat /tmp/oe] "\n"]
set lines2 {}
foreach line $lines {
set fields {}
foreach field [split $line "°"] {
lappend fields [string trim $field]
}
set lens [adjlens $lens $fields]
lappend lines2 $fields
}
puts $lens
foreach line2 $lines2 {puts $line2}
foreach line $lines
(+ 8 29 7 5 11 10 10 20 5 8 10 6)