Where can I find code that allows me to calculate Z1 and Z2 from an ECDSA signature?
According to Nils's post, the z values are the hashes that get signed in the ECDSA formula.  Background on what data goes into these hashes can be found on the OP_CHECKSIG wiki page and Krzysztof Okupski's excellent developer reference PDF.

Bitcoin Core's code for generating the hashes is here.  Any other Bitcoin application that signs transactions (or verifies signatures) must have a compatible function (at least for the default SIGHASH_ALL), so you should be able to find an implementation in pretty much any popular programming language.