I created a simple Ruby library just about two weeks ago: https://github.com/yegor256/iri. I already have more than 60 GitHub stars there. How did I do that? I just published it where I usually publish my open source libraries. There is no secret. I just create them, publish and then some of them (!) become popular. You should do the same. Every time you see an opportunity to make a small piece of code open -- do it. And make them small. The smaller your open source products the easier they are to use and the higher the chance that they will be popular.
The video is here: https://youtu.be/jeflGHMpfDc