The advent of flow micro-power generation has resparked the interest in researching the galloping instability with the objective of determining the shape of the bluff body that is most prone to galloping. Such shape, which is sought to maximize the efficacy of galloping micro-power generators (GMPGs), must possess a very low cut-in flow speed while achieving large-amplitude steady-state oscillations beyond it. Additionally, since GMPGs can operate in environments with fluctuating flow conditions, the optimal shape must also have a very short rise time to its steady-state amplitude. In this work, we utilize computational fluid dynamics in conjunction with machine learning to optimize the shape of the bluff body of GMPGs for both steady-state and transient performance. We investigate a continuum shape description which encapsulates most of the cases studied earlier in the literature. The continuum has a straight frontal and dorsal faces with varying lengths, and side faces described by surfaces of different curvatures. The optimization study reveals that a curved-trapezoidal bluff body with the highest side surface curvature and frontal-to-dorsal ratio is the perfect shape for steady flow conditions. On the other hand, a square profile with the highest side surface curvature is the ideal choice for highly-fluctuating flow conditions because of its shortest rise time. The theoretical findings are replicated experimentally using wind tunnel tests.