You can get consolation from your past only because you forget the pain more quickly than the beauty. You can look forward to the future only because you project the exciting moments rather than the boring ones (which will surely be more numerous). And the most relevant in the context of Hacker News: when you get enthousiastic about a project, you tend to grossly underestimate the time and effort it will cost to complete it. Had you been realistic at the outset, you might not have started at all.
Some of the happiest and most successful people rely on "never-ending optimism," which then fuels hard work thus creates success, confidence, happiness, etc. If you view the world in a negative light, the opposite is likely to happen.
Essentially, what it comes down to, is that you create your own reality. That is why I have a tough time believing the legitimacy of present day psychiatrists' prescription happy ways. Even if the conscious mind is cured through antidepressants, etc. there is still trouble boiling below.