This questions casts a spotlight on the futility of trying to pin such widely used words down to a particular "part of speech". The dictionaries will tell you that how is an "adverb" - perhaps an "interrogative adverb" or a "relative adverb" - but in these two instances how is neither of these. It is the head of what grammarians call free relative clauses. These clauses exhibit the following characteristics:
They are headed by—what shall we call them? Particle seems to be replacing adverb as the stock wastebasket term, and at least does not invite any confusion with entirely unrelated uses, so—These phrases are headed by particles which in other contexts act as interrogatives: who, what, which, why, when, where, whether, how, or combinations of these with -ever. A brief and not entirely satisfying discussion of Free Relatives in McCawley 1998, 13.c., gives good reasons for identifying these particles with interrogatives, and less-good reasons for calling them relativizers.
They act as noun phrases. As you say, the how clause in your second example acts as the object of the preposition at. In your first example, the how clause acts as the direct object of the phrasal verb give a damn. If this is confusing, substitute a more conventional verb and the structure becomes clear:
I don't see how you lost it.
It doesn't matter how you lost it.
Don't tell me how you lost it.
That's not how you lost it.
They have the same internal structure as relative clauses, with the head particle seeming to stand for a term omitted from the remainder of the clause. This is why these clauses are characterized as relative. It is a singularly unhappy use of the term, since the heading particle is unrelated to any antecedent—which is why the clauses are further characterized as free, not "bound" to an antecedent.
The Comments by FumbleFingers and Bob Rodes discuss how to understand what how means here. The way in which works adequately, or the manner in which. But do not misunderstand their casual use of "replace". How does not "replace" these paraphrases or "stand for them".† In both your examples how signifies an account or narrative of what was done rather than the way or manner in which it was done—as it is used, for example, in titles:
How the Camel Got His Hump
How Robin Hood Came to be an Outlaw
How Stella Got Her Groove Back
† If anything, it's the other way around. How was already used in this way in Old English, long before Wh- relatives and pied piping came into the language.