RepRapFirmware allows for user macros to be stored and run. This repository is a store of examples of useful macros.
Documentation is maintained here:
https://duet3d.dozuki.com/Wiki/Macros
RepRapFirmware also uses macros to conduct many user configurable routines such as homing, tool changing, bed probing etc.
Examples are contained here in the system macro directory.
Caution these macros may not be kept up to date with the latest version of RepRapFirmware or may use gcodes form a newer version of RepRapFirmware than the one you are running. Please check the commands and use with caution