Brooklyn man gets 18 years for nearly stabbing friend to death