Recovering lost Python source code if it’s still resident in-memory

I read this on GitHub Gist the other day. I don’t know whether I will ever use it but I am still putting this on my blog for the sake of bookmarking it. Who knows? Someone from the audience might end up using it!

I screwed up using git (“git checkout –” on the wrong file) and managed to delete the code I had just written… but it was still running in a process in a docker container. Continue reading