Near positive definite (NearPD) of a symmetric matrix in Julia

Feel free to mark my answer as a solution, so that other people can easily spot it. And of course if a better solution is given, feel free to mark that instead :wink: