Such a code does not necessarily require sacrificing one's life, but it may require making sacrifices to one's livelihood. A good Code of Ethics is one such as the one below from the Association of Computing Machinery (acm.org). It's a commitment to one's peers, clients, and society at large. And while some may limit their adherence to this code to their professional life, I would say that such a code should apply to all aspects of one's life.
Being ethical is not just a 9-to-5 job. It's a way of life... it's a nobility. Is it in you?
ACM Code of Ethics and Professional Conduct