Gamma-ray burst afterglow scaling coefficients for general density profiles