Right now feels like an awfully scary time to buy stocks. High inflation and soaring interest rates are making it extra hard to predict the future. War in Europe at the tail end of a global pandemic isn't helping, either. 

With so many challenges to the global economy, another big market crash could be around the corner but that doesn't mean you should stop investing in the present. After all, we could also be at the beginning of a long recovery.

Warren Buffett.

Image source: The Motley Fool.

At times like these, it makes sense to learn from Warren Buffett. Shares of the holding company he manages, Berkshire Hathaway (BRK.A 1.57%) (BRK.B 1.42%), have increased at a compound annual growth rate of 19.75% since he took the helm 57 years ago.

These two businesses have attracted Buffett's attention recently. Here's why they could be great stocks for everyday investors, too.

Occidental Petroleum

Buffett and Berkshire began buying Occidental Petroleum (OXY 2.11%) shares a few years ago and boosted their stake in the oil and gas producer up to 20% in the second quarter. In August, Berkshire received a go-ahead from U.S. regulators to acquire up to half of the company.

Soaring oil and gas prices made this a banner year for Occidental Petroleum or just Oxy. Pre-tax income from its oil and gas segment surged 41% year over year to $4.1 billion. 

Buffett's more than likely drawn to the resilience of this company's bottom line. In addition to oil and gas production, Oxy has a strong chemicals business that benefits from lower input costs every time oil and gas prices fall. This is partly why the company is confident it can continue raising its dividend payout even if the global economy totally crashes and oil prices fall below $40 per barrel again.

Shares of Oxy currently offer a modest dividend yield of 0.8% because the company is more comfortable using the record-high profit generated this year to pay down debt and repurchase shares. With fewer shares outstanding, it will be even easier to raise dividend payments over the long run.

Ally Financial

Ally Financial (ALLY 1.75%) is an all-digital consumer bank that was once part of General Motors. It was also the largest stock purchase Berkshire made in the second quarter. Buffett's holding company bought 21 million shares of Ally in the second quarter, which more than tripled its stake in the bank.

As the former financial arm of one of the world's largest automakers, Ally has a big footprint in the lucrative market for automotive lending. In the second quarter, Ally originated $13.3 billion of auto loans from 3.3 million applications. It's been 16 years since the company saw that much volume.

At recent prices, shares of Ally offer a dividend yield of 3.5%, which is above average and could rise much further. Ally's average yield on retail auto loans worked out to 7.8% in the second quarter. It funds those loans with consumer bank deposits that totaled over $131 billion at the end of June. Ally savings accounts offer a yield of just 2%, so there's plenty of room for the bank to extract a profit.

Ally is the auto loan champion but it isn't a one-trick pony. The company also has a lucrative credit card business, with over 900,000 active cardholders. Ally has even dipped its toes in the home loan business, with around $900 million worth of mortgages originated in the second quarter. With low-interest consumer deposits to fund lucrative lending practices, there's a lot more room for this stock to run.