How to add custom fields to Media / Assets

Would you be so kind to share the code you use to achieve having more properties on the media?