Re:Domain hacks with unusual Unicode characters
by mdewinter on Friday November 02, 2018 @10:20AM
(#18363193)
I once wrote on this topic, numeric IP addresses:
https://raymii.org/s/articles/IPv4_Address_Conversion_Tricks...
This "feature" is documented in the inet_aton(3) manpage.
Re:Domain hacks with unusual Unicode characters
by edent on Friday November 02, 2018 @07:41AM
(#18362282)
Pull Requests welcome :-)
More seriously, I just copied that codefrom somewhere. Why is the other way better?
Re:Domain hacks with unusual Unicode characters
by half-kh-hacker on Friday November 02, 2018 @08:17AM
(#18362436)
Brevity - You don't need to `import sys` if you just use the literal character instead of reading from argv
Re:Domain hacks with unusual Unicode characters
by emilfihlman on Friday November 02, 2018 @09:13AM
(#18362741)
>Why is the other way better?
Shorten? More readable? Simpler? Surely you said that in jest.
Re:Domain hacks with unusual Unicode characters
by gondo on Friday November 02, 2018 @10:01AM
(#18363057)
how does that IP url works?
for me HN resolves to 209.216.230.240
I know about http://209.216.230.240 format, but how did you get to 3520653040 ?
Re:Domain hacks with unusual Unicode characters
by vanni on Friday November 02, 2018 @10:08AM
(#18363103)
An IP is just an unsigned 32 bit integer:
3520653040 = 209 * 256^3 + 216 * 256^2 + 230 * 256^1 + 240 * 256^0
The 209.216.230.240 representation is the sequence of octets (256 = 2^8) from MSB to LSB expressed as decimal values.
like http://3520653040 should take you to hn (atleast to the IP I'm resolving for hn right now)
Also, I know this is off topic, but that python example really bothered me.
original:
Should have been Or in python3