Exiting SSH when frozen

When working on an unstable wifi network, my SSH sessions tend to
freeze. Normally, I kill the process or wait for a timeout to occur. But
today I learned that there is an easier way:

You can type ~.<ENTER> to immediatly end a frozen SSH session.