From clothing: Place the item stain-side down on a stack of paper towels. Spray with WD-40 or another grease-stain cleaner. Let sit for five minutes, then flip it over and spray again. Rinse the WD-40, then apply liquid dish soap to the stain. Rinse, then machine-wash after applying a spray stain remover if any stain is left.
From carpet: Gently scrape the crayon up from the carpet with a dull knife (try covering the area in a plastic bag full of ice to harden the crayon), then vacuum. If that doesn't work, use a simple dish soap and water mixture or a store-bought stain remover, or you can try isopropyl rubbing alcohol, hydrogen peroxide, or baking soda and water (for the last three, treat an inconspicuous area of your carpet first to make sure it doesn't discolor your carpet). Let your mixture soak in, blot it gently, rinse with clean water, and let dry.