For the Rice: In a large heavy-bottomed saucepan, heat 2 tablespoons oil over medium heat until shimmering. Add two-thirds of onion and cook, stirring, until softened and translucent, about 5 minutes. Add rice and cook, stirring, until grains are shiny and evenly coated with oil, 2 to 3 minutes. Add water or stock and salt, increase heat to high, and bring to a boil. Place bell pepper on top of rice.
Boil rice without stirring until most of the liquid has evaporated and you can see small bubbles bursting on the surface of the rice. Immediately reduce the heat to the lowest setting, cover, and cook for 15 minutes. Remove and discard bell pepper. Fluff rice with chopsticks or fork, then let cool. Transfer to an airtight container and refrigerate for 24 hours.
For the Beans: Spread beans out in a rimmed baking sheet. Pick out any debris and broken beans. Transfer beans to colander and rinse under cold running water. Place rinsed beans in a large pot and cover with cold water; water should cover beans about 3 inches. Let soak for 30 minutes.
Bring beans to a boil over high heat. Reduce heat to maintain a simmer and cook beans for 30 minutes. Turn off heat, cover beans, and let rest 1 hour. Bring beans back up to boil over high heat. Add salt and garlic, reduce heat to maintain a simmer, and cook until beans are tender, 30 to 60 minutes. Drain beans or, if desired, strain over a bowl and retain liquid for another use. You should have about 3 cups of cooked beans; measure out 2 cups of beans and reserve the rest for another use.
For the Gallopinto: In large saucepan, heat remaining 2 tablespoons oil over medium-high heat until shimmering. Add remaining onion and cook, stirring, until softened and translucent, about 5 minutes.
Add rice and beans, and cook, stirring, until rice is evenly coated. Continue to cook, stirring, to allow flavors to meld and gallopinto to become slightly crisp, about 10 minutes. Serve immediately with scrambled or fried eggs, a side of corn tortillas, and queso fresco. If desired, cover and cook over low heat for an additional 10 minutes (see note).
