I know alot of people are wondering what to do in a port, especially if you have decided to carry weapons but now have turned them in to customs. Are you safe at night?
These are only a few suggestions but, you know the biggest knife around is a machete. Lost of countries, you'll see 6 year olds walking down the street with one and nobody bats an eye. It's pretty long and if the other guy doesn't come aboard with a gun, at least you have a chance even before they get too close to do you harm.
Also if you happen to be a light sleeper the other alternative is a sling shot. A good one, that raps around the forearm. Load it with a good size pellets and it can make your opponent want to be someplace else. This actually worked for me one night, tied up to a crowded dock, when I was asleep in the v-berth and woke to the sound of my dinghy line tied to the bow being slipped. The guy had trouble starting the motor, and I yelled and screamed - you know, no one even popped out to see what was going on. But my trusty slingshot got him a couple of times, and that did the trick.
The other thing about going ashore, that is a nice confidence builder is this thing I constructed, really to ward off the dogs while I was going for my morning jog. I took the end of a stay that I had changed, cut off about a foot of the end and put it inside a heavy rope. It was sort of good for knot skills, because I put in a handle, and put the stay on the other end. It was like a weighted sap. The nice thing about it to, was the dogs were smart enough to know that I were swinging something really bad, and not one of them bothered me again, I didn't have to make contact or anything, it was nice not to have to worry after a couple of too close calls.
But for warding off pirates at sea, I don't have any good alternatives for you.