howto.md

Docs

Satta is a powerful note taking tool that can help you capture and automate your ideas. This document goes over the technical details. The rest is left to your imagination…

Overview

Notes are organized as a tree similar to a filesystem. You can click on any file to open it.

Notes can be published under Views > Permissions. There are several ways a note can be viewed/rendered:

  1. Markdown. For publishing a web page like the one you are reading now.
  2. Raw. For using the note as raw text file.
  3. Code. For reading with syntax highlighting.
  4. Web app.

To make editing easier, you can select your familar keybind:

  1. Vim
  2. Emacs
  3. Visual Studio Code

Scripting

If a note ends with .py, it is treated as a Python script. Execute your scripts with Ctrl + B shortcut.

To install Python PyPI packages, specify it here:

Internally, Satta spins up a VM to execute the script in a sandboxed environment. And yes, your script will have access to the internet.

Here is an example: link

Scheduling

Scripts can be scheduled using crontabs.

The timezone of your browser is important because the hour field uses this info.

Programatically modify notes

You can read and write notes within a Python script. There are three built-in Python functions:

  1. get_note(name: str) -> str
  2. set_note(name: str, value: str)
  3. delete_note(name: str)

The name of the note is similar to a file path: path/to/file.txt.

This is useful persisting state across script executions:

prev = get_note("prev_balance")
curr = find_curr()
if curr < prev:
    alert("not found")

Web app

Satta parses your Python script to create a list of functions. Each function is turned into a button and its signature is used as the inputs.

Satta currently supports these are the Python types as parameters:

  1. str
  2. int
  3. float
  4. bool

On the web interface, once the user runs a function, a function call with the supplied arguments is appended temporarily to the end of your script.

The docstring for the file is parsed as Markdown and added to the webpage. Similarly the function docstring is added to the form. Each argument also has comments.

Here is an example: link

Private functions

Satta ignores functions whose names start with ‘_’(underline). These are treated as private functions and not exposed on the web app.

Sometimes, for testing, it is easier to write the logic outside functions. We can do that with

if __name__ == "__main__":

For web apps, the __name__ variable is set to something else so the block is ignored.