Skip to main content

New top story on Hacker News: Show HN: Jesth – Next-level human-readable data serialization format

Show HN: Jesth – Next-level human-readable data serialization format
3 by alexrustic | 2 comments on Hacker News.
Hi HN ! I'm Alex, a tech enthusiast. I'm excited to show you Jesth, a next-level human-readable data serialization format. This project started out as a markup language for writing the docstrings of functions that would ultimately be consumed by a documentation generator. Basically the idea was to split a docstring into sections like Description and Parameters. Each section would consist of a header in square brackets and a body (lines of text between two headers). Here's what a docstring for a sum function would look like: This function takes in two integers a and b and returns their sum. [parameters] - a: First integer - b: Second integer [return] Sum of a and b The Description section in the example above is actually an anonymous section, i.e., a section with an empty header. Meanwhile, I was thinking of a way to automate part of my dev workflow by storing in a file commands grouped into tasks such as project creation, build, testing, release, et cetera. Similarly with the markup language for my documentation generator, I would use square brackets to define the tasks. Thus, a task would consist of a header and a body which would be a list of commands to be executed sequentially. I built this project and named it Backstage. Here is a hypothetical backstage.tasks file: [release] & test & generate_doc & git_stuff & build # upload to PyPI $ twine upload --skip-existing dist/* [git_stuff] $ git add . $ git commit -m {message} $ git push origin master The example above is illustrative only and would not work. It contains 2 sections "release" and "git_stuff". Running the "release" task from the command line is equivalent to sequentially executing the commands in the "release" section. The documentation generator and the scripting language, despite the obvious similarity in their formats, did not share any parsing code. So, to stop repeating myself, I created a file format and its library named Jesth which stands for "Just Extract Sections Then Hack". The library acts as an incomplete INI file parser that only hands the programmer the sections (as headers and their associated bodies which are lists of strings). No further interpretation of the data is done by the parser, allowing the programmer to unleash their creativity through useful hacks. In its latest iteration, Jesth has matured and also includes a proper and extensively tested hack to convert a compatible section into a dictionary data structure, making Jesth my de facto preferred format for config files. I find Jesth more readable than TOML, YAML, and JSON. Here, encoding a dictionary data structure in its own section with another section containing a prompt for ChatGPT: [prompt] I want you to act as a detective story writer. I will provide you with two dictionary data structures representing the profiles of two people. Your goal is to write a thrilling neo-noir story. My first request is: "guess who the killer and victim is from the profiles, then build a story that includes every detail of the profiles". [profile] # This section can be converted into a dictionary data structure name = 'Jane Doe' birthday = 2000-12-23Z10:17:37Z photo_jpg = (bin) VGhpcyBpcyBub3QgYSBwaG90by4uLiBCdXQgdGhhbmsgeW91 IGZvciB5b3VyIGludGVsbGVjdHVhbCBjdXJpb3NpdHkgOyk= --- books = (dict) romance = (list) 'Happy Place' 'Romantic Comedy' sci-fi = (list) 'Dune' 'Neuromancer' epitaph = (text) According to the law of conservation of energy, no a bit of you is gone; you are just less orderly. --- [profile] name = 'John Doe' birthday = null books = (list) 'American Predator' 'Mindhunter: Inside the FBI's Elite Serial Crime Unit' You can learn more by reading the project's README and playing with the demo. Let me know what you think of this project.

Comments

Popular posts from this blog

New top story on Hacker News: Tell HN: I think I found Toyota's battery

Tell HN: I think I found Toyota's battery 173 by scythe | 29 comments on Hacker News. Recently there was a thread about a "breakthrough" in battery technology at Toyota. https://ift.tt/nUtv4yY Toyota has been putting out PR puff pieces about their "solid-state" (solid-electrolyte) batteries for years, but this story was unique in that it had a quote from Keiji Kaita, who holds some high-level role at Toyota. Anyway, I didn't think much of it, because there was no paper referenced in the Guardian article, which seemed to be the original source. But while reading about something else, I came across the paper "A near dimensionally invariable high-capacity positive electrode material", published in Nature Materials last December: https://ift.tt/24ZXPy5 This paper, reporting a cathode that has very little (much less than normal) change in size or shape when charged and discharged, claims reversible storage with a solid electrolyte. It stands to reaso...

New top story on Hacker News: Show HN: Neucards – Privacy based digital contact card

Show HN: Neucards – Privacy based digital contact card 7 by bdominy | 1 comments on Hacker News. Neucards is an end-to-end encrypted contact information sharing and updating iOS app that protects your identity while letting you keep in touch with people. I started working on neucards as a side project more than ten years ago, and I decided three years ago to go full-time and try to build a community around it. There are two major problems that neucards addresses. First, most people end up with contact lists that are hopelessly out of date. Over time, people move, change jobs, or add social profiles and unless they tell you, chances are you could lose touch. Second, your contact information ends up in the wrong hands. There has been a huge increase in robocalls, unsolicited emails, data breaches, and online scams that is driven by accessing a person's contact info. Even worse, with AI now being able to imitate a person's voice or other mannerisms, knowledge about the connecti...