While sometimes leading to interesting and unexpected insights, the net can also be a constant stream of distractions. More than once have I found myself switching to the browser when presented with a difficult programming challenge, not to do research but to procrastinate by seeing what the rest of the world is up to. Because if the solution to your bug is just a Google Search away, so is Reddit, YouTube or HackerNews.
The modern programming environment is typically focused on an online-first experience, with central package registries, online package documentation, GitHub codespaces and of course StackOverflow. In this article, we will explore how to keep the stuff that makes you productive right on your hard drive, so you can cut the cord to all distractions.
StackOverflow is inarguably one of the most precious resources available to programmers. Fortunately, the folks over at kiwix.org have been working hard to make it accessible offline. They use the ZIM file format (not to be confused with a desktop wiki of the same name) which uses Zstandard compression and supports full-text search. You can see the official archives in their wiki page, the whole of StackOverflow (last archived in May 2022) is about 80 GB large. Please consider using a BitTorrent client for the download to share some of your bandwidth with other users. Since StackOverflow’s content is licensed under a Creative Commons license, you will not run into any legal troubles, contrary to some other files that are typically distributed over BitTorrent. To open the ZIM files, you can use the Kiwix Desktop Application.
Now, a desktop application is all fine and dandy, but if you have come to enjoy a keyboard controlled workflow like I have, moving the mouse a lot won’t cut it. To access Wikipedia and StackOverflow from the command line, I use
kiwix-serve -p 8081 Misc/Kiwix/*.zim (
kiwix-serve is packaged as
kiwix-tools in Ubuntu) to start a web server. Then, I either use firefox with VIM keybindings enabled or two wrapper scripts, which allow access through w3m, a text-based web browser.
While Kiwix packages mostly wiki-like projects, Dash and its open-source Windows/Linux port Zeal focus on producing so-called docsets, a copy of language or framework documentation webpages. Currently, they have about 208 pre-packaged docsets, you can check out the list on their official homepage.
Once again, Zeal is a GUI application with nice addon support for all kinds of IDEs. A small wrapper script (available on Gogs, GitHub) takes care of querying the integrated SQLite database and piping the results into fzf, a fuzzy finder. I was really fascinated by the versatility and scriptability of fzf, it allows you to execute shell scripts to produce results as you type. Here it is in action:
In my opinion, storing huge files like the whole of Wikipedia on disk and querying them from the terminal explores an interesting niche of computing, where we utilize the enormous growth in storage capacity, but for the most part ignore growth in computing power and display quality. Besides reducing the risk of distractions, it is also beneficial when programming on a laptop, since there may not always be internet available when on the go. There still is room for ergonomic improvement: the HTML rendering of w3m could have better readability and the scripts could be integrated into editors (such as vim).