The Darren Mulholland

Renowned internet personality.

Int

A command line integer conversion utility.


Int is a handy little command line utility for converting integers between bases. It accepts an integer in its binary, octal, decimal, or hex form, then prints it out in all four bases:

$ int 123 456
──────────────────────────────────────────────────────────
hex: 7B
dec: 123
oct: 173
bin: 01111011
──────────────────────────────────────────────────────────
hex: 1C8
dec: 456
oct: 710
bin: 00000001 11001000
──────────────────────────────────────────────────────────

Interface

Run int --help to view the application's command line help:

Usage: int [FLAGS] INT [INT ...]

  Integer conversion utility. Prints an integer in [b]inary,
  [o]ctal, [d]ecimal, and he[x] bases.

  Use a single letter prefix to declare the base of the
  input, e.g. b1010. The base defaults to [d]ecimal if the
  prefix is omitted.

  This utility:

  - Accepts integer inputs with a leading zero, e.g. 0x123.
  - Accepts multiple arguments.
  - Does not accept negative integers.

Flags:
  --help        Print this help text and exit.
  --version     Print the version number and exit.

Installation

Install from the Python package index using pip:

$ pip install int

Int requires Python 3. You can find the source files on Github.

License

This work has been placed in the public domain.