The important distinction to make here is between:
- Intellectual contributions to the actual research/science.
- Technical help.
Contributions of the first kind are – roughly speaking – what warrants authorship or, if the contribution is already published, a citation. With other words: If the contribution would warrant authorship if unpublished, it has to be cited. As already stated, this is somewhat simplified and distinguishing between when to cite and when to include as an author can sometimes be tricky, but it should give you a rough idea, as to what you have to cite. Also note that there are other reasons for citing, such as context embedding, which do not apply here, however.
Two lines of code (to take this example) almost always fall under contributions of the second kind: They help you with the tools you need to use for your research but not with the actual subject of your research. It’s roughly comparable to the contribution of somebody fixing the microscope you need for some biological research. Of course, it might be a very helpful contribution that saved you months of work (in which case you should consider mentioning it in the acknowledgments), but it’s not a scientific contribution.
However, the decision may not always be that easy. Apart from the aformentioned authorship criterion (also note the authorship tag on this site for this), asking yourself the following questions might help to solve the question:
Is the kind of contribution to your work fundamentally different from:
- designing the programming language you used,
- designing or building your CPU,
- designing or building your microscope?
If yes, consider citing.
Does the contribution affect the results of your research or is it necessary for others to reproduce your research? By results I here mean something like:
The 666th digit of π is 6.
The proposed algorithm outperforms the current standard method.
and not:
I managed to compute the results before the deadline.
Unfortunately, the results do not make any sense, probably due to some bug.
If yes, then you should consider citing. If, on the other hand, you have good reason to assume that somebody implementing your solution in a totally different programming language or calculating everything with pen and paper would arrive at the same results, then you should not cite.
Contributions of the second kind are what, amongst others, you can put in your acknowledgements, where in a thesis it’s usually up to you, who and how many people you mention.