2005/10/01

VNC tools mainframe-like terminals

What about buying a 50 bugs Pentium-I used computers(32 Mb RAM, 1Gb HD), and using the last Fedora Core 4 release, or Sarge? You can do that with linux VNCServer. VNC, on linux has the ability of creating desktop environments for each client. Here is an example with FC4.

1. Install vncserver on linux server. Install vncviewer from RealVNC on clients. You need 128Mb RAM on server for each client.
2. Create client entries like the line examples on /etc/sysconfig/vncserver

VNCSERVERS="1:rodolfoap"
VNCSERVERARGS[1]="-geometry 800x600"

3. su as each user. Run vncserver. It will create the ~/.vnc structure.
4. Edit ~/.vnc/xstartup:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
exec gnome-session &

5. Check your firewall rules! Start service. Connect from clients to SERVER_IP:5901 (each client is enumerated from 5901).

This method allows you to have a lot of clients working on his own homes. Startup scripts, allowable programs, quotas. But thats a KDE or GNOME issue.

2005/09/09

Documentation-time logic

Document! But do not take this task as an addition to developing. Here is an example of an integrated way of developing and socumenting at the same time.

The example shows a script which includes its own documentation. With simple tools, we generate man documentation from its output.

First of all, you need this formatted output: --version and --help. This example applies the "fortunes" script written in a previous post.

[rodolfoap] /home/rodolfoap > fortunes --version
GNU fortunes v0.1

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by Rodolfo Alcazar <rodolfoap@hotmail.com>
[rodolfoap] /home/rodolfoap > fortunes --help
GNU fortunes is a personal fortunes engine organizer, written in bash.

Usage: fortunes [OPTION]

Options:
-e edit fortunes file
-l enters learning mode
-m enters multiline-learning mode
--help shows this help
--version shows version

Examples:

fortunes --help shows this help
fortunes -e edits fortunes file
fortunes generates a random fortune
fortunes -l starts learning mode

Report bugs to rodolfoap@hotmail.com

Start documentation process:

[rodolfoap] /home/rodolfoap > help2man fortunes|gzip -f>fortunes.1.gz

User just access the man page. In this case, the man page is not stored in its proper location.

[rodolfoap] /home/rodolfoap > man ./fortunes.1.gz

2005/08/07

Linux power tools and classic formats

This is an interesting one. I had a 200-pages book, and need a 50-page book, with 4 little pages on each page. So I based this script on psdim, one of a thousand linux power tools:
#bin/bash
IMAGES=4
echo Must have installed psdim!
echo Converting...
gs -dBATCH -dNOPAUSE -sDEVICE=pswrite -sOutputFile=$1.tmp.ps $1
echo PSDIM output --------------------
psdim -$IMAGES $1.tmp.ps
echo PSDIM output end ----------------
pstops $(psdim -$IMAGES $1.tmp.ps) $1.tmp.ps $1.tm2.ps
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$1.tiled.pdf $1.tm2.ps
rm $1.tmp.ps $1.tm2.ps
rename .pdf.tiled.pdf .tiled.pdf $1.tiled.pdf
echo Done!

You just need to start exploring GNU power tools now!