I keep forgetting how to terminate an SSH connection when it gets stuck.

I always end up in this page.

Type Enter, ~ and then . period.

This also works if you vim or nano a file and you come back to the shell and seems to be stuck. Typing this combination will exit.