Camped at Beacon Rock State Park this weekend, and trains go by about every half hour. If you listen carefully, you can hear it with enough time to get about 60 seconds' head start. That gave me time to sprint to the dock, and get positioned.
And in that second one, the slight blur is actual dock movement, not star rotation. The dock I was shooting from was pretty well anchored, but it did move slightly if the current picked up. Not an ideal tripod... I got very lucky that it didn't move much for the train shot.