I read of a modern experiment: two groups of children are given a task, and afterwards one is praised for how well/successfully they did it, and the other is praised for how much effort/attention they put into it. Then they're given another, more difficult task -- the children who were praised for their success would get discouraged and give up ("I can't succeed, so no point in trying"), and the children who were praised for their effort persevered.
Similarly it might be worth mentioning that Buddhism promotes "Right Effort".
According to the Vinaya, I think that most "failures" (to keep the rules) are considered "faults of confession" and so on -- i.e. a monk confesses the fault and then continues.
Another doctrine I learned of pre-school teachers, is that you should criticize or redirect bad behaviour, not condemn the child -- so you'd say, "You mustn't hit people when you're angry, use your words", and not say, "You're a bad boy (or bad girl)".
Similarly according to Buddhism it might help to not identify with failure -- say, "this is misbehaviour", not, "I am a failure", and not "this is my failure".
There's a sutta, AN 7.61 which lists about a dozen ways to overcome drowsiness, along the lines of, "Try this, maybe that'll work. And if that doesn't work? Then try this other method. (etc.)"
That reminds me of what medical doctors do, incidentally.
Another Buddhist doctrine is that things arise because of conditions -- so if you want to change what arises, perhaps change the conditions -- who you're with, where you are, and so on.
For example I avoid junk food by not buying it -- so it doesn't exist where I live, conditions don't exist for my being tempted by it. Perhaps to a similar effect, Buddhist doctrine recommends "seclusion". A social media web site might be harder to "cut off" if you have internet access at all for some reason, but you can (and I do) edit the computer's configuration so that it can't access certain web sites that I might otherwise use excessively (I do this by editing the "etc/hosts" file, you can also do it using "parental control" software).
Another useful technique might be substitution -- instead of trying to "eliminate" something harmful, try to replace it with something more beneficial.