For the memory: Memtest86, not even commercial programs can top it (boots off floppy or CD-ROM):
http://memtest86.org
The longer you can run it without getting errors, the cleaner your RAM is
. 'Long' would probably be around 1-2 days. As for the hard drive, e2fsck could do that (it would be on a Knoppix CD-ROM, so you could boot from that):
e2fsck -cv
And if you want an auto-repair using e2fsck:
e2fsck -p