A rule of thumb I follow is to include any punctuation that is in the material you are quoting (such as the exclamation mark in your second example), and let it end your sentence if it ends the sentence you are quoting. For instance, I think it would be fine not to put a period after the quotation mark in your second example.
On a slightly different note, if you are adding punctuation that does not appear in the material you are quoting, I would only put that punctuation inside of the quotation marks if it is a comma or a period. If you want to add any other punctuation (such as an exclamation or question mark) that does not appear in the material you quote, I would put it outside of the quotation mark to clarify that the emphasis is your own.
It is also worth noting that there seems to be a trend, especially among young people, toward leaving quoted material in its exact form, and putting all additional punctuation outside of the quotation marks. Personally, I think this makes a lot of sense and is in a way more honest. The primary reason that any additional punctuation is placed inside quotation marks is simply that many find it aesthetically nicer.