Initial TK-blocker and TK entry

attemptAtTagsRenovation
Jack Jackson 2 years ago
parent f3b243e12f
commit 43dac78dc1
  1. 24
      .drone.yml
  2. 41
      blog/content/posts/tk-block.md

@ -7,6 +7,30 @@ platform:
arch: arm64
steps:
- name: block-posts-containing-tk
image: busybox
commands:
# This is necessary because, if `grep ...` doesn't find anything, it will _return_ (not print) a value of 1
# (non-zero return codes indicating errors in Unix - since there are many more ways for something to go wrong
# than there are for it to go right!), and so the `files=` assignment will also return 1, and the whole operation
# will be considered a failure.
#
# Since a non-zero value is truthy in Linux, we can use the OR operator (`||`) to only execute the second command
# if the first one errors out. So, this line can be translated to English as:
# "Set the variable `files` to a list of all the files that contain `TK` - unless there aren't any, in which case
# set it to `FILES NOT FOUND"
- files=$(grep -rl 'TK' blog/content/posts || echo "FILES NOT FOUND")
# We have to filter out (`grep -v`) the "marker" value of `FILES NOT FOUND`, otherwise the no-matches case would
# be recorded as having 1 matching file, leading to an error-out below.
# (I guess _technically_ there's an edge case in that, if I ever make a blog post titled "FILES NOT FOUND" _which also_
# contains the string `TK`, it would slip through this check. But that feels pretty unlikely - not least because spaces
# are very rare in my filesystem names - so I'm ok taking that risk)
- count=$(wc -l <(echo "$files" | grep -v "FILES NOT FOUND") | awk '{print $1}')
- if [[ "$count" -gt "0" ]]; then
- echo "Found TK in $count files:"
- echo $files
- exit 1 # TODO - and alerting via Matrix!
- fi
- name: copy-cert-into-place
image: busybox
volumes:

@ -0,0 +1,41 @@
---
title: "TK Block"
date: 2022-08-23T21:46:40-07:00
tags:
- meta
---
I just added a process to my blog deployment pipeline to block the deployment of any blogs that contain the characters "TK".
<!--more-->
## Why
"TK" is a [printing and journalism reference](https://en.wikipedia.org/wiki/To_come_(publishing)) indicating that more content is "To Come" (the mismatching initialism is intentional, since very few English words contain the letters "TK"[^1] - so a search for those characters is very unlikely to turn up a false positive).
One use of this is as a "placeholder", when you know _roughly_ what will go in a given place in a written work, but don't have the references or inclination to fill it out entirely. By just chucking "_TK - a swordfight_" or "_TK - analysis of European GDP_" in place, you can keep up your momentum by moving on to the parts that you _do_ feel ready to write right now[^2], and return to fill out the TKs once more-appealing options have been exhausted.
In the traditional publishing world, an Editor would be responsible for the final pass over the work to make sure all TKs have been caught before sending the content out to readers. In the thrilling world of the future where we have taught sand to think by blasting it with lightning, we can automate that process! Look at the changes to `.drone.yml` in the commit that introduced this blog post to see how.
## What about alerting?
Watch this space. I want the original commit to _only_ include the `.drone.yml` update and minimal blog post, to check it works. I'll post a follow-up with description of alerting (via Matrix) next.
If you're seeing this, then congratulations, you caught the blog post before it was meant to be published. But wait...this whole blog post was about how we'd now made that impossible, right? That's right! TK! TK!
## Wait, but...this blog contains the characters TK?
I know! See if you can figure it out :)
[^1]: Alright, you know I couldn't resist checking:
```
$ cat /usr/share/dict/words | wc -l
235886
$ cat /usr/share/dict/words | grep -i 'tk' | wc -l
40
$ echo "100*40/235886" | bc -l
.01695734380166690689
```
So, _about 0.017%_ of common English words contain those characters. Some stand-outs include "_boatkeeper_", "_giantkind_", and "_outknave_".
[^2]: Though, see also George's thoughts on [Being Creative Uphill](https://www.georgelockett.com/shards/2022/7/28/being-creative-uphill) and [How To Write When You Can't](https://www.georgelockett.com/shards/2022/6/16/how-to-write-when-you-cant)
Loading…
Cancel
Save