Wars and political upheaval bring plenty of misery and uncertainty. But for some of America’s smaller public companies, they’ve also produced extraordinary profits.