A big inyan in Chassidus is that of turning things that are bad into good, it says this in Keser Shem Tov explicitly. The various Admorim speak of this matter in their own ways, giving examples as to how this is accomplished.
The Baal HaTanya brings the example in Likkutei Amarim Perek 37 of blood. The blood of a person receives sustenance from food, which is the aspect of Klippah Nogah. When a Jew uses this energy for learning Torah and doing various mitzvos, then the “evil,” that is coarse physicality as manifest through food, becomes good, through being used directly to serve Hashem. When a Yid devotes every minute of their lives to avodas Hashem, particularly through saying a l’shem yichud before performing any action – or otherwise a tefillah dedicating every thought, word, and deed to this purpose after waking up – then all the material brought into the body becomes expressed holiness and the Netzotzos HaKedoshim are elevated.
The Aish Kodesh of Piaseczna Hy’d speaks in Chovas HaTalmidim of converting wicked traits into positive traits. This general concept is also expressed in the Mishnah Torah of the Rambam, wherein he states that someone who is blood-thirsty should be a shochet, along with various other jobs someone with bad Middos should do to utilize them positively. This path in perfecting the Middos is wise for all who may have such traits that can be converted into a task related to a mitzvah.
Ultimately though, our avodah has to be focused on this at all times. The average person has days that are difficult, so instead of complaining we need to say “Boruch Hashem, the day was difficult.” This takes the “evil” of the day and turns it into “good,” since you took the experiences and thank Hashem for them. It says in Maseches Brochos that we have to bless Hashem for the bad just as we do for good things. Ultimately, we learn from Nochum Ish Gam-Zu and the understandings of Chassidus, that everything is truly for goodness; the only problem remains that we dwell in Olam HaAssiyah, in which we have the most Klippah and interference of the Sitra Achra to deal with. Even our long golus is good, since we can bring in more Geirim this way, and elevate all the lost holy sparks in a direct manner. With Hashem’s help we should all see how everything is good, even the worst things we’ve had to deal with, and we should see the ultimate goodness with the coming of Moshiach swiftly in our days.