Complementarily to the recommendations for coping with misery by enjoying the small pleasures, we can try to get out of misery. A major tool to reconcile sustained maximal pleasure as the goal with the actually available options is hedonic calculus. (Growing up as a weak and small guy in a working-class suburb with a construction worker who was an alcoholic as the father, I started off at the very opposite of the "opulent quarters" of the city, and so did Steve Jobs. I figured out hedonic calculus by myself and that helped me to get out of the misery.)
A slave in ancient Greece or in the United States in 19th century might have considered the following options:
1. Working hard to fulfill the master's orders to avoid the pain of corporal punishment and to eventually get freed as a reward.
2. Trying to escape to where conditions are better. (E.g. being a slave in Athens might have been better than to be a slave in Sparta; survival in hiding in a faraway wilderness might have been better than slavery under a cruel master, escaping to freedom in the North and possibly fighting as a Union soldier might have been worth the risk.)
3. Staying a slave because material security was assured under reasonably good circumstances. (E.g. after the rise of Rome and the end of Greek democracy, an educated Greek might have chosen to work as a slave to teach children of a wealthy Roman family.)
An employee in 2022 under miserable conditions might consider the following options:
1. Working hard, saving as much as possible and investing wisely to facilitate early retirement or to start a business.
2. Upgrading of education to qualify for promotion to a better position. (I took the opportunity to get as high an education as possible, which provided opportunities for pleasurable jobs. My sister worked for a bank after high school, quit to take care of her daughter, divorced and worked part time for a public institution, studied remotely for a university degree in her forties and then got the expected promotion to a full-time position which required the degree.)
3. Working for a different company or in a different industry.
Hard work is necessary for quite some years to get out of misery, meet demands of a spouse, provide a good education to the children and get a decent life. However, there is no point in working hard until retirement without much pleasure if then all we can still do is tottering around in an old peoples' home.