Jj Del Carpio

Jj's web stream

Looking for a better time slug for titleless posts

I was never happy with the title less posts to have a redundant timestamp that looked like this:

https://jj.isgeek.net/2019/02/05-022232-am/

That last bit 05-022232-am always got to my nerves, the "am" was redundant information and I'm sure I can do better.

Explored to do "day-seconds" with seconds being the seconds in the day, which max at 86460 which is 5 chars long. Only one byte better than stripping the "am" from the flat hhmmss timestamp which is way clearer.

Tried to convert this integer to hex, (using the neat {:x}.format) but for the max 86460 it reduced it to 151bc which is also 5 bytes. But I seem to have lots of hex space there to use in those 5 bytes, so decided to try not the seconds in the day but the seconds in the month multiplying by the day. Which maxes now at 2680260 seconds or 28e5c4 hex. So now I have 6 bytes.

Then I thought, why am I even trying to save bytes here. I can have very clear information for 8 bytes just by stripping that am that bothered me since the beginning.

Ended up with

slugify(post_date.strftime('%d %H:%M:%S'))

And be done with it.

Shared on:

Jj Avatar of Jj

Reply or react to this post via Webmentions or reply or like to the Mastodon, Twitter or Instagram post.