11 ms·
TUI calculator for programmers working close to the bits
- 6th 4y agoMy goto is speedcrunch https://heldercorreia.bitbucket.io/speedcrunch/ https://heldercorreia.bitbucket.io/speedcrunch/
- ladberg 4y agoPretty nice looking! Also for anyone on a Mac I find programmer mode (⌘-3) in the built-in Calculator.app pretty useful for this purpose.
- digitallyfree 4y agoFor Linux GUI users I also like the Gnome calculator in programmer mode, which displays the different bases all at once and has options for 2's complement and the like. https://imgbox.com/SrMD3LoP https://imgbox.com/SrMD3LoP
- _V_ 4y agoHonestly I missed Calculator.app along with Mail.app on Linux quite a lot! I settled with Qalculate - it can do some things as Spotlight (currency conversion) and also quite nice for programmer-related tasks. Although I miss few features here and there it is quite good.
- donaldihunter 4y agoThere’s also Bitwise [0] which has support for IP addresses [0] https://github.com/mellowcandle/bitwise https://github.com/mellowcandle/bitwise
- conradev 4y agoI've been using Bitwise for quite some time now and it is my favorite tool for this
- ilyt 4y agoI use ipcalc for that, dumps some more useful stuff about net -> ᛯ ipcalc 1.1.1.1/23 Address: 1.1.1.1 00000001.00000001.0000000 1.00000001 Netmask: 255.255.254.0 = 23 11111111.11111111.1111111 0.00000000 Wildcard: 0.0.1.255 00000000.00000000.0000000 1.11111111 => Network: 1.1.0.0/23 00000001.00000001.0000000 0.00000000 HostMin: 1.1.0.1 00000001.00000001.0000000 0.00000001 HostMax: 1.1.1.254 00000001.00000001.0000000 1.11111110 Broadcast: 1.1.1.255 00000001.00000001.0000000 1.11111111 Hosts/Net: 510
- nonrandomstring 4y agoI like the idea and hope you grow it into something of a pen-knife for numbers. Being able to change the bit width and base on the fly looks neat. I tend to pull up a Python shell for lots of tasks. Often what I want is a dumper (like od, hexdump or tcpdump) with the ability to filter steams with masks and whatnot, like wireshark, and display the results in various "views" (hex, binary etc as you have provided). It is hard to make any one tool do all that - but also hard to find nicely pipeable little tools to work in a Unix way. It might be good to consider the contexts people will use your tool wrt stdio/sockets/fifos.
- mncharity 4y agoAny suggestions for similar "close to the bits" but with support for floats?
- staplung 4y agoWell, Julia has a `bitstring` function that understands floats: julia> bitstring(Int32(4)) "00000000000000000000000000000100" julia> bitstring(2.2) "0100000000000001100110011001100110011001100110011001100110011010"
- mncharity 4y agoNice thought. (Coincidentally, I've recently been using Julia to explore collaborative compilation, spiking numeric literals.)
- artisanspam 4y agoLooks great! But you may want to consider a different name as PCalc is already a popular calculator app: https://pcalc.com/ https://pcalc.com/
- _V_ 4y agoYup - took me few minutes to figure out why my Portage package pcalc has quite a different TUI. Not the best move to name it like that I'd say.
- makeworld 4y agoAnyone know the font in the screenshot?
- romes 4y agoI think it's Menlo
- AceJohnny2 4y agoOfftopic, but I remember implementing a calculator was Compilers & Parsing 101. I mention this because the Readme specifically calls out the various ways of inputting an expression, which is a non-issue with any compiler background. (It's handled by the lexer, which is step that handles processing input into "lexical" elements, which are then passed to actual "parser" that constructs the syntactic structure)
- ghewgill 4y agoFor old school fans, the HP-16C [1] calculator provided these kinds of functions in a handheld calculator, in 1982. This was the only "programmer" calculator that HP has ever made. There is a simulator (for Windows) available [2]. (No affiliation; but I made a simulator for the cousin calculator HP-15C [3]). [1]: https://hpmuseum.org/hp16.htm https://hpmuseum.org/hp16.htm [2]: http://hp16c.org http://hp16c.org [3]: https://hp15c.com https://hp15c.com
- wkjagt 4y agoOne day I’ll buy a real 16C. But they’re just a little too expensive to easily justify buying. I know there are remakes but there’s just something about the real thing.
- ilyt 4y agoI own swissmicro remake. It is excellent https://www.swissmicros.com/product/dm16l https://www.swissmicros.com/product/dm16l
- eredengrin 4y agoThere's also JRPN [1], not sure how closely it follows the original HP-16C as I've never used the original but it seems to give significant thought to it. It's written in flutter so available on linux and android. [1] https://jrpn.jovial.com/ https://jrpn.jovial.com/
- zabzonk 4y agoi had a casio (i think) calculator with a fold-out keyboard with all the hex digits (A-F) and the boolean operators. it would take input in binary, and hex, but not octal. my then gf bought it me as a bday present. appreciated, but not much used as at the time i could do all the binary/hex/decimal conversions in my head, not to mention converting them into z80 opcodes. sadly, no more - too old and forgetful this would have been about 1984
- mjcohen 4y agoMany calculators will do this. I like the CalcTastic Pro for android. This has a programmer mode, which will do all these and more. Its scientific mode will operate with complex numbers as well as real numbers. It can even take the complex factorial. It can operate on rpn as well as algebraic. It is good.
- capableweb 4y agoThe tools seems to have been developed because switching between terminal and clunky web-based tools was not fast enough ("did not allow for "nice multitasking""), not sure if switching between terminal on computer and a calculator on the phone would make things better, seems like it'd just add more friction, not less.
- gavinhoward 4y agoShameless plug: my `bc` [1] can also display bits like this, as well as do bit operations. It automatically detects how many bits your number must have and uses the minimum, or you can tell it the standard bit sizes or even use a custom bit size. It will handle 2's complement signed integers. See the manual ([2]), especially the extended math library section ([3]). It's also a normal `bc`, with every feature of all other implementations. I should add floating point support, though. [1]: https://git.yzena.com/gavin/bc https://git.yzena.com/gavin/bc [2]: https://git.yzena.com/gavin/bc/src/branch/master/manuals/bc/A.1.md https://git.yzena.com/gavin/bc/src/branch/master/manuals/bc/... [3]: https://git.yzena.com/gavin/bc/src/branch/master/manuals/bc/A.1.md#extended-library https://git.yzena.com/gavin/bc/src/branch/master/manuals/bc/...
- snvzz 4y agoI rotate between my TI-86, TI-89 and v200.
- ComputerGuru 4y agoI need to do one with the lcd replacement hacks for the 89. The contrast in that calculator is crap and readability is really poor.
- ilyt 4y agoI use qalc/qalculate, it has gui/cli version. I got pissed dealing with bc usability problems ("yes I pressed ctrl+c, you know I want to quit, why you ask me to type some command for it?"). > 10+0xff+0b00010 ->hex 10 + 255 + 2 = 0x10B Also does some fancy unit conversion stuff like "how long it would take to transfer X gigabytes over Y Mbit link > 200GB / (100Mbit/s) (200 gigabytes) / ((100 megabits) / second) = 4 h + 26 min + 40 s
- gavinhoward 4y agoNot for you, since qalc seems to fit your use case, but for anyone else that wants `bc` to exit with Ctrl+c. If you use my `bc` ([1]), configure it with: ./configure.sh -O3 -Sbc.sigint_reset That build will then exit on Ctrl+c. [1]: https://git.yzena.com/gavin/bc https://git.yzena.com/gavin/bc
- amelius 4y ago> yes I pressed ctrl+c, you know I want to quit Normal people would assume that you wanted to copy something into the clipboard.
- creshal 4y agobc predates the usage of Ctrl+C for copy pasting in some graphical UIs (not even all of them) by at least one decade. And it's not the sort of command line tool that you'd reasonably expect a clueless novice to stumble upon. And even if they did, bc terminates gracefully and leaves all your inputs on the screen, so there's not much lost if you do accidentally terminate it mid-work. So there's no really good reason for that behaviour… which is probably why not all bc flavours do it. GNU bc as shipped by Arch e.g. does just silently quit on ^C, and far as I can tell they're not patching it either.
- thanatos519 4y agoNice, but I would prefer an RPN version.
- xvilka 4y agoInteresting tool! In Rizin[1][2] we have a "visual bits" mode, see "Vb1" command. Moreover, there's "rz-ax" command, supporting various number systems and bits, see "rz-ax -h" help. [1] https://rizin.re https://rizin.re [2] https://github.com/rizinorg/rizin https://github.com/rizinorg/rizin
- jwr 4y ago[pulls out HP-16C from drawer under the desk] …I think I'll stay old school and continue pressing those satisfying physical keys.
- mbork_pl 4y agoThat's very neat. I wouldn't use it even if I had such a need - Emacs Calc seems to do everything this does and much more - but I'm glad people create such nice tools.