Yes. While there are certain ordering rules for applying capital losses against capital gains, ultimately, long-term capital losses can offset any short-term gains.
Debt used to buy, build, or construct a principal residence or second home and that generally qualifies for a full interest expense deduction.