using fork()
and pipe()
: https://www.cs.dartmouth.edu/~doug/sieve/sieve.pdf
in C using tasks and channels: https://swtch.com/libtask
in Lua using tasks and channels: https://github.com/majek/lua-channels/blob/master/examples/sieve.lua
in Python using a more efficient but less interesting algo because Python lacks full coroutines: https://github.com/majek/lua-channels/blob/master/examples/sieve.lua
It might be fun to try this in Wireworld.
One thing Zettelkasten and Roam provide that my system of text files doesn't is the ability to hyperlink to an arbitrary line in any file in the corpus. I don't think Org-mode has that either.
Line numbers break if I go back and edit above them. I could maintain a table of line hashes somewhere, but that'll get thrown off by small changes to the line, or even reformatting a paragraph.
Idea: just pick the first letter of each word.
Here's how you turn a line of text into an id:
$ echo ' The quick brown fox jumped over' | sed 's/^\s*//' | sed 's/\([^ ]\)[^ ]* */\1/g'
Tqbfjo
And here's how you search for the file containing a given id:
$ grep "$(echo Tqbfjo |sed 's/./\\<&.*/g')" . -rl
If the line gets reformatted and the line gets split between two others, just search for prefixes or suffixes of the id.
As a fork of Lua, Teliva has always had a copy of the Lua manual. I finally brought it up to date.
https://akkartik.github.io/teliva/doc/manual.html
Sections for capabilities Teliva takes away (mostly the C API which compromises sandboxing) are deleted. New sections are highlighted in magenta.
The table of contents should give a sense of the new parts.
In particular I'm kinda proud of Teliva's new File I/O primitives
Apps ship with source. To let you run without reading the source, apps run without any privileges by default. No files, no network.
You can grant broad privileges to a single function after reading just its source.
The issue: functions can be over-ridden, so you end up accidentally granting privileges to malicious nooks and crannies.
I need to go back to app-level permissions. Grant narrow privileges to the whole app, without regard to what function uses them.
A concrete use case for permissions by caller (now removed from Teliva)
By its nature, a file browser can list directory contents and open files all over the computer. How could we convince ourselves that it's only using these privileges to meet our requests?
My old solution: app is written in such a way that someone can grant these privileges to a single function after convincing themselves it opens a single file/directory every time the Enter key is pressed.
Now I need something new..
"Part 2 is tricky. The first output value 'cdfgba' could be either a 0, 6, or 9. To figure out which one it is I could do some fancy constraint satisfaction. That sounds hard. Or I could exhaustively try all permutations of the 7 letters. That sounds easy! Here's my plan.."
Most apps use width poorly, with lots of empty space towards the right.
Long lines of text are also less readable.
So more apps should be using some sort of column layout when the window is wide.
However, narrow columns magnify a different problem: urls can't be clicked on if they span multiple lines.
One possible solution: an escape sequence to hyperlink to urls in shorter text. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda lists terminals supporting it. Does your terminal?
git clone https://github.com/akkartik/teliva cd teliva make src/teliva anagrams.tlv
https://github.com/akkartik/teliva#who-are-we-trusting-by-trusting-you
Small change in text: https://github.com/akkartik/teliva/commit/b36927e35cd26
But a big step in a huge trajectory of maturing thinking.
2010: Dependencies are moving parts, introduce unreliability.
2015: Well, we have to depend on something. Ok, hardware only.
2021: Firmware, management engines, shit, I'll come again. Depend on a narrow waist. Posix, C, Lua.
2022: There's even more I can't do alone. Sqlite, Redis, etc. Reputation is a useful signal.
https://archive.org/details/akkartik-teliva-2022-02-10 (4 minutes)
Showing off:
- Protections against malicious apps.
- Incrementally learning about app internals.
- How avoiding abstractions can make an app easier to secure. Audit a single function, safely ignore its function calls.
- Running on OpenBSD thanks to https://tilde.institute
Main project page: https://github.com/akkartik/teliva
Open invitation: I'd be happy to tailor a private copy for your individual needs.
Starting to use my Zettelkasten app for reals
In this clip:
- Growing cards for more details and shrinking them down to outline view (no collapsing subtrees, though)
- Structured navigation to children/parents/siblings.