500 Lines or Less – Writing a useful program in fewer than 500 line code – AOSA

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • JetBrains Dev Survey - What’s up with the C++ ecosystem in 2023?
  • WorkOS - The modern API for authentication & user identity.
  • Onboard AI - ChatGPT with full context of any GitHub repo.
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • gifDisco

    It takes a png and builds a disco-gif version

    I could write a fairly useless program with nearly half the amount of lines!!:

    https://github.com/egeozcan/gifDisco

    Being able to write silly stuff because you can is immensely satisfying.

  • ioccc-obfuscated-c-contest

    IOCCC International Obfuscated C code contest entries

    For that you can go savor the archives of IOCCC : https://www.ioccc.org/

  • JetBrains Dev Survey

    What’s up with the C++ ecosystem in 2023? JetBrains Developer Ecosystem Survey 2023 has given us many interesting insights. The Embedded (37%) and Games (39%) industries are already working with C++20, developers are incorporating static analysis in their CI, and ChatGPT usage among coders is flourishing. Read on for more!

  • shite

    The little hot-reloadin' static site maker from shell.

    Bookmarked! These look like amazing study projects; the kind one can copy and learn from. Quite like how they do it in art school. Each one of them looks like it solves a nontrivial problem, and edifies the reader on the basic contours/tenets of the problem/solution space.

    I love this kind of stuff, because it shows one _can_ solve a pretty juicy problem with not that much code, honestly. Also because it suggests that the industrial-strength equivalent has a lot more in for use cases, corner cases, and/or optimisations that are not relevant for one's requirements (at least not yet, maybe not ever).

    I aspire to write code like that. Useful, concise, but not obtuse. Some of my code is not as significant as those examples, and maybe falls short of my ideals, but it gets a lot done in well under 500 loc. e.g. my website maker in Bash [1] (hot-builds and hot-refreshes without JS), or the JS that drives text art animations for Hanukkah of Data [2].

    [1] https://github.com/adityaathalye/shite is about 350 LoC counted this way (excluding the script containing HTML templates).

      $ grep -E -v "^$|\\s?#" bin/{events,metadata,templating,utils,hotreload}.sh | wc -l

  • scamp-cpu

    A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

    Re the text editor, when I was writing an editor for my homemade CPU I used the one from this tutorial: https://viewsourcecode.org/snaptoken/kilo/index.html - it is 1000 lines of C.

    I have diverged a bit from the tutorial because I didn't want syntax highlighting and I really wanted vi-style keybindings. Mine is at https://github.com/jes/scamp-cpu/blob/master/sys/kilo.sl (in my made-up programming language).

  • naiveproxy

    Make a fortune quietly

    What language is "Electron" written in and how many lines of it are used. Even more, what languages are Chromium brower engine and Node.js written in and how many lines of it are used.

    When we make assumptions, e.g., no need to initialise hardware, no need for bootcode, no need for bootloader, no need for drivers, no need for kernel, no need for operating system, and so on, then, IMHO, the comparisons do not make as much sense.

    Perhaps it is not "how you use them" but "what they can actually do". To me, getting a computer to boot is still an essential task. Building things "from the ground up" is still, to me, the path with fewer limitations and boundaries. As I understand it, building things from the ground up is how the creator of UNIX preferred to work.

    To be honest, IMO, it's really about "what you are trying to do". And the assumption in comments like these is that one is trying to do the exact same thing in (less than or equal to 500 lines of) language X, Y or Z. But what if one wants to do somehting different that no one has done before.

    When I was a kid, I faintly remember Lego sets that sometimes had pre-constructed "add-ons" with moving parts. These attachments might have even been motorised. Although such attachments might have had a Lego logo with a trademark symbol on them, making them appear to be part of a set, they did not really belong with the plastic building blocks. They were obviously not meant to be pulled apart and rebuilt.

    The pre-compiled "browser", a single large binary that does "everything its user could ever want to do" as determined by someone else, not the user, controlled and distributed by an advertising services company, is it a building block or one of those motorised add-ons. How many "developers" pull the browser apart and rebuild it.^1 It seems the advertising company is expecting most will not do that.

    1. One exception, which uses only the networking code, is https://github.com/klzgrad/naiveproxy/

    The "modern browser" is what could be many programs. Instead, these are all rolled into one.

  • WorkOS

    The modern API for authentication & user identity. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts