Fix whitespace and `^M` control characters normally generated by Windows

The original files contain `^M` control characters that usually originate from editing files in Windows.
The dreaded dos line-endings. These control characters can cause errors on Linux machines.

Extra whitespace at the end of lines is also removed.