In a democratic society, there is no way to entirely "proof" yourself from consequences of your own antisocial actions like if you sexually assault people or something like that.
I think the answer to what you're really asking is
do not be in an industry where you are customer-facing or public-facing,
and do not seek a public platform.
That will shield you from arbitrary and exaggerated mob type/snowballing behaviour, such as the Justine Sacco incident (in which a woman lost her job over an ironic joke about AIDS which fell victim to Poe's Law).