What would you do if you just got $1 million? That could be just a pleasant thought experiment. Or it might be a very real question if you work for one of the large tech companies that's about to have an IPO. Or if you're planning to sell a company you've founded or a home whose value has risen sharply in a hot real estate market

Just ask Jonathan DeYoe, a Bay Area financial adviser--and Buddhist--who's the author of Mindful Money. Many of DeYoe's clients are newly minted millionaires who've cashed in on their employers' IPOs. The Wall Street Journal made an entertaining video of DeYoe's advice to these newly wealthy techies. It's full of useful lessons for anyone who's just gotten a large sum of money--or who just wants to know what to do in case it ever happens. 

Here's what DeYoe tells his clients:

1. If you're rich in stock, sell half and keep half.

Many of today's new tech millionaires actually have $1 million worth of their company's stock. What should you do if that's you? Well, if you sell it all and the stock doubles in price over the next year or two, you'll be kicking yourself for having missed out on all that gain. On the other hand, if you hang onto the stock and the company tanks, you'll be kicking yourself for not cashing out when you had the chance. 

You can minimize the self-kicking, DeYoe says, by following what he calls an "idiot-proof" approach: Sell half of your stock and keep the rest. That way, whatever happens, you'll have benefited. Selling will, of course, have tax consequences, so make sure to plan for those.

2. Follow a financial plan.

If you don't have one, now is the time to get one--even if you aren't (yet) a millionaire. Use it for whatever cash you have to invest, and to make a plan for how you'll save and invest in the future. 

In an article on Business Insider, DeYoe recommends investing in a well-diversified portfolio and rebalancing those investments once a year. What is rebalancing? Let's say your plan calls for a 50-50 split of all your money between stocks and bonds. The market has done extremely well this year, and because of that, your stocks are now worth twice as much as they were a year ago. That's great, but it also means your portfolio's worth is now two-thirds stock and one-third bonds. So you sell about a quarter of your stock and invest that money into bonds, bringing you back to 50-50. 

Similarly, if the bond market had a very bad year and your bonds lost half their value, you would sell some stock and buy some bonds to bring the ratio back to 50-50. Among other benefits, rebalancing forces you to buy low and sell high, something every investor wants to do, but few actually manage to do.

Once you've got a financial plan in place, DeYoe says, you should follow through on that plan, even if the financial markets go way up or way down, as they inevitably will at some point.

3. Practice "stealth wealth."

You may want to buy a Tesla and a fancy new home. And, of course, if you want to, then you should. But DeYoe suggests being mindful of the huge and growing economic inequality in this nation. That might mean practicing inconspicuous consumption or "stealth wealth." 

You probably worked very hard to have all the money you do. But at the same time, you almost certainly benefited from some good luck as well. Maybe you were lucky to choose the right college major, or to be able to afford college at all. As DeYoe points out, the biggest winners in an IPO are the people who founded a company or joined one when it was still very small. If you did that, you lived through a time when the company's future was uncertain, and when you likely could have been earning more someplace else. But you must also know that things could have gone differently if the company hadn't gotten the funding it needed or the market for its product hadn't turned out to be what you expected. After all, the vast majority of VC-funded startups never earn much.

"You got really lucky," DeYoe says. "Other companies didn't get as lucky. Enjoy your success, but don't be a tool about it."

4. Give some away.

DeYoe recommends that his wealthy clients make sizable contributions to charity, or to a cause they feel passionate about. In his book, he also recommends donating time by volunteering for a good cause, as well as donating cash. This, he says, will make you happier. Admittedly, it sounds like very Buddhist advice. On the other hand, studies have shown that giving money away or spending it on others is one of the few ways wealth really can bring joy. So maybe there's something to this notion after all.