A NSW surfer has had a heart-stopping close encounter with a shark.