Infinite-precision desktop calculator app in ~50 lines of Python. No other dependencies—all the features. 🙌
Made as a dead-simple wrapper around Python that preimports stuff from its math and statistics modules (including numpy, if available) before dropping into the familiar REPL.
This replaces the functionality of several modern command-driven scientific calculators, as available e.g. in Debian, at less than half the source code lines spent! YMMV
Download the script and put it somewhere on $PATH:
curl -vL 'https://bit.ly/pycalc-ng' | sudo tee /usr/local/bin/pycalc sudo chmod +x /usr/local/bin/pycalc # Mark it executableMake sure Python 3 is available:
sudo apt install python3A terminal emulator (xterm from x11-utils (recommended), gnome-terminal or konsole) serves as a simple GUI:
sudo apt install x11-utilsIf you use a tiling window manager, like i3, awesome, xmonad or dwm, additional utilities xprop and xdotool are required to make the app window dialog-like (floating):
sudo apt install x11-utils xdotoolIf you prefer a more full-featured Python REPL, such as ptpython or ipython3 with syntax highlighting and Tab-based autocompletion, those are automatically used if found!
sudo apt install ptpython # or ipython3Simple invocation should spawn a new app window:
$ pycalc... in which you can type your fancy equations:
>>> 1+1 2 Supports variable assignment just like Python does. Etc. 😋