Keep yourself to yourself. Don't make eye contact with anyone who may seem suspicious. Talking on the phone to someone will be a deterrent for potential predators.
I advise against the big knife.. A fake gun may get you in trouble but you won't accidentally stab yourself with it so less bad as a knife. Neither are really good suggestions though.. You may not get home you may end up in a cell.
Know the route to take. Keep to well lit areas if possible. Do not use your phone. Keep your bag as concealed as possible. Do not use ear buds, you cannot hear anyone coming with them in. Pretend to be talking on a phone
Sorry kpetov- looks like your posts attracted some spam there. Fortunately the mods/Ed are vigilant and zap spam immediately so your thread won't be ruined.
Some of my women university students used to tell me they found riding around town at night on a bike (wearing a hood) was the safest way to travel.
It would apply to young men as well, I've never heard of anyone being attacked when riding a bike.