Elastic Properties and Stacking Fault Energies of Borides, Carbides and Nitrides from First-Principles Calculations