Contact mechanics, friction and adhesion with application to quasicrystals