No, not Jim Carrey, but Balaam, a character who appears in the Biblical book of Numbers.
Basically, the story has it that Balaam, who was essentially a curse-speaker for hire, was ordered by King Balak of Moab to curse the Israelites. This was in the time when the Israelites were still wandering around the desert, stumbling toward the Promised Land, but had already totally devastated a few cities in the area. Balaam rides his donkey toward where the Israelites are encamped, but an angel blocks the path. The magician doesn’t see the angel, but his donkey does, so it stops in the road.
Balaam’s reaction is to beat the donkey, which then complains in human speech that it did not do anything wrong. The angel tells him to go on, but when he tries to curse the Israelites, God puts praises in his mouth instead. King Balak isn’t too happy about this, but as a prophet, Balaam can only say the words that he receives. That’s pretty much it for him, but the very next chapter tells about how Moabite women seduced the people of Israel into worshipping Baal, and some interpreters think this was Balaam’s backup plan. This receives support in Chapter 31, which tells how Balaam advised the women to entice the Israelites into sin, and was killed in revenge for this. Balaam is also mentioned as a false teacher in the books of 2 Peter and Jude.
As with a lot of biblical characters, Jewish legend presented a lot more information about Balaam. In rabbinical lore, he came to be seen as an enemy of Moses since before the prophet’s birth. He was one of the Pharaoh’s main advisers, and suggested drowning the newborn Hebrew children. The other two main advisers were Jethro, later Moses’ father-in-law, who favored the Hebrews; and Job, who withheld an opinion. According to this interpretation, this refusal to speak up was why Job was punished in his own book. This pretty much negates the whole point of Job, but whatever. After Moses was adopted by Pharaoh’s daughter, Balaam once again advised killing the child, but Moses’ adoptive mother threatened to have him executed. Therefore, the magician fled to Ethiopia, where he took control of the capital city and set up a magical wall of serpents to protect it. It was Moses who thwarted him here as well, by getting the army to use storks to kill the snakes. So the villainous prophet returned to Egypt, and his sons Jannes and Jambres were the magicians who competed against Moses and Aaron.
I suppose his last stand at Moab was his final attempt to get back at Moses.