Of the top of my head, several points:
- Do tiny little scripts for free, but then do not agree
to do it again;
- Price medium projects hourly. Give an estimate and a
plus/minus. Hourly charge is what you say it is. :)
- Large projects: do not undertake them. You have a life,
after all, right? RIGHT?
Of course, if you're in love with the person who asks you
to write that CGI, you do it all for free and buy her flowers
afterwards.