Coding can be done in many ways but don’t spend too much money on coding templates. Print out (and 3d print templates) can be found on the web.
Even without a template, once you have determined the zone you can try by eye with a black felt tip pen; the white is not important if you have a chromed mount (on an M10 at least, other cameras may differ, I can’t say for the M9).
If you have LTM lenses then some adapters have a groove or even individual pits. These work well.
I also changed the mount of my Summicron V with an eBay one with pits. Focus is perfect and the coding works well.
On an M10 at least it’s not rocket science. However, apart from using the right code the most important thing to remember is to get it the right way round; check with images on the web of lenses using that code.