I lived in the Tenderloin for a bit after high school.

First and foremost, avoid alleyways, avoid junkies. It seems like simple advice and it is.

What I learned as a nerdy white kid living in TL was that there is a largely non-verbal communication system, a kind of thieves' cant (although, as I mentioned, it's largely non-verbal, almost like a sign language but with subtle facial expressions and body postures rather than specific signs. (Actual gangs do use specific hand signs to recognize each other.))

If you "know the score" you can just tell someone, e.g. "Hey, don't mug me." using this communication system and they will leave you alone. This happened to me. I was walking through the 'loin when a dude comes up off the wall and starts to fall in behind me. I caught the motion out of the corner of my eye, and I gave him the slightest shake of my head, "nah", and that was it. He fell back and posted up on the wall again, and it was over.

Just being aware of what's going on differentiates you from the clueless "mark". That's the main thing: you're part of the "in-group". You have heard of "woke"? This level of awareness of the nature of life on the street is part of what one is woke to, or not, eh? This cant would seem like telepathy to an unaware outsider.

So, I was able to tell my would-be mugger that, although I look and walk like a clueless tech nerd, I'm actually a resident who knows what's up, so please mug someone else? And, as neighbors do, he kindly preferred to look for someone wandering in from the nicer parts of downtown. A tech worker or tourist, eh?

(I saw those interactions too: Three "gentlemen" corner a fellow up against a wall, one of them displays an empty 40oz bottle, and an agreement of sorts quickly emerges to the effect that it would be much preferable for the victim to give up his wallet rather than receive the bottle to the head. They even gave him his wallet back afterwards. The whole thing took thirty seconds.)

There's also an element of stotting involved in what I'm saying, "an honest signal to predators that the stotting animal would be difficult to catch" ( https://en.wikipedia.org/wiki/Stotting ) Since I "know the score" I'm not going to panic or freeze up if this guy tries to rob me. There's a way to say with your body language, "I'm not going to be easy to rob."

If you don't have that naturally, for whatever reason, there is something called "adrenaline re-imprinting" self-defense courses. Without going into a long tangent about it, the essence is to re-program your adrenaline response to be coherent and defensive. If you haven't seen it, it's hard to imagine the intensity of a controlled adrenaline response. Even small, weak people can be extremely dangerous under the influence of adrenaline. Adrenaline is a hellofa drug. (I mean, in the course I took the instructor at one point has on one of those bear-proof suits, and it still seems like he's gonna get hurt. And the other people in my class were small women! They were destroying this guy.) Basically, the attacker would have to be literally psychotic to continue trying to attack someone in the throes of a controlled adrenaline response. Trying to approach someone in that state... it's like a force-field. There's something deep within you that is like "nope" when confronted with such a fury, and the effect gets stronger as you try to approach. It literally feels like a force-field. I have only had to use the training once, Thank God, and it stopped three guys in their tracks, literally. They were running up behind me, and I stopped and the adrenaline triggered and I spun around and did the thing (there's a posture and you shout "back off!") and they stopped in their tracks. I started a conversation with them and they were scared of me. As in I made a gesture and one of them jumped back a little. Anyway, the thing to search for is "adrenaline re-imprinting".

I like you Kragen, I hope it's not too weird to say that, so I hope this was helpful or at least interesting. Cheers!