What are default permissions or configuration? Revert chmod 777

The nearest you will probably get to "default" permissions are those implied by your login session or shell's umask value ex. if umask returns 0002 then the default octal permissions are 0664 for files and 0775 for directories; while if umask is 0022 they are respectively 0644 and 0755.

You can apply such permissions using

find ~/MyDir -type d -exec chmod 0755 {} +

find ~/MyDir -type f -exec chmod 0644 {} +

Obviously you will need to manually correct cases such as executable scripts or program files that will need their executable bit set to run properly.