We discuss a microscopic scheme to compute the rigidity of glasses or the plateau modulus of supercooled liquids by twisting replicated liquids. We first summarize the method in the case of harmonic glasses with analytic potentials. Then we discuss how it can be extended to the case of repulsive contact systems : the hard sphere glass and related systems with repulsive contact potentials which enable the jamming transition at zero temperature. For the repulsive contact systems we find entropic rigidity which behaves similarly as the pressure in the low temperature limit: it is proportional to the temperature and tends to diverge approaching the jamming density with increasing volume fraction, which may account for experimental observations of rigidities of repulsive colloids and emulsions.