As if internet is not already full of bad advice about software development, there are always people who will find a way to make situation worse.
Solving programming problems, might be very time consuming, and to waste your time even more, there are many spam websites, that just rehash Stack Overflow/GitHub issues.
Seems that Google can't (or won't) do anything about it. Situation got so bad, that for some queries you get only spam results, Google is unable to find original.
To save your time, you can use one of browser extensions that block certain sites from search results. But as I've mentioned previously, extensions are probably bad for you. Plus you need to configure and maintain the list.
As the simplest alternative, I suggest a block list (filter list). You probably already have a uBlock installed (or any other blocker compatible with AdBlock format). Or Vivaldi has built-in AdBlocker (Settings→Privacy→Tracker and ad blocking→Manage Sources->➕).
So, to get rid of search spam, ~subscribe to this list~.
UPD exactly at the same time I wrote this post, another filter list was featured on Hacker News. So I'm not the only one who is bothered by this problem. Since it gained more attention, please use it: