מי שהיה עובר אחורי בית הכנסת, או שהיה ביתו סמוך לבית הכנסת, ושמע קול שופר, או קול מגילה--אם כיוון ליבו, יצא; ואם לאו, לא יצא
One who passes behind the synagogue, or whose house is next to the synagogue, and heard the sound of the shofar or the sound of the megillah, if she directed her heart, she has fulfilled her obligation, and if not, she has not fulfilled her obligation.
--Mishnah Rosh Hashanah 3:5
Much has been said about this mishnah, and it is often a jumping-off point for discussions of whether mitzvot require intention. But I never thought about it as a real-life situation until walking around Jerusalem on Rosh Hashanah. Teki'ot and teru'ot can be heard every few blocks, and I'm pretty sure that at least one set was coming from an apartment. So if you're in Jerusalem and want to hear the shofar, there's really no need to go to services; just walk around for a while, or even stay in bed.