I think Karl is right. This usage of "for" is a bit unusual, so I thought I'd add a bit more explanation. Here, "for" means that you are regarding one thing (yourself) as being something else (a yellow dog) . The most common place where you'll hear the word "for" used in this way is in the phrase "to take someone for (something)" or "to mistake someone/something for (something/someone else)." For example:
"Do you take me for a thief?" ("Do you regard me as a thief?"/"Do you think of me as being a thief?")
"What do you take me for?" (meaning: "What kind of person do you think I am?")
"I mistook this painting for a photograph." (meaning: "I wrongly thought that the painting was a photograph.")
The usage of "for" with the meaning of "regarding something as being something else" used to be more common, and you'll still see it in some other common phrases. To "shoot yourself for a coward" therefore just means "to shoot yourself because you regard yourself as being a coward." I've never personally heard the phrase "yellow dog" used to mean "coward," but the word "yellow" implies cowardice in English, and the word "dog" can mean someone pathetic or worthless, so this interpretation looks right to me.