これやってみた?
https://gist.github.com/CRC32EX/06d8d0ad7543ccb3f1af92d6cfa98358