Simulations of QCD and QED with C∗ boundary conditions