For more than a century, people have climbed on top of moving trains in search of a thrill. Now social media has attracted a new generation of daredevils.