Preheat your oven to 350°F (175°C) and line a muffin tin with cupcake liners.
In a large bowl, whisk together the flour, cocoa powder, baking powder, baking soda, and salt.
In a separate large bowl, whisk the eggs, granulated sugar, brown sugar, oil, and vanilla until smooth.
Add the eggs, one at a time, and beat well after each addition. Stir in the vanilla extract.
Add half the wet ingredients to the dry ingredients, alternating with the buttermilk, beginning and ending with the wet mixture. Stir until just combined.
Divide the batter evenly among the cupcake liners (they should be half filled) and bake for 18-20 minutes or until a toothpick inserted into the center comes out clean.
While the cupcakes are cooling, prepare the frosting. Beat the softened butter until smooth, then gradually add the powdered sugar, milk, and vanilla until you reach your desired consistency.
Divide the frosting into five bowls and use food coloring to dye each one to the color of one the four Hogwarts Houses (easiest to do red, green, yellow, and blue.) Dye the fifth bowl of frosting brown (I like to use cocoa powder to do this). Note: there should be a higher proportion of brown frosting than the other colors, as it will be used to cover all the cupcakes.
When the cupcakes have cooled, use a melon baller or spoon to scoop out a small portion of cake from the top of the cupcake. There should be a small pit where the frosting will be put late.
To assemble, pipe the house colored frosting into the pits of cooled cupcakes. Then pipe the brown frosting on top of the cupcake, covering the house colored frosting and creating a swirling pattern to resemble the Sorting Hat.
Finish by sprinkling each cupcake with edible gold glitter or sprinkles for that extra touch of magic!