{"id":13408903,"url":"https://github.com/alt-romes/programmer-calculator","last_synced_at":"2025-04-12T17:40:48.248Z","repository":{"id":46079414,"uuid":"330186707","full_name":"alt-romes/programmer-calculator","owner":"alt-romes","description":"Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits ","archived":false,"fork":false,"pushed_at":"2024-04-21T04:27:15.000Z","size":2058,"stargazers_count":561,"open_issues_count":6,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-03T20:11:06.349Z","etag":null,"topics":["c","calculator","cli","ncurses","programmer-calculator","terminal"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alt-romes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["alt-romes"]}},"created_at":"2021-01-16T14:57:24.000Z","updated_at":"2025-03-25T05:46:06.000Z","dependencies_parsed_at":"2024-01-03T04:12:42.611Z","dependency_job_id":"45304c15-e4ca-4d24-8674-562074340df7","html_url":"https://github.com/alt-romes/programmer-calculator","commit_stats":{"total_commits":275,"total_committers":16,"mean_commits":17.1875,"dds":0.4181818181818182,"last_synced_commit":"2787c7d4a80b103d6b5d3894abe9d533f5c58391"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-romes%2Fprogrammer-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-romes%2Fprogrammer-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-romes%2Fprogrammer-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-romes%2Fprogrammer-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alt-romes","download_url":"https://codeload.github.com/alt-romes/programmer-calculator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248607545,"owners_count":21132557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","calculator","cli","ncurses","programmer-calculator","terminal"],"created_at":"2024-07-30T20:00:56.374Z","updated_at":"2025-04-12T17:40:48.211Z","avatar_url":"https://github.com/alt-romes.png","language":"C","readme":"## Programmer calculator\r\n\r\nThe programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer working with: \r\n\r\n* binary, hexadecimal and decimal representations at the same time\r\n* bitwise operations\r\n* various operand sizes *(16bits, 32bits, 8bits, etc)*\r\n\r\nand who likes:\r\n\r\n* a clear, simple and customizable interface\r\n* open source software\r\n* terminal/cli tools\r\n\r\n![Screen](https://raw.githubusercontent.com/alt-romes/programmer-calculator/master/assets/v2.0-ss.png)\r\nThe above picture depicts `pcalc` without colors, and below is an example of `pcalc` with colors enabled (`--colors`) (which change depending on the terminal profile colors)\r\n![Screen-Colored](https://raw.githubusercontent.com/alt-romes/programmer-calculator/colors/assets/v2.0-ss-colors.png)\r\n\r\n## Making of\r\n\r\nThe 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\"\r\n\r\nWith the constant need to visualize and manipulate bits, it became evident that a better solution had to come to life\r\n\r\n## Installation\r\n\r\n#### Homebrew\r\n\r\nInstall from the homebrew official packages\r\n```\r\nbrew install pcalc\r\n```\r\n\r\n#### Arch Based Distros\r\n\r\nInstall from AUR\r\n```\r\nyay -S programmer-calculator\r\n```\r\n\r\n#### Building from Source (alternative)\r\n\r\n##### Prerequisites:\r\nTo build from source you need `gcc`, `ncurses`, and the source files. \r\n**If you don't have ncurses, please install it (i.e. with your system's package manager) first.**\r\n*(To install ncurses in Debian based distros run `sudo apt-get install libncurses5-dev libncursesw5-dev`)*\r\n\r\n##### Building:\r\n\r\nFirst, clone the repository and change directory to it\r\n```\r\ngit clone https://github.com/alt-romes/programmer-calculator ; cd programmer-calculator\r\n```\r\n\r\nThen, compile the code into an executable file and install it (installs in /usr/local/bin)\r\n```\r\nsudo make install\r\n```\r\n\r\nConversely, if you ever want to uninstall, you can run:\r\n```\r\nsudo make uninstall\r\n```\r\n\r\n#### Updating\r\nEither re-build from source, or, using brew do\r\n```\r\nbrew update\r\n```\r\nfollowed by\r\n```\r\nbrew upgrade pcalc\r\n```\r\n\r\n#### Running\r\n\r\nJust run the programmer calculator program\r\n```\r\npcalc\r\n```\r\n\r\n## Features\r\n\r\n### Usage\r\n\r\nThere are various ways to insert values/operators, see the example `2 + 2` below:\r\n\r\n* `2`, followed by `+`, followed by `2`\r\n* `2`, followed by `+2`\r\n* `2+`, followed by `2`\r\n* `2+2` (or i.e. `2 + 2`)\r\n\r\n#### Inline Math\r\n\r\nOperator precedence and parenthesis for grouping is used.\r\n\r\n`2+2*3` evaluates to `8` and `(2+2)*3` evaluates to `12`\r\n\r\n\r\n### Hex + Binary + Decimal\r\n\r\nAll three number representations are available at the same time, you can insert `0xff + 0b101101 - 5` directly onto the calculator\r\n\r\n\r\n### Operand Size\r\n\r\nBy 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\r\n\r\nTo use 16 bits instead, type `16bit` (bits will also work)\r\n\r\nTo use 8 bits, type `8bit`\r\n\r\nTo use 0 \u003c n \u003c= 64 bits, type `nbit`\r\n\r\n\r\n### Customizing Interface\r\n\r\nWhile running the calculator, you can type *what you see* for it to appear/disappear:\r\n\r\n`history` to toggle the history\r\n`decimal` to toggle the decimal representation\r\n`binary` to toggle the binary representation\r\n`hex` to toggle the hexadecimal representation\r\n`operation` to toggle the operation display\r\n\r\nAdditionally, the interface colors can be toggled on and off.\r\n\r\nTo set a default interface, define an alias for the program with the desired hidden options\r\n```\r\nalias pcalc='pcalc -ibxdosn'\r\n```\r\ni: history, b: binary, x: hex, d: decimal, o: operation, s: symbols, n: no colors\r\n\r\nYou can also use the long options to hide parts: `--history`, `--decimal`, etc.\r\n\r\n\r\n### Operations\r\n```\r\nADD  +    SUB  -    MUL  *    DIV  /\r\nMOD  %    AND  \u0026    OR   |    NOR  $\r\nXOR  ^    NOT  ~    SL   \u003c    SR   \u003e\r\nRL   :    RR   ;    2's  _    SE   @\r\n```\r\n\r\n* ADD: `a + b` arithmetic addition\r\n* SUB: `a - b` arithmetic subtraction\r\n* MUL: `a * b` arithmetic multiplication\r\n* DIV: `a / b` arithmetic integer division\r\n* MOD: `a % b` modulus from the division\r\n* AND: `a \u0026 b` bit-wise AND operation\r\n* OR : `a | b` bit-wise OR operation\r\n* NOR: `a $ b` bit-wise NOR operation : opposite of OR\r\n* XOR: `a ^ b` bit-wise XOR operation : exclusive OR\r\n* NOT: `~a`    bit-wise NOT operation : change all bits of a, 0's into 1's and 1's into 0's\r\n* SL : `a \u003c b` bit-wise SHIFT-LEFT operation : shift a left b number of times\r\n* SR : `a \u003e b` bit-wise SHIFT-RIGHT operation : shift a right b number of times\r\n* RL : `a : b` bit-wise ROTATE-LEFT operation : rotate a left b number of times\r\n* RR : `a ; b` bit-wise ROTATE-RIGHT operation : rotate a right b number of times\r\n* 2's: `_a`    2's complement operation : 2's complement of a (usually is the symmetric of a)\r\n* SE : `@a`    swap endianness : swap the byte order of a (uses the number of bits set by `bit` to determine the amount of bits swapped)\r\n\r\n\r\n## Contributing\r\n\r\nPlease reference [Contributing](https://github.com/alt-romes/programmer-calculator/blob/master/CONTRIBUTING.md)\r\n\r\n\r\n---\r\n\r\n#### example usage in iterm panel\r\n\r\n![Panels](https://raw.githubusercontent.com/alt-romes/programmer-calculator/master/assets/panels.png)\r\n\r\n","funding_links":["https://github.com/sponsors/alt-romes"],"categories":["\u003ca name=\"calc\"\u003e\u003c/a\u003eCalculators","C","Applications"],"sub_categories":["Directory Navigation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-romes%2Fprogrammer-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falt-romes%2Fprogrammer-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-romes%2Fprogrammer-calculator/lists"}