Archive for September 2009

python’s HTTP server

Python comes with an HTTP server built in, making sharing directories on your *nix machines as easy as:

anton@opensolaris:~/mess/test$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 …
localhost – - [26/Sep/2009 00:23:47] “GET / HTTP/1.0″ 200 -
localhost – - [26/Sep/2009 00:24:24] “GET / HTTP/1.1″ 200 -

So now when we go to localhost:8000 , we get the directory!:

anton@opensolaris:~/mess$ lynx -dump localhost:8000
Directory listing for /
__________________________________________________________________

* [1]lalala
__________________________________________________________________

References

1. http://localhost:8000/lalala

…or…

anton@opensolaris:~$ lynx -source localhost:8000
<title>Directory listing for /</title>
<h2>Directory listing for /</h2>
<hr>
<ul>
<li><a href=”lalala”>lalala</a>
</ul>
<hr>

…for those of you that want to see the source it produced! A very quick short term solution if you don’t want to go about setting up apache or change your apache settings!

Indexing your man pages

Its not as boring as you think, but you’ll HAVE to do it when you don’t have a windex file and want to search using man -k :

anton@opensolaris:/$ man -k grub
/usr/share/man/windex: No such file or directory

To get round this, we simply go ahead and create the index with catman:

anton@opensolaris:/$ pfexec time catman -w

real        2.9
user        1.8
sys         0.1

Its pretty quick, and you get left with a little index in /usr/share/man/windex. Its just an ascii version of all the names of your manpages, plus a one line summary of what each one does:

1        1 (3openssl)    - OpenSSL configuration functions
1        1 (3openssl)    - OpenSSL configuration functions
1394        ieee1394 (7d)    - Solaris IEEE-1394 Architecture
2        2 (3openssl)    - \& OpenSSL configuration cleanup functions
2        2 (3openssl)    - \& OpenSSL configuration cleanup functions
2        2 (3openssl)    - \& OpenSSL configuration cleanup functions
2.1        EasyTAG (1)    - Tag editor for MP3 and Ogg Vorbis files
2_F32_Sat    mlib_SignalConvertShift_U8_S8_Sat (3mlib)   – data type convert
with shifting
5.0        MySQL (1)    - MySQL RDBMS version 5.0 for Solaris
6to4        tun (7m)    - tunneling STREAMS module
6to4relay    6to4relay (1m)    - administer configuration for 6to4 relay router
communication
6to4tun     tun (7m)    - tunneling STREAMS module
7-Zip        7-Zip (1)    - A file archiver with highest compression ratio

So now when you do your man -k , you’ll get something useful!:

anton@opensolaris:/$ man -k grub
bootadm     bootadm (1m)    - manage bootability of GRUB-enabled operating system
grub        grub (5)    - GRand Unified Bootloader software on Solaris
installgrub    installgrub (1m)    – install GRUB in a disk partition or a floppy

Crucially you only want to do catman -w , otherwise you’ll be reformatting all your manpages!

From the man page of catman:

-w                  Only create the windex database that  is
used  by whatis(1) and the man(1) -f and
-k options.  No manual  reformatting  is
done.