Electronic Notes
This idea came to me because I am an idiot. I am constantly writing little
notes to myself about things I want to remember to do the next day, and I
always write these notes on little scraps of paper and constantly lose them.
So I figured, wouldn't it be cool if I whenever I thought of something I could
type it on the computer and at the end of the day, all notes would be mailed to
me in a nice, concise package? Indeed. Here's how it works:
In the UNIX environment (using ULTRIX with csh in my case) whenever you want to write a
note to yourself you type at the command line:
notes "remember to call home!!"
You simply do this throughout the day and all of your notes are mailed to you
at the end of the day. Simple, but still a time saver.
First, I wrote a small C program to take care of the command line argument
processsing and append it to a file.
tommut@elwood by: 87%cat progs/C/notes.c
#include "stdio.h"
int main( char *args, char **argv ) {
char *dir = "mail/notes.txt";
FILE *fp = fopen( dir, "a" );
fprintf( fp, "*- %s\n\n", argv[1] );
close( fp );
return ( 0 );
}
Next, I wrote a C script that checks to see if a notes.txt file exists. If
not, it does nothing. Otherwise, it makes a backup of the notes file and then
sends the file containing the notes to the specified user (you) via email. Then
it removes the file, so it doesn't send you blank messages each day if you
don't use a note that day.
tommut@elwood by: 86%cat scripts/notes.script
#! /bin/csh
if ( -e "/mounts/u4/tommut/mail/notes.txt" ) then
/bin/cp /mounts/u4/tommut/mail/notes.txt /mounts/u4/tommut/.notes.txt.bkp
/bin/cat /mounts/u4/tommut/mail/notes.txt | /usr/ucb/mail -s
"*** Daily Notes ***" tommut@csh.rit.edu
/bin/rm /mounts/u4/tommut/mail/notes.txt
endif
Finally, just run the script once a night using crontab after you go to bed (mine is set to
run at 5 a.m. - I go to bed later than some people...).
tommut@elwood by: 32%cat crontab
# this sends any notes during the day to me via mail
0 5 * * * /mounts/u4/tommut/scripts/notes.script