there is no point in providing context for you. If I do, then you will go looking for other verses.
The first verse provided is in the context of judgment. God is judging the entire nation of Amalek. You find this difficult because you live in the Western World of individualism. The Ancient World was a context of covenantalism. In the Eastern World today - say China, the emphasis of judgment is not on the individual but on the many.
Hence - you find God's judgment on the individuals as unjust - yet the ancient world and perhaps half of the modern world sees judgment on the whole as totally justified.
The second passage from Ezekiel is one of judgment as well. Why is it atheists are scared of judgment? They hate it whenever God speaks the truth and carries out what he says he will do. But then get all upset because there is evil in the world. LOL @ the inconsistency in the atheist understanding.
Here, as in most places in the OT, God uses his prophet to warn these people. Do you even notice the warning? God does not just judge them without proper notice - without giving them an opportunity to stop being so wicked - but by warning them. Putting them on notice. They can stop - they refuse to. God says - you have brought this upon yourself.
The principle on adultery is clear. The context is covenantal. Unfaithfulness is unacceptable. The maximum penalty is death. This is evidence of how highly God values marriage and faithfulness. The death penalty was not carried out in every example. In fact - for a covenant death to be applied - the offending parties had to be taken to the gate for a trial - and then if found guilty - the sentence could be carried out. And this could be anything up to and including death. It was a maximum penalty - not the only possible penalty.
We in our nation have maximum penalties for stealing bread. You would probably get a good behaviour bond. But the maximum penalty is 15 years in prison.