The MUD expression of this is "so-in-so bonks herself on the head". If you've ever done this (not necessarily in a mud), it is a Very Good Thing because it means you actually recognize and aknowledge when you've done something stupid, unlike most people on this planet.