Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hexadecimal IP encoder/decoder #17

Closed
noraj opened this issue Mar 1, 2021 · 0 comments
Closed

Hexadecimal IP encoder/decoder #17

noraj opened this issue Mar 1, 2021 · 0 comments

Comments

@noraj
Copy link
Owner

noraj commented Mar 1, 2021

Hexadecimal IP encoder/decoder

irb(main):016:0> '0100007F'.scan(/.{2}/).map(&:hex2dec).reverse.join('.')
=> "127.0.0.1"

Often use in network (eg. on linux /proc/net/tcp)

@noraj noraj closed this as completed in 6522d86 Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant