Soup To Nuts - Repository of Open Source Articles and Example Code  


This site is a collection of scripts, hints, articles, and programs. Reference my notes page for ideas that I am currently working on or sites that I am looking at for ideas. If you have an article or an idea for an article, please send it along. My goal is to help the community any way that I can; but, learn as I go too.


MSSQL 2005 Tips Simple and complete examples for performing common tasks with Microsoft SQL Server 2005.

Performance Monitoring on Linux Demonstrated examples using oprofile, IOzone, vmstat, smartmontools, and the ps command are covered in this tutorial. This work-in-progress covers profiling the kernel, generating stress tests, examining memory swapping, querying the number of hours your drive has been spinning plus getting the current, maximum and minimum temperatures.

Postfix 2nd Instance for Sender-based Routing: Multiple Gmail and Comcast Accounts. Configure your home system to support several Gmail accounts, and additionally, Comcast and or other ISP accounts that require individual authentication rules based on the sending address. This tutorial walks you through configuring a second instance of Postfix, on a second IP address (same NIC), with sender-based routing.

Linux Quota Tutorial This tutorial walks you through implementing disk quotas for both users and groups on Linux, using a virtual filesystem, which is a filesystem created from a disk file. Since quotas work on a per-filesystem basis, this is a way to implement quotas on a sub-section, or even multiple subsections of your drive, without reformatting. This tutorial also covers quotactl, or quota's C interface, by way of an example program that can store disk usage in a SQLite database for monitoring data usage over time.

Gmail on Home Linux Box using Postfix and Fetchmail If you have a Gmail account and would like to use it in conjunction with your personal computers, this tutorial will walk you through configuring and installing the latest version of Postfix with SASL authentication and TLS encryption necessary for connecting and relaying mail to and configuring fetchmail with STARTTLS to fetch messages from your Gmail account to your local system. It will also discuss how to forward mail to other computers and how to automatically backup copies of email messages.

Breaking Firewalls with OpenSSH and PuTTY If the system administrator deliberately filters out all traffic except port 22 (ssh), to a single server, it is very likely that you can still gain access other computers behind the firewall. This article shows how remote Linux and Windows users can gain access to firewalled samba, mail, and http servers. In essence, it shows how openSSH and PuTTY can be used as a VPN solution for your home or workplace.

Create your own custom Live Linux CD These steps will show you how to create a functioning Linux system, with the latest 2.6 kernel compiled from source, and how to integrate the BusyBox utilities including the installation of DHCP. Plus, how to compile in the OpenSSH package on this CD based system. On system boot-up a filesystem will be created and the contents from the CD will be uncompressed and completely loaded into RAM -- the CD could be removed at this point for boot-up on a second computer. The remaining functioning system will have full ssh capabilities. You can take over any PC assuming, of course, you have configured the kernel with the appropriate drivers and the PC can boot from a CD.

SQLite Tutorial This article explores the power and simplicity of sqlite3, first by starting with common commands and triggers, then the attach statement with the union operation is introduced in a way that allows multiple tables, in separate databases, to be combined as one virtual table, without the overhead of copying or moving data. Next, the simple sign function and the amazingly powerful trick of using this function in SQL select statements to solve complex queries with a single pass through the data is demonstrated, after making a brief mathematical case for how the sign function defines the absolute value and IF conditions.

Lemon Parser Tutorial Lemon is a compact, thread safe, well-tested parser generator written by D. Richard Hipp. Using a parser generator, along with a scanner like flex, can be advantageous because there is less code to write. You just write the grammar for the parser. This article is an introduction to the Lemon Parser, complete with examples.

NTP, UTC, and Working with Time on Linux This article defines what is meant by UTC, shows you how to use the date command to calculate the date for any timezone including with or without dst. Plus you will see how to setup and confirm that NTP is working. There is also a program to calculate sunrise and sunset given longitude and latitude in degrees.

(Linux Tips.txt, Linux Tips.html) There are over 200 Linux tips and tricks from using encryption, tar, cpio, setting up multiple IP addresses on one NIC, tips for using man, putting jobs into the background, using shred, watch who is doing what on your system, listing system settings, IPC status, how to make a file immutable so that even root cannot delete, ssh key pair generation, keeping 12 months of backups in the system logs, low level tap commands (mt), mount an ISO image as a filesystem, getting information on the hard drive, setting up cron jobs, look command, getting a bigger word dictionary, find out if a command is aliased, ASCII codes, using elinks, screen commands, FTP auto-login, Bash brace expansion, Bash string operators, for loops in Bash, diff and patch, script, change library path (ldconfig), monitor file usage, --parents option in commands, advance usage of the find command, cat tricks, guard against SYN flood attacks and ping, special shell variables, RPM usage, finding IP and MAC address, DOS to UNIX conversion, PHP as command line scripting language, Gnuplot, POVRAY and making animated GIFs, plus a lot more.

Virtual Filesystem: Building a Linux Filesystem from an Ordinary File You can take a disk file, format it as ext2, ext3, or reiser filesystem and then mount it, just like a physical drive. Yes, it then possible to read and write files to this newly mounted device. You can also copy the complete filesystem, since it is just a file, to another computer. If security is an issue, read on. This article will show you how to encrypt the filesystem, and mount it with ACL (Access Control Lists), which give you rights beyond the traditional read (r) write (w) and execute (x) for the 3 user groups file, owner and other.

How to Compile 2.6 kernel for RedHat 9 and 8.0 and get Fedora Updates Upgrading Redhat 9 or 8.0 to the 2.6.x kernel. This is a step by step approach on how to compile the kernel from source, then, get yum updates for all your other packages. There is also information and examples on writing a 2.6 kernel module.

MySQL Tips and Tricks Find out who is doing what in MySQL and how to kill the process, create binary log files, connect, create and select with Perl and Java, remove duplicates in a table with the index command, rollback and how to apply, merging several tables into one, updating foreign keys, monitor port 3306 with the tcpdump command, creating a C API, complex selects, and much more.

Comcast Email on Home Linux Box using Sendmail Suppose you have accounts on your home Linux system that differ from the name of your email accounts from your ISP. For instance, my email account (from comcast) is mchirico but the account I have on my Linux box is chirico. What I wanted to do, is use the local chirico account to get, create, send, email automatically as This article will show you how to do that.

Working with Time on Linux We still tell time by the sun. Yes, it is possible to go back in time. Want to know how to check for intelligent alien life? Look for a precise time signal



"UNIX Network Programming, The Sockets Networking API", Volume 1, Third Edition.
     W. Richard Stevens, Bill Fenner, Andrew M. Rudoff.

"UNIX Network Programming, Interprocess Communications", Volume 2, Second Edition.
     W. Richard Stevens.

"UNIX SYSTEMS Programming, Communication, Concurrency, and Threads", Kay A. Robbins,
      Steven Robbins

"Programming with POSIX Threads", David R. Butenhof. Addison-Wesley

"The C++ Programming Language" Third Edition. Bjarne Stroustrup. Addison-Wesley.

"C Programming Language" (2nd Edition), Second Edition, Kernighan and Ritchie

"Advanced Linux Programming", Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of
      CodeSourcery LL. This book if free at the following resource:

"Accelerated C++, Practical Programming by Example", Andrew Koenig, Barbara E. Moo.

"C: A Reference Manual", Fifth Edition, Samuel P. Harbison, Guy L. Steele.

"C++ Standard Library: A Tutorial and Reference, The", Nicolai M. Josuttis. Addison Wesley.

"C++ Templates: The Complete Guide", David Vandevoorde, Nicolai M. Josuttis. Addison Wesley.

"Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions", Herb Sutter.
      Addison Wesley.

"More Exceptional C++", Herb Sutter.
      Addison Wesley.

"The Art of Computer Programming (TAOCP)", Vol 1,Vol 2, Vol 3. Donald E. Knuth. Addison-Wesley.

"Programming Perl, 3rd Edition", Tom Christiansen, Jon Orwant, Larry Wall. O'Reilly.

"Programming from the Ground Up", Jonathan Bartlett, Edited by Dominick Bruno, Jr.

"Expert C Programming", Peter van der Linden, Prentice Hall PTR.


"Zen and the Art of Motorcycle Maintenance: An Inquiry into Values", Robert Pirsig.

"Lila: An Inquiry Into Morals", Robert Pirsig.


"Structure and Interpretation of Computer Programs", Harold Abelson, Gerald Jay Sussman,
      Julie Sussman. This book is free:


Berkeleydb examples , these are simple examples on how C API to berkeleydb. Show below is some of the the code in action. A database test.db is create and records are added. When you want to extract the data, run the dump command.

$ ./add test.db "one two three"
    Record 1

$ ./add test.db "A bit more data"
    Record 2

$ ./dump test.db
   1| one two three
   2| A bit more data

Simple but common C programs , is a colection of C programs like open.c, a simple program for opening a file with a file descriptor; getline.c a program to get a line at a time which can be compared to read.c or readrealloc.c which demonstrates a realloc call. In this package, you will find and getopt.c. Plus, want an example of simple debugging with assert statement, then, take a look at

Simple but Common C++ programs is a collection of C++ programs, and includes such programs as, which demonstrates a copy_if and the transform statement to delete pointers in a container, a custom predicate in a for_each statement for container elements, permutation permutation on a string,,,,, and which all show lists operations. Also included in this download are programs such as and

threads is a collection of programs all using threads.

spider is a collection of programs for scraping web pages.

Hex to Dec:
Need a quick way to convert Hex to Dec?
echo "ibase=16; BC" |bc 
Works  with addition and subtraction too
echo "ibase=16;FF +A" | bc
Want to find out who's connected to your computer without using netstat -na?
cat /proc/net/tcp
...true, the listing is little-endian four-byte hexadecimal..but see the awk page or the README in the awk script download.

Encrypt and Decrypt:

Need to encrypt a file?
openssl des3 -salt -in file.txt -out file.des3
Need to decrypt the file?
openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword
Need to encrypt what you type? Enter the following, then start typing but  ^D to end.
openssl des3 -salt -out stuff.txt
Need to tar/zip and encrypt a whole directory without a temp file?
tar -zcf - mydirectory|openssl des3 -salt -out mydirectory.tar.gz.des3 -k mypassword
Need to decrypt the file above it?
openssl des3 -d -salt -in mydirectory.tar.gz.des3 -k mypassword|tar -xz
Need to remove a file permanently?
shred -u file.txt
...for information see the README in the bash script download.
05.04.05  Google Gmail
03.08.05  Linux CDROM
11.22.04  SQLite Tutorial
10.19.03 Added encrypt and decrypt
06.22.03 Alpha 0.0.1 release 

Chirico img Mike Chirico, a father of triplets (all girls) lives outside of Philadelphia, PA, USA. He has worked with Linux since 1996, has a Masters in Computer Science and Mathematics from Villanova University, and has worked in computer-related jobs from Wall Street to the University of Pennsylvania. His hero is Paul Erdos, a brilliant number theorist who was known for his open collaboration with others.

Mike's notes page is souptonuts. For open source consulting needs, please send an email to All consulting work must include a donation to Logo