TL;DR: Small victories are more precious when you have nothing. Instead of burning through my savings, I'm now adding to it. The relief is priceless.

It is worth it (for me)πŸ”—

The section title is my response to this article Writing a book: is it worth it? that I saw on Hacker News.

For my unique circumstances, the decision to write ebooks has brought me financial stability, improved my mental health and gives me a sense of satisfaction. This could've come from any of my previous attempts to earn money, but ebooks is what worked out for me.

Book writing

Photo by Bram Naus on Unsplash

How it all started?πŸ”—

I left my job in 2014 for various reasons. I didn't have any plans for the future, just knew that I couldn't work as an employee any more.

After enjoying my break, I had to try something to start earning again. I wrote an android gaming app, fantasized earning loads of money with an awesome work planner/communicator software that never left my imaginations, tried a small stint with a team making an educational app, etc. I failed due to various reasons β€” didn't try hard enough, quit early, didn't fit my skills, wasn't good at design/marketing and so on. The educational app for example went on to become a success. Or perhaps, having saved enough to live out a few years without working meant I wasn't under enough pressure to earn.

Among these failures, college workshops was the sole bread giver (and long way from supporting my modest living costs). My bachelor's degree was in electronics and communications and I had worked in a semiconductor company. So I knew enough to teach students pursuing similar courses the basics for Linux command line, Vim, Perl, Bash scripting, etc. As reference materials, I used to provide ppt slides (when I still had a job). Now that I had loads of free time, I started expanding my knowledge. Came to know about sites like Stackoverflow/Stackexchange/Reddit/etc. With newer and better materials to learn from, I created PDFs (using LibreOffice, which was pretty much the only option I knew about).

Another loss maker was getting a domain/host to share these learning materials. Web development was too much for me and the (ugly) site didn't get any love. In hindsight, one of the better turning points was learning about GitHub in 2016. I loved markdown's nice output with syntax highlighting (and realized I was using it poorly in Reddit) and GitHub's social aspect (stars, issues, etc) β€” plus I can use Vim! I manually converted my materials from LibreOffice to markdown (again, I didn't know that tools like pandoc could've helped me). Just like any other skill, I was learning and getting better with every iteration. That was the year I learned Python (thanks to Al Sweigart's free coupon for "Automate the Boring Stuff with Python" video course) and started conducting workshops for Python instead of Perl.

Being active on Stackoverflow and Reddit, I finally became proficient at CLI one-liners (late by 8 years, since it would have significantly helped in my role as a design and test engineer). I came across articles/books on regular expressions and one-liners. I thought β€” I can do that too, plus I was really liking them. Thus began my epic Command Line Text Processing repo, another big turning point in my journey as an author.

Encouraging signsπŸ”—

Over the course of ten months, I managed to complete the holy trinity of grep, sed and awk one-liners. I promoted these tutorials on Reddit, Google+, LinkedIn and other social sites I knew at that time. The repo got hundreds of stars and more importantly, I got critical feedback. I was ecstatic, even if I was continuing to burn through my savings.

Then, I got to know about Hacker News (I think it was someone bragging about reaching front page). It took me a while to get used to Reddit, and HN was similarly alien to me. I posted a few links as a test and then I was brave enough to submit my awk one-liners post. I was refreshing HN anxiously for about half an hour or so. It got one vote and then other submissions pushed it away from new posts tab. Disappointed, I moved on. After sometime, I was checking traffic on my GitHub repo as usual, a habit I had picked up (all kinds of points, karma, likes, etc were so enticing). I noticed a HUGE spike in traffic and star count, the likes of which I had never seen before/since. The last time I had felt that proud of my work was during my job. This comment made a big impression on me:

These are the best stories on HN and why i subscribed here in the first place. I have often seen awk used so many times on SO but I've always put it up for something later to learn. Finally today I have some basic understanding of awk and this is really great stuff! I did get by with Perl but this is definitely more handy and the example approach to teaching it makes is super easy to understand!

After the euphoria had died down (about a week I guess), I was thinking about all the various kinds of posts I could make. And I was thinking how to use the repo popularity to bring in money. Long story short, I ended up adding donate buttons to my repos. This was before GitHub sponsors was announced. I wanted my materials to be freely available, so I wasn't even thinking about creating paid only options. Despite adding more tutorials, getting featured in rubyweekly and other newsletters, social sites, etc, all I got was a single recurring donation (which ended prematurely when that platform switched payment set up).

