Definition of Hanmen Kyoushi
反面教師 (はんめん きょうし, hanmen kyoushi, 反面教员 in Chinese) is a Chinese/Japanese idiom that means “an example of bad people/things that you should not follow/imitate”. This word consists of two parts, 反面 (はんめん, hanmen) meaning “an opposite aspect/side” and 教師 (kyoushi) meaning “a teacher”. Therefore, it literally means “opposite-side teacher”, i.e. a “teacher” that (unintentionally) gives you a “lesson” of what not to do. For instance, if you see someone who is always all talk and no action, you may think of them as 反面教師 and try not to be like them. Not only does it describe people, but also a bad thing as well, as in “あの会社を反面教師とする ” meaning “I regard that company as 反面教師”. As in this sentence, it is often used as “~を反面教師とする”, meaning “regard ~ as 反面教師”.
Incidentally, the TV program called “しくじり先生 俺みたいになるな!!” has been very popular in Japan recently. In this TV show, a famous and successful person (e.g. comedian, celebrity, athlete) plays a role of 反面教師 and talks about his/her past しくじり (sikujiri, “silly mistakes/fiasco”) to gives a life lesson of what not to do in life.
It is said that this word was coined in the Chinese speech provided in 1957 by 毛沢東 (Mao Zedong), the founder of the People’s Republic of China.
Related Word: 人の振り見て我が振り直せ
人（ひと）の振（ふ）り見（み）て我（わ）が振（ふ）り直（なお）せ is a Japanese maxim that means “See how other (bad) people behave, and correct how you behave”. So it basically means that you should regard bad people around you as 反面教師, and reflect on your thoughts/behaviour.
あの国(くに)の今 (いま)の状況 (じょうきょう)を反面教師として、この国（くに）の政策（せいさく）を考（かんが）えるべきだ。
We should consider the current situation of the country as 反面教師, and reflect on the policy in this country.
My boss is always arrogant and irritating, so I see him as 反面教師 (a bad example not to follow) and I try to treat my kohai kindly
I regard him as 反面教師, and try not to do gambling.