Man repels charging bear with technique learned from birds