Web based, free, with the ability to add comments for context and organize into projects. For example I would track different code snippets relevant for different projects.
Obsidian (<a href="https://obsidian.md/" rel="nofollow">https://obsidian.md/</a>) might help you with that.
It uses Markdown and you can tag your coding snippets and make a knowledge graph (<a href="https://en.wikipedia.org/wiki/Knowledge_graph" rel="nofollow">https://en.wikipedia.org/wiki/Knowledge_graph</a>) out of it.
Github Gists are good. They are discoverable, can be made private or public. They can be forked, stared and linked too.<p>I've also been publishing "emerging tech" snippets on my blog. They appear on a carousel on the bottom of the home page. This is good to showcase expertise in a particular language or framework.<p><a href="https://thescottkrause.com/" rel="nofollow">https://thescottkrause.com/</a>
I can recommend Cockpit CMS if you want to build your own selfhosted knowledge base. Here is a great tutorial to get started:
<a href="https://willbrowning.me/category/cockpit/" rel="nofollow">https://willbrowning.me/category/cockpit/</a>