Announcement

Collapse
No announcement yet.

Yet Another Conky Thread

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Yet another (un)interesting factlet:
    Not only does the V6 address change at every boot, but its string changes length.

    This is due to two things:
    - Leading zeros are not printed, so some hextets have only three characters - or less. It doesn't seem to happen very often.
    - Letters in the HEX groups are lowercase. which also varies the length.

    Printing them all in uppercase is really easy:
    curl -s http://icanhazip.com | tr '[a-z]' '[A-Z]'
    This also improves readability.

    Replacing leading blanks for zeros would be a bit more difficult. Not very, but at the moment I don't actually need a fixed-length string all that much.
    Now, of course V4 addresses change length all the time, but they're short enough. V6 ones are longer than telephone wires ;·) and take up all possible horizontal space, so having them behave in an unruly way... messes up my lovely conky a bit :·)

    And uppercase improves readability.

    Comment


      #32
      😉 (in case your browser font doesn't do recent Unicode, that's trying to be a large winking face )
      Originally posted by Don B. Cilly View Post
      Printing them all in uppercase ...
      This also improves readability.
      Never. Upper-case letters together are horrible, especially with sans serif fonts. Use of such has demonstrably cost lives on highways. I have hated their use since my first job; there, those who used them a lot tended to have, to varying degrees, incompetence, stupidity, meanness, and dishonesty (cruelly so to me in one case). Lower-case is the unixy and internet way; upper-case reeks of DOS and Windows.

      Anyway, RFC 5952, section 4.3, says
      The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address must be represented in lowercase.
      'E' is not far from 'F', and 'D' is easily mistaken for '0' or 'B', which is easily confused as '8'. (Came across that one a couple of weeks ago.)

      By the way, a digression for the scripting nerd: tr '[a-z]' '[A-Z]' has redundant square brackets; it happens to work because the square brackets map onto each other. The square brackets were an ancient SystemV unix usage, POSIX (and thus Gnu tr and thus Linux) went with the BSD tr. One can use tr '[:lower:]' '[:upper:]', but tr a-z A-Z works just as well, which isn't in fact very well. If you were, say, the Prime Minister of Vietnam, tr will upper-case your name to NGUYễN XUâN PHúC. Gnu awk does a better job:
      Code:
      $ sudo apt install gawk
      $ echo Nguyễn Xuân Phúc | awk '{print toupper($0)}'
      [size=3]NGUYỄN XUÂN PHÚC[/size]
      Regards, John Little

      Comment


        #33
        You mean you find
        2a01:c50f:9a94:6800:1851:3513:1471:ef18
        more legible than
        2A01:C50F:9A94:6800:1851:3513:1471:EF18
        ?

        Comment


          #34
          Originally posted by Don B. Cilly View Post
          You mean you find
          2a01:c50f:9a94:6800:1851:3513:1471:ef18
          more legible than
          2A01:C50F:9A94:6800:1851:3513:1471:EF18
          ?
          Definitely. Consider these pairs of addresses:
          Code:
          2a01:c50f:9a94:6800:1851:3513:1471:ef18
          2a01:c50f:9a94:6b00:1b51:3513:1471:ef1b
          
          2A01:C50F:9A94:6800:1851:3513:1471:EF18
          2A01:C50F:9A94:6B00:1B51:3513:1471:EF1B
          IMO it's really hard to tell the second pair apart. But, I'll attempt some objectivity...

          With Conky you're economizing on screen space, so lets say you're using 10 point, say Ubuntu Mono Regular. Using Spectacle on my 1080p display, Imagemagick convert image1 image2 -compose Difference -composite -colorspace gray -format '%[fx:mean*100]' info: says the lower-case forms are 14.8% different, but the upper-case ones are 0.7% different. Note I know little about quantifying image differences, I just googled and noticed a method using Imagemagick, which I've found very useful in the past for several purposes.
          Regards, John Little

          Comment


            #35
            Well, the reason I use uppercase is because it is fixed length, whereas lowercase, with that font, varies.
            I could change font, but | tr a-z A-Z (which does work very well without brackets and all) does it, so...

            I just mentioned that for me it also improves legibility, but only in the sense that the font is small and greenish - I like it that way.

            Click image for larger version

Name:	addr.png
Views:	1
Size:	11.8 KB
ID:	644478

            Comment

            Working...
            X