Skip to content
HN On Hacker News ↗

how a stray "j" ruined my evening — napkins

▲ 69 points 34 comments by birdculture 2w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully human-written

0 %

AI likelihood · overall

Human
100% human-written 0% AI-generated
SEGMENTS · HUMAN 2 of 2
SEGMENTS · AI 0 of 2
WORD COUNT 314
PEAK AI % 0% · §1
Analyzed
Jun 28
backend: pangram/v3.3
Segments scanned
2 windows
avg 157 words each
Distribution
100 / 0%
human / AI fraction
Verdict
Human
Pangram v3.3

Article text · 314 words · 2 segments analyzed

Human AI-generated
§1 Human · 0%

← back 2026-06-08Some time ago I decided to wrangle a silly link shortener that I called shirts linkener, shirts for short.There's nothing special about it in particular, rather it's in my run-once-forget-forever shell script that copies the generated links to a clipboard using wl-clipboard.#!/bin/sh

shirt=$(curl -s -X POST "$(pass show shirts/url)" \ -H "Authorization: Bearer $(pass show shirts)" \ -H "Content-Type: application/json" \ -d "{\"url\": \"${1?missing url}\"}")

echo "$shirt" | jq echo "$shirt" | jq -r '.short_url' | wl-copyNothing out of the ordinary here. It shortens the link and copies it to a clipboard. By then I have been hapilly using it for couple of months without an issue.The fun began when I decided to try out gurk, a Signal TUI written in Rust. Those who know me, know my obsession with terminal interfaces so this was an obvious match.One evening I was sharing a link to an image hosted on S3 when I noticed people were saying it shows 404 to them.After pasting the link into Firefox, it worked. What is going on? I send them the link and it works now...Time passes and I get the same responses from multiple friends - 404. After some time looking at the messages I notice a pattern - each url ends with "j".Turns out I was copying the link with a \n at the end, which in most cases went unnoticed, but in ANSI newline delimiter is translated as "j", hence the stray jay at the end of each link.After having a solid five minutes of immense shame I found that jq has --join-output argument, which prevents exactly my case: --join-output / -j:

Like -r but jq won't print a newline after each output.Moral of this story is that terminals are fun and shooting myself in the foot repeatedly acts as a great learning opportunity.

§2 Human · 0%

Some of the sources around control codes and escape sequences.https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797https://cirw.in/blog/bracketed-pastehttps://jdhao.github.io/2021/02/01/bracketed_paste_modem.