Fixing Home and End buttons in Mac Terminal

I hate it when Terminal in my mac scrolls up when I hit 'Home' key, or all the way to the bottom, when I hit 'End' key. As most would do, I expect 'Home' key to take me to the beginning of the line, and 'End' to the end of it.

I can of course use 'control+a' and 'control+e' to do that, but it's tough to beat muscle memory.

There is a Stack Exchange 'Ask Different' entry for this, but the keys mentioned there for terminal were not working for me:

Terminal Keyboard Binding

What seems to work for me is:
* \033[H -> Home
* \033[F -> End

These can be set from Terminal > Preferences > Keyboard as shown in the screenshot. Enjoy!