Devarim25:17

זָכוֹר אֵת אֲשֶׁר־עָשָׂה לְךָ עֲמָלֵק בַּדֶּרֶךְ בְּצֵאתְכֶם מִמִּצְרָיִם׃

Remember what Amalek did to you on the way, when you came out of Egypt:

Devarim 25:17

זָכוֹר אֵת אֲשֶׁר־עָשָׂה

Devarim / Deuteronomy 25:17 · Drash

Devarim 25:17

זָכוֹר אֵת אֲשֶׁר־עָשָׂה לְךָ עֲמָלֵק בַּדֶּרֶךְ בְּצֵאתְכֶם מִמִּצְרָיִם׃

Remember what Amalek did to you on the way, when you came out of Egypt:

Drash דְּרָשׁ

A full dish and an empty one

There are things you recall with joy, and things you recall so they never happen again. One word, but different memory.

Midrash Tanchuma: of Shabbat and of Amalek the same word "remember" is said, but they are not equal. A king remembered a friend over a full dish and an enemy over an empty one. Shabbat is remembered at a set table, Amalek so as to blot out his memory. Rabbi Banaa: a generation with false measures brings an enemy upon itself. That is why Amalek follows the law of weights.

How Midrash Tanchuma explain it

Midrash Tanchuma Remember what he did to you, and so on

Here it is written "remember," and of Shabbat it is written "remember": are both equal? Shlomo (Solomon) said: "And I said in my heart: what befalls the fool will befall me too, so why have I become wiser?" (Kohelet / Ecclesiastes 2:15). And he said: "For there is no memory of the wise, as of the fool, forever" (Kohelet / Ecclesiastes 2:16). Although of Shabbat "remember" is written and of Amalek "remember" is written, they are not equal. Shlomo said: "what befalls the fool will befall me too."

A parable: what is this like? A king who made a feast and invited guests. A dish full of every good thing was brought before him, and he said: "Remember so-and-so, my friend." When he had emptied the dish, he said: "Remember so-and-so, my enemy." His friends said to him: "You mentioned this one and you mentioned that one." He said to them: "That one I mentioned over a dish full of every good thing, and this one I mentioned over an empty dish."

So of Shabbat it is written: "Remember the Sabbath day to keep it holy" (Shemot / Exodus 20:8) — and to honor it with food, drink and clean clothing. And of Amalek it is written: "Remember what Amalek did to you." Over what do you remember him? Over an empty table, as it says: "blot out the memory of Amalek from under the heavens."

Midrash Tanchuma Remember what Amalek did to you on the way, when you came out of Egypt

Rabbi Banaa opened: "False scales are an abomination to the Eternal" (Mishlei / Proverbs 11:1). If you see a generation whose measures are false, know that the kingdom attacks that generation. Why? "False scales are an abomination to the Eternal," and after it is written: "When arrogance comes, shame comes, but with the modest is wisdom" (Mishlei / Proverbs 11:2).

Rabbi Berechya in the name of Rabbi Abba bar Kahana said: "Shall I acquit with wicked scales and a bag of deceitful weights?" (Michah / Micah 6:11). Can a generation whose measures are false be acquitted? "And a bag of deceitful weights" — Rabbi Levi said: Moshe (Moses) too hinted it to them in the Torah, as it says: "You shall not have in your bag a weight and a weight," "you shall not have in your house." Why? "For it is an abomination to the Eternal." What is written after it? "Remember what Amalek did to you."

Takeaway

"Remember the Sabbath day" is the fourth of the Ten Utterances (Shemot / Exodus 20:8). "Remember what Amalek did to you" is our verse. The word זָכוֹר is the same.
The midrash cites Shlomo's verses that the wise and the fool meet the same end as a question: if the word is the same, does it mean the same?
"Blot out the memory of Amalek" is the end of our passage (Devarim / Deuteronomy 25:19).
"You shall not have in your bag a weight and a weight" — a heavy one and a light one, for buying and for selling (Devarim / Deuteronomy 25:13–16). Rashi at the Pshat level cites the same closeness.