On my Lenovo T530 laptop, the PgUp and PgDown keys are right next to the arrow keys, which makes for very smooth code navigation. Unfortunately, the Home and End keys are far away, above the Backspace key to be precise.

Here's how to map Alt + PgUp -> Home and Alt + PgDown -> End in Ubuntu using xbindkeys.

sudo apt-get install xbindkeys xbindkeys-config xvkbd
xbindkeys --defaults > ~/.xbindkeysrc

Now paste the following into ~/.xbindkeysrc.

"xvkbd -xsendevent -text '\[Home]'"
  Alt+Mod2 + Prior | m:0x18 + c:112
"xvkbd -xsendevent -text '\[End]'"
  Alt+Mod2 + Next | m:0x18 + c:117

Then start xbindkeys. You may need to add xbindkeys to the list of startup applications.