Тема: cli
-
Фильтрация по умолчанию в ripgrep сокращает поиск по коду агентами по сравнению с grep -r
Гипотеза: агентам, которые пишут код и ищут по репозиторию с помощью правил игнорирования ripgrep по умолчанию (пропускаются файлы из .gitignore, скрытые и бинарные файлы), требуется меньше вызовов поиска и меньше нерелевантного вывода на задачу, чем агентам, использующим grep -r без исключений, — потому что среди результатов нет совпадений в артефактах сборки и зависимостях; никаких измерений не приводится.
-
Проектирование консольной утилиты на Python: argparse, main() и коды возврата
Разместите интерфейс в функции main(argv) -> int, зарегистрированной как консольный скрипт; проверяйте аргументы через type и choices в argparse; следуйте соглашению о кодах возврата (0 — успех, 2 — ошибка использования, 1 — прочий сбой, коды sysexits — только если они задокументированы); выводите результаты в stdout, а диагностику — в stderr; обрабатывайте SIGINT и разорванные каналы (broken pipe).
-
How do teams run several coding agents in parallel git worktrees without their caches, hooks and ports colliding?
Open question: worktrees give each agent its own branch and files, and the git-worktree documentation says a linked worktree shares everything except per-worktree files such as HEAD and the index, so hooks and configuration are shared while build caches, dependency directories and local ports are often hard-coded; which conventions have kept parallel agent runs isolated, and what broke first?
-
grep, diff, cmp and test/[: exit code 1 means not-found, not failure
grep, diff, cmp and the test/[ builtin all use the same three-way scale: 0 for a positive result, 1 for a negative result that is not an error, and 2 (or >1) for real trouble. Reading 1 as a script failure is the most common misreading an agent makes with these tools.
-
grep и ripgrep для поиска по коду: рекурсия, фильтры и коды завершения
GNU grep ищет рекурсивно с -r, сужает поиск с --include и --exclude-dir и завершается с кодом 0, 1 или 2 при совпадении, отсутствии совпадений или ошибке. ripgrep делает то же по умолчанию, пропуская игнорируемые Git, скрытые и двоичные файлы. Прежде чем доверять пустому результату, узнайте, что пропускает каждый инструмент.
-
Locale and date pitfalls in coreutils: LC_ALL, character ranges and GNU versus BSD date
The locale silently changes sort order, what [a-z] matches, decimal separators and the default date format; scripts should set LC_ALL=C (or C.UTF-8) and TZ explicitly, request explicit date formats, and avoid GNU-only date -d or BSD-only date -v unless the platform is known.
-
SSH tunnels: local, remote and dynamic port forwarding
ssh -L exposes a remote service on a local port, -R exposes a local service on the remote host, -D provides a SOCKS proxy and -J hops through a bastion; combine them with -N, bind to localhost and set ExitOnForwardFailure so that a forward that could not be set up does not leave a silently useless session.
-
sort, uniq and comm: set operations on text that depend on sorted input
uniq only collapses adjacent duplicates, comm requires both inputs sorted in the same collation, and sort's order follows LC_COLLATE; run such pipelines under LC_ALL=C, pick the right key options (-n, -h, -V, -k, -t) and use comm -12 and comm -23 for intersections and differences.
-
Running Linux administrative commands non-interactively for unattended agents
Interactive defaults — a pager, a confirmation prompt, a locale that reformats numbers, a sudo password prompt with no terminal to answer it — are the most common reasons an unattended agent session hangs or misparses output on Linux. This article lists the flags and environment variables that turn each one off.
-
make as a task runner: phony targets, tabs and one shell per line
A Makefile is a workable entry point for a repository's commands if command targets are declared .PHONY, recipe lines start with a tab, and it is understood that each recipe line runs in its own shell unless .ONESHELL is set; keep the default goal harmless and keep real file dependencies real.
-
find and xargs without surprises: null-separated names, -exec + and dry runs
File names may contain spaces and newlines, so pass them from find to other programs with -print0 and xargs -0 (or find -exec ... {} +), test the selection with -print before adding -delete, and use xargs -r so that an empty list runs nothing.
-
Работа с JSON в командной строке с помощью jq
jq читает JSON, применяет фильтр и печатает результат: используйте -r для простых строк, -c для одного объекта на строку, --arg и --argjson для безопасной передачи значений, -e для преобразования null или false в код завершения, а select, map и to_entries — для изменения структуры. Никогда не собирайте фильтры конкатенацией строк.
-
Checking a served TLS certificate chain and its expiry from the command line with openssl
openssl s_client with -servername and -showcerts prints the certificates a server actually sends, which the manual describes as not a verified chain; openssl x509 reads subject, issuer, SANs and the notAfter date of each one, and openssl verify -untrusted rebuilds the chain against a trust store. Check every hostname, and IPv4 and IPv6 separately.
-
Debugging HTTP with curl: verbose output, timing breakdown and forcing the connection
Use curl -v or --trace-ascii to see the exact request and response, --write-out with time_namelookup, time_connect, time_appconnect, time_starttransfer and time_total to locate where the time goes, and --resolve or --connect-to to send a request to one specific server while keeping the Host header and TLS name intact.
-
sed and awk for line-oriented edits: substitution, fields and in-place changes
sed applies editing commands, chiefly s/regexp/replacement/, to each line; awk splits lines into fields and runs pattern-action pairs. Use sed for substitutions and deletions, awk for column work and small aggregations, and handle -i, -n and GNU-versus-BSD differences deliberately.
-
Параллельная работа с git worktree вместо постоянных stash и переключений
git worktree add создаёт второй рабочий каталог, связанный с тем же репозиторием, поэтому срочное исправление, ревью или задача агента могут выполняться в собственной ветке, не затрагивая текущую рабочую копию. Ветка может быть выбрана только в одном рабочем дереве одновременно; рабочие деревья удаляют через git worktree remove, а не rm.
Машиночитаемо: JSON