Some useful programs for download
These are some of my programs, mostly shell scripts.Disclaimer: These programs are in the public domain (with the exception of dbtool and timon which are distributed under the GPL2 GNU Public Licence). All others may be freely copied, distributed and changed. However, no guarantee is given that they are useful for any purpose or that they will run on any particular machine without damaging hard- and software. Enjoy at your own risk!
- ASCII-file to TeX Converter
- Extract UU-encoded files from Mail & News
- Position of the Sun (low precision)
- Delay and Date Calculation with Shell Scripts
- Calculate relative humidity from temperature and dewpoint
- Calculate dewpoint from temperature and relative humidity
- Show nesting level of braces in a TeX file
- dbtool User frontend for the MySQL database
- timon time accounting and invoicing system
- Script for transscription of Mommsen's Roman History to TeX
- Computing sequences of the Collatz Conjecture
ASCII-file to TeX Converter
Program name: totexThis is a bash Shell-Script running under Linux and eventually some other flavours of Un*x (untested). It makes use of the sed stream editor which should be part of user's system.
totex tries to figure out how to format a plain ascii-file in a way
to make it look nice when subsequently processed with TeX. It is intended to
process a wide variety of texts the user could download from the internet.
The problem is to find titles, alineas and paragraphs. The script probably
needs some editing to reflect personal preferences. Don't forget to set the
downloaded file to executable:
chmod a+x totex
Usage: totex [-t] filename
where the option [-t] will call TeX after conversion.
Download totex and report any stories of success or failure to thomas@spahni.ch.
Extract UU-encoded files from Mail & News
Program name: uuesplitAnother Shell-Script for bash/Linux. When you have saved a couple of UU-encoded files to a news od mail folder, then this file must be split before uudecode can be run. This script will do exctly this, using a brute force approach (not very fast on *big* files).
Usage: uuesplit filename-of-folder
Download uuesplit and report any stories of success or failure to thomas@spahni.ch.
Calculate Position of the Sun
Program name: sunposThe program calculates the apparent position of the sun for a given local position of the observer. Besides azimuth and elevation, data for right ascension, declination and ecliptic longitude are given as well. Nutation data display can be enabled.
The scope of this program is to provide an easy determination of the relative solar position for photographers, pilots, environmentalists and others. Accuracy is within 2 - 3 seconds of time. For a determination of sunrise / sunset the effects of atmospheric refraction must be taken into account. If high accuracy is desired then more advanced methods of computation should be used.
The program is written in "C" and must be compiled on the users machine. It was tested under Linux/gcc and contains very few machine specific code. The code contains a 'Makefile' appended as a comment. This Makefile can be extracted after downloading and be saved as a separate file using your editor.
Usage: sunpos
Download sunpos.c and report any stories of success or failure to thomas@spahni.ch.
Delay and Date Calculation with Shell Scripts
Program Names: jd, dow, dt, delay, easterThis is a package of 5 shell scripts to handle delay and date calculation easily from the command line. They should run on any Linux/UN*X system with a "bash" or original "Bourne Shell".
These programs do:
- jd Convert any date given on the command line or on standard input to the corresponding Julian Day number. This is a continuous count of days starting at the beginning of the year -4712. The script will not work for negative Julian Day numbers.
- dow Calculate the day of the week from any given input (date or Julian Day number) and print to standard output.
- dt This is the conversion of the Julian Day number back to a date. Output is in the order "day month year" (those in the new world will have to hack the script slightly to change this order).
- delay is an application making use of jd, dow and dt. If given two different dates like 'delay 15 3 -44 4 10 1957' the script will reveal that there are 731055 days between Cesar's death and the launch of Sputnik 1. Alternatively an input like 'delay 4 10 1957 1000' will show that 1000 days after the launch of Sputnik 1 was Thursday 30 6 1960.
- easter calculates the day of easter within the Gregorian Calendar (i.e. after the year 1582).
All five shell scripts can be downloaded by clicking the following links, but don't forget to set the downloaded file to executable like "chmod a+x jd".
Download jd,
dow,
dt,
delay and
easter
and report any stories of success or failure to
thomas@spahni.ch.
Calculate relative humidity
Program name: relhumidityThis is an example how to use the bc calculator in a shell script. The program calculates relative humidity from temperature and dewpoint.
View the code relhumidity.html or download relhumidity and report any stories of success or failure to thomas@spahni.ch.
Calculate dewpoint
Program name: dewpointThis is an example how to use the bc calculator in a shell script. The program calculates dewpoint from temperature and relative humidity.
View the code dewpoint.html or download dewpoint and report any stories of success or failure to thomas@spahni.ch.
Show nesting level of braces in a TeX file
Program name: nestingShow the contents of the input file on STDOUT, each line preceded by a number indicating the nesting level of braces '{}' valid at the end of the respective line.
TeX syntax is used. Braces in comments are not taken into account.
Download the source package with a right click on nesting-1.0.tar.bz2.
Text based user frontend for the MySQL database
Program name: dbtooldbtool is basically a shell script for interactive access to MySQL. Menus are presented in nice windows thanks to the dialog utility. A patched version of dialog-0.6z supporting some basic editing functions is included in the package. It should still be compatible with the original version but not with newer versions of dialog.
- dbtool-0.9.23.lsm (1K)
- dbtool-0.9.23.tar.gz (196K)
Time accounting and invoicing system
Program name: timontimon is a shell script making use of the MySQL database. timon means Time Is MONey. Time and expenses spent on projects for various clients may be stored and detailed invoicing is generated from the data.
This code is still alpha, but it's actively maintained and works pretty well. Expect new versions frequently. You need MySQL 4.0.6 or better and the TeTeX package to run 'timon'. Some basic knowledge of TeX is required to design your own letterheads for invoicing.
- timon-0.2.2.tar.gz (246K)
Mommsen: Römische Geschichte (transcription from HTML to TeX)
Program name: mommsen.shTheodor Mommsen's famous work "Römische Geschichte" (Roman History) has been made publicly available in HTML format at Project Gutenberg. A similar version is available at www.zeno.org. My script will convert the sources from Project Gutenberg into TeX language for typesetting and printing. It makes extensive use of the sed editor and regular expressions.
- Shell script, text source and graphics complete (70017 KBytes)
- Shell script mommsen.sh (14887 Bytes)
Calculating sequences of the Collatz Conjecture
Program name: collatz.c
Lothar Collatz suggested in 1937 that the following
repeated operation on any arbitrary positive integer N:
— If the number is even, divide it by two (N = N/2)
— If the number is odd, triple it and add one (N = N*3 + 1)
will eventually transform N to 1. Starting from 1 is an infinite loop 1 - 4 - 2 - 1.
David Barina verified that all numbers N below 270
converge to 1 (see his list).
The Collatz conjecture is one of the most famous unsolved problems in mathematics. However, it's fun to play with it. You can search for regularities and irregularities or for values of N with a high number of steps required to reach 1. Some other vales of N have a high maximum trajectory point (= highest value of N reached during the sequence). Eric Rosendaal published a list of records.
Examples: | ||
N=27 | STEPS=111 | MAX=9232 |
N=9016346070511 | STEPS=886 | MAX=252229527183443335194424192 |
N=14022512981985 | STEPS=1569 | MAX=79988992024030705960 |
The program is written in "C" and must be compiled on the users machine. It links to the GNU Multiple Precision Arithmetic Library (GMP) and is capable of dealing with quite large values of N. A sample logfile for N=2 to N=1000000000000 is included.
Download collatz-1.0.6.tar.xz, compile, have fun, and let me know of any faster or better versions you created from it.
Back to the Top
Back to my Homepage