3 ms·
This kind of stuff is fun, reminds me of decimal IP addresses. like http://3520653040 http://3520653040 should take you to hn (atleast to the IP I'm resolving
by dec0dedab0de 8y ago
This kind of stuff is fun, reminds me of decimal IP addresses.
like http://3520653040 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:
python -c 'import sys;print sys.argv[1].decode("utf-8").encode("idna")' "℡"
Should have been
python -c 'print "℡".decode("utf-8").encode("idna")'
Or in python3
python -c 'print( "℡".encode("idna"))'
- edent 8y agoPull Requests welcome :-) More seriously, I just copied that codefrom somewhere. Why is the other way better?
- half-kh-hacker 8y agoBrevity - You don't need to `import sys` if you just use the literal character instead of reading from argv
- emilfihlman 8y ago>Why is the other way better? Shorten? More readable? Simpler? Surely you said that in jest.
- gondo 8y agohow does that IP url works? for me HN resolves to 209.216.230.240 I know about http://209.216.230.240 http://209.216.230.240 format, but how did you get to 3520653040 ?
- vanni 8y agoAn 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.
- mdewinter 8y agoI once wrote on this topic, numeric IP addresses: https://raymii.org/s/articles/IPv4_Address_Conversion_Tricks.html https://raymii.org/s/articles/IPv4_Address_Conversion_Tricks... This "feature" is documented in the inet_aton(3) manpage.