Making somthing run for X amount of time

We would be forever gratefull good sir if you did write the code and shared it with us here!

We are looking at the tutorial right now and trying to make something out of it, but we struggle...