Write Only Log for 2 Aug 2025 - osric.uk

Hello world, do you like the new look? I think I'm a fan.

I've stripped out almost all of the css, only putting back enough to try to pin the nav menu to the top of the page. I'm only using system colours and default fonts, and I added a few lines to the blog archive that means the month tables wrap.

(Oh, yeah. I replaced the css grid month tables with, y'know, actual tables. Seriously, css grid is fun, but calendars are close to ideal table data.)

This blog entry box needs a "max-width: page-width", but I'll deal with that later. I've just come back from town and gosh, that place is hard to cope with!

On the plus side, I came back with new XL trousers, a significant improvement over the 5X trousers I bought last time. I tried L, but they were a little tight. Maybe in a month or two.

Think I've got the fixed menu working now, thanks to a stack overflow answer I'm using box-shadow to draw outside the box of the element, so I can keep it at 8px from the top (standard body margin) and still make those 8px opaque.

I wonder when CSS is going to get references, so I can do background-color: ref(body.background-color); (yes, I could do something similar with variables, but I don't want to have to specify everything, I want to use whatever the user (browser) thinks is default.

Ah, well.

In tonight's episode of "Fun with pipelines", we've got this monstrosity:

awk '{ print $3 }' logs/* |  
	sort -n |
	uniq |
	tail +6 |
	awk '{print "-x " $1 }' |
	xargs dig +noall +answer |
	rev |
	awk -F. '{print $2 "." $3}' |
	rev |
	sort |
	uniq -c |
	sort -nr |
	head -n 10

which produces an output something like:

    349 amazonbot.amazon
    186 ahrefs.net
     67 yandex.com
     47 msn.com
     39 semrush.com
     16 petalsearch.com
     14 babbar.eu
     10 googleusercontent.com
     10 google.com

telling us that amazon used nearly 350 different source IPs to make requests to this server.

Explanation

It's bash, so the | at the ends of the lines means "pass the output of this command to the next command".

awk '{ print $3 }' logs/*

Awk is a small text processing tool. By default, it splits its input into lines (using \n) and then into fields (using spaces and tabs). In this case, print $3 means "print the 3rd (counting from 1) field". We've told awk to read all the files in the logs folder, which have an IP address in the 3rd field.

sort -u

sort takes it's input, splits into lines, sorts it, and prints the output. The -u option tells sort to only output one copy of identical lines (which is what we really want, the sorting is a side effect).

awk '{print "-x " $1 }'

Awk again, this time printing each input line with "-x " in front, which helps us build the next command.

xargs dig +noall +answer

xargs is a neat toy. It takes the input fed to it, and the command you give it, and then it runs the command, passing the command all the input as options.

It's very useful for, well, this kind of situation, where we've got a list of things that we want to run a command with.

The command we've asked it to run is dig, a "DNS lookup utility". Given a hostname, it will find the IP, or (as in our case), given an IP address, it will find the hostname. We have to give it the -x option per address to tell it we're looking for the name. the +noall +answer options limit it's output to the part we care about (the answer!).

rev

rev outputs each line of input reversed.

(Sorry, I ran out of energy at this point. Hopefully I'll come back and finish at some point)

This input box is still too wide, but not by much.

The sticky header isn't on the bookmarks index, although it has picked up the color scheme. I need to pull in the bookmarks database from live to do some proper testing.

Some blog entries have got code blocks wider than the screen, but the browser zooms into fit-to-screen anyway. This breaks the sticky header because it sticks to the page, not the zoomed in viewport the browser uses.

I should go though and make sure all pages have a sensible title. (This new blog page doesn't, for example).

Dammit, I'm all tired and got and grumpy. I haven't even warn my new trousers yet. Going into town knackered me, then I sunk a bunch of energy info the post above about the stupid command line, and it's not like my expected audience actually cares! (Hello babe, I still love you!)

::blows raspberyy::

Right, it's the same problem on the bookmarks page, something is very wide, this makes the browser draw the viewport and the page at different sizes. Chaos ensues.

Different fixes, probably. I'll tell bookmarks to wrap, and I'll tell code blocks to scroll. Tomorrow. I should try sleeping now.

To remember your current position in the blog, this page must store some data in this browser.

Are you OK with that?