I have folder for temporary folders and I would like it to be emptied automatically at 3am. I know crontab probably could do this but what if my laptop isn't on when it should run?
The answer to your problem is Anacron. It comes with Ubuntu by default. Just put your script in one of these folders and make it executable:
/etc/cron.hourly # run hourly, only available since Ubuntu 14.04 /etc/cron.daily # run daily /etc/cron.weekly # run weekly /etc/cron.monthly # run monthly
For finetuning check out the anacron manpage. The difference between anacron and crontab is that anacron jobs will run later if they can't run at the specified time.