Is there any way to post my code on Code Review Stack Exchange and not be worried about plagiarism?
In addition to all the good answers you received so far, I should also point out that in general people's fear of being unethically scooped is vastly exaggerated. I would imagine that there really isn't a community of people scouring the Web for master's thesis level research that they can find and then, with considerable time disadvantage to the original author, copy. I say "with considerable time disadvantage" because even if somebody finds your work, they still need to reverse engineer a lot of what you already have and know to get to a publishable thesis or paper from your code alone. Unless you consider letting your work sit for half a year it seems unlikely that a copycat will end up publishing quicker than you, the original author.

Yes, being scooped sucks, but it usually does not happen because somebody stole your code, or even your idea. Scooping happens because there are multiple independent teams working worldwide on almost any mainstream research topic, and there usually only are a finite number of ways to attack any given problem given the current state of literature. Situations where two teams are working with similar approaches on similar problems are bound to come up.