A shock absorber is provided in the present invention. The shock absorber includes a resilient element; a gear set comprising a first non-return gear and a second non-return gear; and an electric generator driven by the first non-return gear to generate a power when the resilient element is compressed and driven by the second non-return gear when the resilient element is loosened.