Heat 1 teaspoon of the vegetable oil in a wok over medium-high heat. Pour in the onions, and cook until just set; set aside. Increase the heat to high, and pour another 1 teaspoon of oil to the wok. Stir in the shrimp, and cook until the shrimp turn pink, and are no longer translucent in the center, about 3 minutes; set aside.
Wipe out the wok, and heat the remaining teaspoon of oil over high heat. Stir in the ginger, and cook quickly for a few seconds until the ginger begins to turn golden brown. Stir in the onion and chile peppers; cook for a minute or two until the onions begin to soften and turn brown around the edges. Add the pineapple and oranges, and gently cook until the pineapple is hot.
Stir in the rice, walnuts, and soy sauce. Stir for a few minutes until the rice is hot. Fold in the egg, shrimp, and cilantro. Season to taste with salt and pepper, and cook to reheat.