Clamp (@clampdown19) header
Clamp (@clampdown19) profile picture

Founder of @AgentScoutHQ. Building a daily-tested directory of AI agents & MCP servers. Notes, stacks, real numbers.

Joined September 2023
Pinned Tweet
AgentScout now tracks 6,000+ AI agent tools. 3,200+ MCP servers. Daily link checks. Live handshake tests. Fresh listings every morning. Find the right agent for the job in seconds, free. agentscouthq.com
18
Still installing dotenv just to read a .env file? Node can load it itself. node --env-file=.env server.js It's built in since Node 20.6. Variables already set in the real environment win over the file, so a stray .env won't override production settings. Put the flag before the script name, or Node hands it to your script as an argument instead.
1
19
A cron job that runs every 5 minutes but sometimes takes 7 will end up running twice at once. Wrap it in flock. */5 * * * * flock -n /tmp/sync.lock /usr/local/bin/sync.sh With -n, a new run exits right away if the last one still holds the lock. The lock is released when the process exits, even if it crashes, so there's no stale lock to clean up.
21
Every fetch() in my scripts gets a timeout now. fetch has no timeout option, and a hung API can stall a job for minutes. fetch(url, { signal: AbortSignal.timeout(5000) }) After 5 seconds it rejects with a TimeoutError. Catch that, log which URL it was, and decide whether to retry or fail the job.
2
1
49
Setting a session cookie? Three flags do most of the work. HttpOnly keeps JavaScript, including injected scripts, from reading it. Secure sends it only over HTTPS. SameSite=Lax keeps it off most cross-site requests, which blocks a lot of CSRF. Set all three yourself. Some browsers treat a cookie with no SameSite as Lax, but not all of them do.
28
Want to know when your TLS certificate actually expires, not when you think it renews? Ask the server. echo | openssl s_client -connect "$HOST:443" -servername "$HOST" 2>/dev/null | openssl x509 -noout -enddate Keep -servername. Without it, a server hosting several sites can return a different certificate than your visitors get. Swap -enddate for -checkend 1209600 and it exits non-zero inside 14 days, which is easy to alert on.
20
Postgres won't stop a runaway query on its own. Set statement_timeout on your app's role. ALTER ROLE app_user SET statement_timeout = '5s'; New sessions for that role cancel any statement that runs longer than 5 seconds. Pooled connections pick it up when they reconnect, and a migration that needs longer can raise it for its own session.
1
27
Seeing "database is locked" from SQLite once a second request shows up? Turn on WAL mode. PRAGMA journal_mode=WAL lets reads keep going while a write happens. It's stored in the database file, so you set it once. There's still one writer at a time, so also set PRAGMA busy_timeout=5000 on every connection. A second writer then waits up to 5 seconds instead of failing right away.
34
Want only the certificate authorities you actually use to be able to issue for your domain? Add a CAA record. Add an issue entry for each CA you use, for example 0 issue "letsencrypt.org". dig CAA yourdomain shows what's set now. List every CA that issues for you, including your CDN's, or the next renewal fails. Public CAs have to check CAA before they issue.
32
About to run git clean to get a fresh tree? Run it with -n first. git clean -n -d prints every untracked file and folder it would delete and touches nothing. Untracked files aren't in Git, so once they're gone, Git can't bring them back. Be extra careful with -x. It also removes ignored files, which means your .env and local config go too.
20
Cron job runs fine when you paste it in a terminal but does nothing from crontab? Check for a %. In a crontab line, % means newline, so date +%F cuts your command off right there. Escape it as \%F. The other usual suspect is PATH. Cron's is minimal, so set PATH at the top of the crontab or use full paths. Moving the command into a script avoids both.
26
Put your site behind Cloudflare and the origin still gets every page request? Check cf-cache-status. By default Cloudflare caches static files like images, CSS and JS, but not HTML. curl -sI your page and you'll see cf-cache-status: DYNAMIC. To cache pages, add a Cache Rule set to Eligible for cache, and bypass it for anything personal, like logged-in or admin paths.
30
Giving a cron job, a dashboard or an AI agent access to your Stripe account? Don't hand it your secret key. Make a restricted key. In the Stripe dashboard, a restricted key starts with rk_ and you set each resource to None, Read or Write. A revenue report only needs Read on charges and subscriptions. One key per job also means you can revoke one leaked key without breaking everything else.
1
25
Added another email tool and your mail started landing in spam? Count the DNS lookups in your SPF record. SPF allows 10. Every include, a, mx, ptr, exists and redirect counts, and so does every include inside those includes. ip4 and ip6 entries don't. Go over 10 and the check returns permerror, which receivers can treat as a fail for all of your mail. Remove senders you no longer use before you add a new one.
2
35
Adding an index to a busy Postgres table? Use CREATE INDEX CONCURRENTLY. A plain CREATE INDEX blocks inserts and updates on that table until it finishes. The concurrent version lets writes continue. It's slower, and it can't run inside a transaction block, so watch for migration tools that wrap every step in one. If it fails partway, it leaves an INVALID index behind. Drop it and run it again.
19
Need to test what your app does when a trial ends or a subscription renews? Don't wait a month. Use a Stripe test clock. In test mode, create a clock, create a customer on it, and subscribe them. Then advance the clock past the trial or period end. Stripe runs the renewal, the invoice and the webhooks as if that time had passed, so you can watch your handler deal with each one.
1
2
38
Rebasing a long-lived branch and fixing the same conflict every time? git config --global rerere.enabled true Git then records how you resolved each conflict, and when the same hunk conflicts again, it applies your earlier fix for you. Give it a look before you git add, since the code around it may have changed.
32
Using npm install in your CI pipeline? Switch it to npm ci. npm ci installs exactly what package-lock.json says. If the lockfile and package.json disagree, it fails instead of quietly updating the lock, and it never writes to either file. It also removes any existing node_modules first, so every build starts clean.
39
Firing off an analytics or log call in a Cloudflare Worker without awaiting it? It can get cut off once the response goes out. Pass the promise to ctx.waitUntil(). The response still returns right away, and the Worker stays alive until that work finishes. Awaiting it instead works too, but then your user waits on your logging.
24