Peanuts: small software projects
The tool was created originally to check, if the current date is at weekend, a public holiday, my holiday or a working day. Depending on that in the past I controlled the intervals to check my mail box. This was in the ancient times, where no internet flatrates existed and a mail box had a size of some MB. I mean, the program is very very old ;-) My problem were the variable public holidays like eastern. I found the Date::Pcalc perl module, that can calculate such dates and much more. My resulting perl script check_day.pl displays information for a specific day, create a calendar as xml file, ... check_day.pl -h displays a list of possible options.
Extract the tar archive check_date.tgz:
tar xvzf check_date.tgzWhen done, you should copy the file check_day.pl into a directory contained in the PATH environment variable, e. g.
If the location of the jtXml.pm module is not in the path mentioned above, you have to change the use lib "/usr/local/lib"; pragma (line 11) in check_day.pl.
The Date::Pcalc perl module must be installed to use the program. You can get it from CPAN.
The script is ancient. I want to redesign it - for instance to use a standard xml parser / writer instead of my very simple (regex based) own parser, to generate a html output, to add documentation and a normal installation routine.
The script searches for symbolic links of which the destination not exists or which a ininite loops (a link is directed to himself directly or over some hops). The script can't handle some characters in pathnames (newline or pipe sign, ...).
This - is - the - house - of - San - ta - Claus
It was a boring evening in a hotel, christmas was near and I think, I had had some cups of mulled wine, when the "Santa Claus house" drifted into my mind. Do you know the game? You have to paint the house in one move, without drawing a line more than once. Below you can see the house as ascii art:
A / \ / \ B-----C |\ /| | \ / | | X | | / \ | |/ \| D-----E
I was wondering, how many different possibilities exist to draw it. It's a simple variant of the postman problem:
Walk to the streets without missing a house and without going through a street twice or more.
Here you can see the result of my "brainstorming". It's a little C program, which shows the possibilities as a route: D -> C -> B -> A -> C -> E -> D -> B -> E. No, I don't give away the value ;-) Try it!
The program almost completely uses dynamically allocated data structures and chained lists. The route check is done
by a recursively working function. By the way: If you want to know, how many ways there are:
nikohaus | wc -l.
The archive contains only the source. To compile it:
gcc -o nikohaus nikohaus.cor simply
make nikohausI tested the program on Linux 2.2.14 (gcc 2.95.2), Linux 2.4.18 (gcc 2.95.3), Reliant Unix 5.43 and W2K (VC++ 6.0, create a simple console project).
I created the scripts described below because of a request of a teacher. He wanted to automatically generate users on a linux machine using a file, which contained a list of pupils. All scripts are tested on the distributions SuSE 8.0 and Debian 3.0. The makepasswd command is used to generate the passwords. It is (or was, when I created the scripts) part of the pwgen package for SuSE and of the makepasswd package for Debian.
The file README.txt is part of the users.tgz (only in german).
There you can find detailed information on how to use the scripts. If you are unsure, please contact me.
add_users.sh: Create users using a file containing surnames and family names. The user login names are generated from the name parts, a random password is created.
del_users.sh: Delete users or groups of users.
new_passwd.sh: Create a new random password for the given list of users.
move_users.sh: Moves users to another group (to move classes to a new grade at the end of a school year).
Extract the archive in a directory of your decision:
tar xvzf users.tgzIn the subdirectory user_scripts you will find the README.txt file and the scripts.
The script is a result of a thread in a linux mailing list. The final version was - not the first time - the result
of a fruitful discussion (in this case especially with David Haller). The original question was: How to delete
seamless line feeds from text files, which were created by other programs:
"This short sentence is a very st
The next request: How to avoid to delete text block delimiters (emtpy lines). And at last: Store the result in the original file.
The zende.sh uses the loop shown in Quickies. The result is stored in a temporary file, which is moved to the original file at the end of the script.