Zum Inhalt

Numbat

Blog --- Numbat


Created: 2024-02-21

Numbat - a statically typed programming language for scientific computations with first class support for physical dimensions and units

Usecase

I often have to deal with calculations of times and conversions. In the past I often used spreadsheet software to do it.

At some point I started writing my own little scripts for these purposes.

For several years I have therefore used some self-written Python (2 and 3) scripts. These worked on my computer :) However, when sharing these tools within the projects, there were often difficulties (no Python installed, "wrong" Python version, missing dependencies, no venv, unexperienced users, etc.).

Some time ago I started to port some of these tools to Golang. One program for exactly one task. As a binary, the transfer to projects members was usually a breeze. Apart from some false positives from virus scanners that occurred from time to time on Windows machines.

Background

At some point while browsing through the Github repository of sharkdp whose tools, especially fd, I can only recommend to everyone, I found insect. I played around with it and after running into a dead end I opened an issue. Two days ago I got an answer that the issue is solved and the tool can now do exactly what I was looking for.

The solution to some of my problems is now called numbat. Numbat is the follow up projects of insect.

For some features I have to wait for the next release but the online version of numbat already offers what I need.

I have already replaced some of my self-written tools. With the next release of numbat I will replace some more of my scripts, especially the Python scripts. Numbat offers also a great documentation.

I can only recommend numbat to anyone who has to do with the calculation of data.

Examples

numbat -e "100 CHF -> EUR"
numbat -e "323 km/h -> mph"
numbat -e "195 mph -> km/h"
numbat -e "human(1.25 minute)"
numbat -e "now() + 10 days"
numbat -e "date(\"2024-11-01\") - today() -> days"
numbat -e "date(\"2024-04-26\") - date(\"2024-02-15\") -> days"
numbat -e "now() -> unixtime"

Note

Numbat is now official added to my day-to-day must have toolbelt, which already includes:

  • vim
  • rg
  • fd
  • fzf
  • lazygit
  • lsd
  • pandoc
  • imagemagick
  • plantuml
  • miller
  • xsv
  • sfk
  • FFmpeg
  • a bunch self written of still Python scripts, some AHK scripts, some CMD/BAT scripts and more and more Golang programs.
  • some more tools I don't use on a daily base or running my backbone without notice can be find here https://duetsch.info/essential-tools.html