UBUNTU:
This is for my ubuntu 12.04 setup It's more or less stolen from http://www.ninthavenue.com.au/vim-key-bindings-in-ubuntu-using-xmodmap, but I keep it for reference and I do slight modifications to it.
Just run xmodmap .bjartwolf.keymap
To change to norwegian keyboard run sudo setxkbmap no .xmodmap .bjartwolf.keymap
WINDOWS 7:
Use SharpKeys to map caps lock to application key Special: Caps Lock(00_3A) To: Special: Application (E0_5D)
Then use AutoHotkey with the script.
Both packages are available from choclatey.org (autohotkey, sharpkeys)