Another turning point came when a friend of mine was authoring a book and referred me for the reviewer role. Around that time, I had been converting Think Python to Think Ruby and simultaneously working on a separate Ruby tutorial. During the book review process, I was given a list of topics and asked if I was interested in writing a book (they were impressed by my existing repos). The topics were either beyond my knowledge or out of scope, and they weren't interested in the repos I had already put up.

My friends were always suggesting me to write a book and my reply consistently had been that I wasn't good enough to write one (the imposter syndrome hasn't left me even now). The book review experience, existing repos, my tryst with Think Ruby, dwindling savings, etc changed my mindset enough to try. By then I was already familiar with Leanpub, so I knew self-publishing was an option. I picked a niche topic (Ruby Regexp), learned enough pandoc to produce a PDF and published it even before the book review ended. It helped that I already had material as part of the Ruby tutorial I was working on. I still had to work a lot, since tutorial description was all bullet points.

I got only a few sales, but I had landed another review (video course for the same book) and was getting paid. So, I converted 'Ruby Regexp' to Python re(gex)?. I made it free for a few days and posted on Reddit, HN and other social sites. HN submission didn't get any traction, but fortunately Reddit submission on /r/Python/ was a big hit β€” thousands of free downloads and a few paid ones enough to cover 2 months of my expenses. I should mention now that I live alone, in outskirts of an Indian city, and my modest lifestyle costs about $150 per month. What works for me won't necessarily suit others.

A dip followed by sustainable momentumπŸ”—

Encouraged by the second release, I changed my focus from updating my GitHub repos to writing books. All those repos were now a fodder for book conversion. I picked up grep first and included ripgrep as well to keep it inline with the trend. Got decent sales from free promotions. HN submission tanked at first, but got good attention when I posted again after a revision. Then I published a new version of 'Python re(gex)?' with significant changes and this HN submission got good views too. But note that these HN hits weren't anywhere close to what my awk one-liners post had received.

Writing sed took a lot out of me. Probably I was getting jaded again, juggling between workshops and ebooks. Then I had a medical issue. I didn't even try promoting the sed book on HN. I managed to learn enough JS to write JavaScript regexp. Wasn't anywhere close to what I got from the Python book.

Roller Coaster

Photo by David TraΓ±a on Unsplash

So, despite reasonable reception during free promotions, my ebooks weren't still good enough to consistently pay my bills. Combined with workshops I was just about making my ends meet. I was losing interest and the medical issue was continuing. Still, without anything else to do, I finally started a book on awk one-liners. Things started getting better for a few months and then the pandemic hit.

Given the recent medical scare, pandemic fears and the trend of giveaways, I decided to open source my book contents. And, I made all my ebooks free to download indefinitely. Made a single bundle of all the 5 books I had published until then to make it easier to download in one shot. The reception was better than expected. Shortly after (last week of March), I published the awk book early by cutting corners like excluding exercises. All books bundle now had 6 entries. Again, the reception was much better than expected. I hadn't made so many paid sales during a month ever before.

Encouraged by the success, I made another important decision. Instead of starting another book, I took up the task of updating all my books. I alloted a month or two for this task, but it took me more than 4 months in the end. It wasn't that I had lot of new features to add. The feedback I had received over the past year and my own improving writing skills meant that I just couldn't help updating the books to the best of my abilities. Somehow, lockdown and fear of the pandemic ended up improving my workflow.

Workshops weren't going to come my way anytime soon, but ebook sales for about 6 months averaged $200+ per month. For the first time since leaving my job, I was saving money!!! During this period all my books were free to download, in addition to the markdown source being available from GitHub repos. I even managed to create EPUB and web versions for my ebooks. The web version generated using mdBook was much better than my attempts with wordpress all those years ago, but to be fair I hadn't known enough about formatting for coding books.

After finishing this marathon revision task, I reverted PDF/EPUB versions to be a paid option again. Since then, I've managed to write three more books. I did Perl and Ruby one-liners (as part of the ongoing conversion of the CLI text processing repo) despite knowing sales won't be good enough to keep up the momentum. Then I wrote a Python intro book for those already familiar with programming basics. Published last month, sales are much lesser than I expected. Given Python is now 30 years old and there's no shortage of Python books for beginners, I shouldn't be surprised though. I'm probably grumpy because it took a month more than expected even though I already had decent material from my workshops. Anyway, my main motivation was to improve my Python knowledge and it did serve that purpose. As a bonus, I just got started with workshops again, conducted online (a first for me). The book is already proving useful as a handy reference for me as well as the students.

Feedback and CriticismπŸ”—

Here's some of the feedback I've received over the past two years.

  • Grammatical mistakes. Missing a, an and the articles were particularly jarring for the readers. If you couldn't tell from reading this article (heh) that English isn't my native language, I'll consider that I've improved a lot.
  • Some readers stated that they didn't bother checking out my books because the covers are so bad. I finally got a cover done by an artist for the Python intro book.
  • For the regexp books, a few readers said my introductions were light on content. So during the marathon book updates I did last year, I managed to add more details. I feel there's still plenty of room for improvement.
  • My comprehension is kinda average and it works better whenever I manage to create code snippets to prove or disprove my understanding. So, my books are heavily example oriented. I've received feedback that there are too many examples, explanations aren't sufficient, etc. I'm trying to improve on this count, but I doubt I can change my natural writing style.
  • A few readers wanted more exercises, which I was happy to oblige. It took me a while to accept that I should provide solutions as well.

I did get a few negative feedback (ones I consider weren't constructive in nature). One such feedback affected me a lot, despite the encouraging sales for the second book. Over time, I've adapted but I'm still afraid of seeing one whenever I promote my books.

Self publishing experienceπŸ”—

I don't have a personal experience with traditional publishing (other than the two review opportunities). After the initial success of 'Python re(gex)?' book, I was happy to stay being self published. When there was a dip, I did consider it would be nice to have the backing of a traditional publisher and a chance to improve the contents of my books.

What I like about self published:

  • I can give away free copies whenever I want, change pricing, share the source code, put up free web version of the books, etc.
    • I'm aware of a few publishers allowing authors to put up free web copies, but it isn't universal.
  • I can push updates easily and inform the readers as well.
  • No deadlines, other than self imposed ones. This is both good and bad. The good thing is that I can take my time. The bad thing is that the reduced pressure leads to longer schedule. I spend a lot of time on social media, reading fiction, watching entertainment, etc. The lockdown marathon did improve my average working hours, but there's still a lot of room for improvement.
  • I am not restricted by guidelines set by a publisher regarding chapter structure, images, exercises, etc.

What I feel would improve with traditional publishing:

  • Cover image
  • PDF/EPUB quality
  • Content quality, especially grammar
  • Audience reach

Not sure how my earnings would be affected. On the one hand, I get minimum 80% on book sales. On the other hand, I'd probably reach a wider audience with traditional publishing. I did receive a few offers when my promotional posts were trending. One of the offer (for 'Python re(gex)?' ebook) had a joining bonus and initial advance β€” both combined was less than what I had already earned. But if they had extended the offer for other books as well, it would've been a much more tempting deal.

Currently, I'm happy with status quo. Always free web versions and free PDF/EPUB promotional sales kinda solves my donation problem before I started selling ebooks β€” I get paid and readers have a way to get the materials for free. I'm also inspired by FOSS products I use and authors like Al Sweigart and Allen B. Downey who give away quality learning resources for free.

That said, I wish I could improve my marketing skills. Or, somehow someone likes my books so much that their review attracts significant attention and my sales increase as a result. I've also considered trying out affiliates, but haven't even created a list of people to contact yet. I don't have analytics set up on Leanpub, my blog, web versions of my books, etc. Based on analytics that is available by default on GitHub and Gumroad, I do see a few links from schools and universities. I wish they would contact me, so that I can help if needed and improve my book contents based on their experiences.

Leanpub vs GumroadπŸ”—

I started with Leanpub since I had seen a few posts from self published authors using this platform. By the time I had published the second book I got to know about Gumroad and was attracted by the pricing/payout structure. From then on, I have published on both platforms.

Here's what I like most about both these platforms:

  • I can change pricing (including free option) and book contents any number of times
  • I can allow users to pay more than the product price, which is how I get paid during free promotional sales
  • I can inform readers whenever I update my books
  • I can create bundles
  • They handle collection of VAT (and other such fees)
  • Their payout options work for me in India

Here's some differences and my opinions on some of their features:

  • Gumroad's pricing structure is better. If you have a following like Julia Evans, pricing would make a huge difference
  • Gumroad gives analytics for free
  • Gumroad's email notification is opt-out compared to opt-in for Leanpub. Opt-in is better for readers, but in my experience less than 10% sign up and thus miss out when I want to send them book updates
  • Leanpub payout delay is 45-75 days, Gumroad is 7-14 days (or instant in some cases)
  • Leanpub's bundle feature is better since it doesn't require a new cover and files are automatically picked based on the links provided. In Gumroad, it is essentially a new product, but it does allow to manually pick files from existing ones. Also, Leanpub allows bundling with another author (which I have used and given me decent sales)
  • Leanpub's product page and UI is better. The sliding scale (along with information on author's share) to pick a price is clearer than Gumroad's manual price entry. And I don't like that Gumroad places the minimum price information away from the box where the user enters a price. On Leanpub, all of these are shown together and reduces confusion
  • Leanpub's product page has always ranked higher in search results in my experience
  • Leanpub's 45-day Guarantee and Sample chapters as part of the product page makes it easier for readers to take a risk
  • Leanpub has weekly/monthly sale newsletters in which you could get featured. This has brought me significant earnings in the past few months. If you enable an option, Gumroad would promote your product too (for 10% extra fee) but this has given me very few sales compared to Leanpub's newsletter

Pricing UI on Leanpub

Pricing UI on Leanpub

Pricing UI on Gumroad

Pricing UI on Gumroad

pandoc and mdbookπŸ”—

I picked pandoc to generate PDF from GitHub style markdown, as it seemed the most popular tool for this purpose. The default output is good enough, but I wanted to customize a lot of things. With help from documentation and various Stackoverflow/Stackexchange threads, I was able to generate an output to my liking. I didn't know about templates though, otherwise I could have researched about them and re-used solutions from others. I wrote a blog post about my learnings, visit Customizing pandoc to generate beautiful pdf and epub from markdown if you are interested.

Some readers wanted EPUB versions too. I thought it made sense for reading from mobile, but my own experience with this format on desktop was quite disappointing. Only later did I learn that I wasn't using a proper EPUB reader for technical books. Which is why I didn't realize that the default output from pandoc for EPUB was also good enough. During the revision marathon, I finally created EPUB versions too. I'd say I am still a beginner, but I did learn enough CSS and LaTeX to customize EPUB and PDF generation with pandoc.

pandoc has its own enhanced version of markdown, which has a lot of nifty features for ebooks. But I chose to stick with GitHub style markdown. And it came in handy when I wanted to re-use book material for blog posts, generating web versions of the book with mdbook and so on. After I had decided to open source my books, I also wanted to make a web version that feels like a book instead of just the single page markdown source from the GitHub repos. I would've probably used Gitbook if they hadn't moved away from the legacy version. I came across mdbook as an alternate for Gitbook and I'm glad I did.

Future plansπŸ”—

I have certainly improved a lot as a writer since I first published my book in late 2018. But after 9 books, I'm finding it a lot more difficult to motivate myself to keep writing. See also HN discussion: Writing a book, still the same pain 15 years later for another example.

I have plans to publish at least one more book in 2021 and revise my existing books (not comprehensive, but a few items have cropped up). I hope the current momentum can extend enough to cover my expenses for this year at least. Beyond that, I think I will write more books, but I'll have to mix it up with other things (such as video courses, interactive courses, freelancing, etc) to keep myself motivated. I just hope that this time I will be able to pick an alternative quickly.


I've been asked a few times regarding my experiences as an author (especially self publishing) and resources I've used. That was my primary intention in writing this blog post. I thought I'd add a bit of background as well, not the multi-section essay I ended up with. Anyway, here's some links that I've bookmarked related to book writing.

Authors sharing their experiences

Writing skills

Tools and Miscellaneous

A parting adviceπŸ”—

Don't quit easily!