The curious story of how a 13th-century Muslim refugee poet become the internet’s wiseman