Heat a medium frying pan over medium heat. After a minute or two, add the olive oil and pistachios. For roasted pistachios, cook for 1 minute, tossing frequently. For raw pistachios, cook for 3 minutes, tossing frequently.
Add the red pepper flakes, cumin, paprika, cayenne, several cracks of black pepper, and salt (only add salt if using unsalted pistachios). Stir almost continuously for 1 minute, then take off the heat.
Transfer to a plate and spread out with a spoon, ensuring spices evenly coat the nuts.
Once cool, store spiced pistachios in an airtight container or jar in your pantry for 3 weeks (may last longer).