How to reset to default permissions on El Capitan
For system installed packages you can run the following command in Terminal.app to find permissions that differ from the default:


  sudo /usr/libexec/repair_packages --verify --standard-pkgs /


If you want to just apply those permissions to your system as a whole, run the following command:


  sudo /usr/libexec/repair_packages --repair --verify --standard-pkgs /


Or you could individually fix the permissions that you have changed yourself using chmod/chown.

For everything else, you need to have used either a package manager that can verify permissions, or have a backup you can use for comparing permissions before and after the event.

For others: Please note that the repair_packages command no longer exists in Sierra and newer macOS versions, as they now automatically handle repairing permissions. If you have manually messed up permissions so much that they cannot be fixed automatically, I would recommend restoring permissions from a Time Machine backup or similar.