I spent several years working in research support roles at uni, and used code to automate the very boring parts of my job. Then thanks to open source activity I got into as part of that, I wrote a book. This was a bit under 10 years ago, I'm not sure there's the market in book writing these days.
What book did you write?
[1] http://modernperlbooks.com/books/modern_perl_2016/ - not my book, mine was more specialised, and I'm not going to transparently disclose my identity here :).