All Projects → alt-romes → Programmer Calculator

alt-romes / Programmer Calculator

Licence: gpl-3.0
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Programmer Calculator

Neix
neix - a RSS/Atom feed reader for your terminal.
Stars: ✭ 128 (-5.19%)
Mutual labels:  cli, terminal, ncurses
Mandown
man-page inspired Markdown viewer
Stars: ✭ 173 (+28.15%)
Mutual labels:  cli, terminal, ncurses
Nnn
n³ The unorthodox terminal file manager
Stars: ✭ 13,138 (+9631.85%)
Mutual labels:  cli, terminal, ncurses
Goaccess
GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
Stars: ✭ 14,096 (+10341.48%)
Mutual labels:  cli, terminal, ncurses
Spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators.
Stars: ✭ 1,637 (+1112.59%)
Mutual labels:  cli, terminal
Unix Permissions
Swiss Army knife for Unix permissions
Stars: ✭ 106 (-21.48%)
Mutual labels:  cli, terminal
Httpcat
httpcat is a simple utility for constructing raw HTTP requests on the command line.
Stars: ✭ 109 (-19.26%)
Mutual labels:  cli, terminal
Openterm
OpenTerm is a sandboxed command line interface for iOS.
Stars: ✭ 1,504 (+1014.07%)
Mutual labels:  cli, terminal
Gql
Very simple CLI for many GraphQL schemas in the cloud. Provides autocompletion for GraphQL queries
Stars: ✭ 101 (-25.19%)
Mutual labels:  cli, terminal
Switch Php
Easily switch between PHP versions on your Mac. Requires Homebrew and works with Laravel Valet. 🔀
Stars: ✭ 110 (-18.52%)
Mutual labels:  cli, terminal
Termy
A terminal with autocomplete
Stars: ✭ 112 (-17.04%)
Mutual labels:  cli, terminal
Nord Termite
An arctic, north-bluish clean and elegant Termite color theme.
Stars: ✭ 104 (-22.96%)
Mutual labels:  cli, terminal
Cordless
The Discord terminal client you never knew you wanted.
Stars: ✭ 1,391 (+930.37%)
Mutual labels:  cli, terminal
Word Wrap
Wrap words to a specified length.
Stars: ✭ 107 (-20.74%)
Mutual labels:  cli, terminal
Ruby Progressbar
Ruby/ProgressBar is a text progress bar library for Ruby.
Stars: ✭ 1,378 (+920.74%)
Mutual labels:  cli, terminal
Ytfzf
A posix script to find and watch youtube videos from the terminal. (Without API)
Stars: ✭ 2,212 (+1538.52%)
Mutual labels:  cli, terminal
Ervy
Bring charts to terminal.
Stars: ✭ 1,530 (+1033.33%)
Mutual labels:  cli, terminal
Dksnap
Docker Snapshots for Development and Test Data
Stars: ✭ 122 (-9.63%)
Mutual labels:  cli, terminal
Tooling
Advancing Node.js as a framework for writing great tools
Stars: ✭ 98 (-27.41%)
Mutual labels:  cli, terminal
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-27.41%)
Mutual labels:  terminal, ncurses

Programmer calculator

The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer working with:

  • binary, hexadecimal and decimal representations at the same time
  • bitwise operations
  • various operand sizes (16bits, 32bits, 8bits, etc)

and who likes:

  • a clear, simple and customizable interface
  • open source software
  • terminal/cli tools

Screen

Making of

The idea was born while developing a Nintendo Gameboy Emulator. Romes - the pitcher - found that the tools given online were clunky and did not allow for "nice multitasking"

With the constant need to visualize and manipulate bits, it became evident that a better solution had to come to life

Installation

Homebrew

Install from the homebrew official packages

$ brew install pcalc

Arch Based Distros

Install from AUR

$ yay -S programmer-calculator

Building from Source (alternative)

Prerequisites:

To build from source you need gcc, ncurses, and the source files. If you don't have ncurses, please install it (i.e. with your system's package manager) first. (To install ncurses in Debian based distros run sudo apt-get install libncurses5-dev libncursesw5-dev)

Building:

First, clone the repository and change directory to it

$ git clone https://github.com/alt-romes/programmer-calculator ; cd programmer-calculator

Then, compile the code into an executable file

$ make

Finally, move the executable to a directory reachable by $PATH

$ mv -i pcalc /usr/local/bin

Updating

Either re-build from source, or, using brew do

$ brew update

followed by

$ brew upgrade pcalc

Running

Just run the programmer calculator program

$ pcalc

Features

Usage

There are various ways to insert values/operators, see the example 2 + 2 below:

  • 2, followed by +, followed by 2
  • 2, followed by +2
  • 2+, followed by 2
  • 2+2 (or i.e. 2 + 2)

Inline Math

Operator precedence and parenthesis for grouping is used.

2+2*3 evaluates to 8 and (2+2)*3 evaluates to 12

Hex + Binary + Decimal

All three number representations are available at the same time, you can insert 0xff + 0b101101 - 5 directly onto the calculator

Operand Size

By default, 64 bits are used for arithmetic, however, when working with bits, quite often we want to work with less. With this calculator you can change the amount of bits used. the number displayed will be unsigned

To use 16 bits instead, type 16cb (cb for "change bits")

To use 8 bits, type 8cb

To use 0 < n <= 64 bits, type ncb

Customizing Interface

While running the calculator, you can type what you see for it to appear/disappear:

history to toggle the history decimal to toggle the decimal representation binary to toggle the binary representation hex to toggle the hexadecimal representation operation to toggle the operation display

To set a default interface, define an alias for the program with the desired hidden options

$ alias pcalc='pcalc -ibxdos'

i: history, b: binary, x: hex, d: decimal, o: operation, s: symbols

You can also use the long options to hide parts: --history, --decimal, etc.

Operations

ADD  +    SUB  -    MUL  *    DIV  /    MOD  %
AND  &    OR   |    NOR  $    XOR  ^    NOT  ~
SL   <    SR   >    RL   :    RR   ;    2's  _
  • ADD: a + b arithmetic addition
  • SUB: a - b arithmetic subtraction
  • MUL: a * b arithmetic multiplication
  • DIV: a / b arithmetic integer division
  • MOD: a % b modulus from the division
  • AND: a & b bit-wise AND operation
  • OR : a | b bit-wise OR operation
  • NOR: a $ b bit-wise NOR operation : opposite of OR
  • XOR: a ^ b bit-wise XOR operation : exclusive OR
  • NOT: ~a bit-wise NOT operation : change all bits of a, 0's into 1's and 1's into 0's
  • SL : a < b bit-wise SHIFT-LEFT operation : shift a left b number of times
  • SR : a > b bit-wise SHIFT-RIGHT operation : shift a right b number of times
  • RL : a : b bit-wise ROTATE-LEFT operation : rotate a left b number of times
  • RR : a ; b bit-wise ROTATE-LEFT operation : rotate a right b number of times
  • 2's: _a 2's complement operation : 2's complement of a (usually is the symmetric of a)

Contributing

Please reference Contributing


example usage in iterm panel

Panels

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].