1. Rinse tofu, drain in a colander for about 5 minutes, then pat dry with paper towels. Cut into 3/4-inch cubes and lightly blot with more towels.
2. Rinse lemon grass. Cut off and discard tough tops and root ends; peel off and discard tough, green outer layers of stalks down to tender white portion of bulbs. Finely chop tender portions; you should have 4 to 7 tablespoons.
3. In a bowl, mix lemon grass, soy sauce, chili, sugar, turmeric, and 1/2 teaspoon salt. Gently stir in tofu. Let marinate for 5 to 10 minutes, stirring occasionally.
4. In a 10- to 12-inch nonstick frying pan over high heat, stir onion, shallots, and garlic in oil until fragrant, about 1 minute; push to one side of pan. Add tofu mixture. Gently turn cubes occasionally and stir onion mixture until tofu is browned around the edges and onion is soft, 5 to 7 minutes.
5. Stir in basil leaves and half the peanuts. Add salt to taste. Pour into a serving dish. Garnish with remaining peanuts. Serve with hot cooked rice.