The homeless man was searching the NY city trashcans for soda cans he could trade for cash