Berakhot 9:42

['This mishna, which includes all of this chapter’s mishnayot, contains a series of blessings and halakhot that are not recited at specific times, but rather in response to various experiences and events.
MISHNA: One who sees a place where miracles occurred on Israel’s behalf recites: Blessed…Who performed miracles for our forefathers in this place. One who sees a place from which idolatry was eradicated recites: Blessed…Who eradicated idolatry from our land. ', 'One who sees conspicuous natural occurrences recites a blessing. For zikin and zeva’ot, which the Gemara will discuss below, for lightning, thunder, and gale force winds, manifestations of the power of the Creator, one recites: Blessed…Whose strength and power fill the world. For extraordinary (Rambam) mountains, hills, seas, rivers, and deserts, one recites: Blessed…Author of creation. Consistent with his opinion that a separate blessing should be instituted for each individual species, Rabbi Yehuda says: One who sees the great sea recites a special blessing: Blessed…Who made the great sea. As with all blessings of this type, one only recites it when he sees the sea intermittently, not on a regular basis. For rain and other good tidings, one recites the special blessing: Blessed…Who is good and Who does good. Even for bad tidings, one recites a special blessing: Blessed…the true Judge.', ' Similarly, when one built a new house or purchased new vessels, he recites: Blessed…Who has given us life, sustained us, and brought us to this time. The mishna articulates a general principle: One recites a blessing for the bad that befalls him just as he does for the good. In other words, one recites the appropriate blessing for the trouble that he is experiencing at present despite the fact that it may conceal some positive element in the future. Similarly, one must recite a blessing for the good that befalls him just as for the bad. The mishna states: And one who cries out over the past in an attempt to change that which has already occurred, it is a vain prayer. For example, one whose wife was pregnant and he says: May it be God’s will that my wife will give birth to a male child, it is a vain prayer. Or one who was walking on the path home and he heard the sound of a scream in the city, and he says: May it be God’s will that this scream will not be from my house, it is a vain prayer. In both cases, the event already occurred.', 'The Sages also said: One who enters a large city, the Gemara explains below that this is in a case where entering the city is dangerous, recites two prayers: One upon his entrance, that he may enter in peace, and one upon his exit, that he may leave in peace. Ben Azzai says: He recites four prayers, two upon his entrance and two upon his exit. In addition to praying that he may enter and depart in peace, he gives thanks for the past and cries out in prayer for the future. ', 'The mishna articulates a general principle: One is obligated to recite a blessing for the bad that befalls him just as he recites a blessing for the good that befalls him, as it is stated: “And you shall love the Lord your God with all your heart, with all your soul, and with all your might” (Deuteronomy 6:5). The mishna explains this verse as follows: “With all your heart” means with your two inclinations, with your good inclination and your evil inclination, both of which must be subjugated to the love of God. “With all your soul” means even if God takes your soul. “And with all your might” means with all your money, as money is referred to in the Bible as might. Alternatively, it may be explained that “with all your might” means with every measure that He metes out to you; whether it is good or troublesome, thank Him. The mishna teaches several Temple-related halakhot. One may not act irreverently or conduct himself flippantly opposite the eastern gate of the Temple Mount, which is aligned opposite the Holy of Holies. In deference to the Temple, one may not enter the Temple Mount with his staff, his shoes, his money belt [punda], or even the dust on his feet. One may not make the Temple a shortcut to pass through it, and through an a fortiori inference, all the more so one may not spit on the Temple Mount. The mishna relates: At the conclusion of all blessings recited in the Temple, those reciting the blessing would say: Blessed are You Lord, God of Israel, until everlasting [haolam], the world. But when the Sadducees strayed and declared that there is but one world and there is no World-to-Come, the Sages instituted that at the conclusion of the blessing one recites: From everlasting [haolam] to everlasting [haolam]. The Sages also instituted that one should greet another in the name of God, i.e., one should mention God’s name in his greeting, as it is stated: “And presently Boaz came from Bethlehem and said to the harvesters, The Lord is with you, and they said to him, May the Lord bless you” (Ruth 2:4). And it says: “And the angel of God appeared to him and said to him, God is with you, mighty man of valor” (Judges 6:12). And it says: “And despise not your mother when she is old” (Proverbs 23:22), i.e., one must not neglect customs which he inherits. And lest you say that mentioning God’s name is prohibited, it says: “It is time to work for the Lord; they have made void Your Torah” (Psalms 119:126), i.e., it is occasionally necessary to negate biblical precepts in order to perform God’s will, and greeting another is certainly God’s will. Rabbi Natan says another interpretation of the verse: “Make void Your Torah” because “it is the time to work for the Lord,” i.e., occasionally it is necessary to negate biblical precepts in order to bolster the Torah.']