Skip to content

Instantly share code, notes, and snippets.

View peterp's full-sized avatar

Peter Pistorius peterp

View GitHub Profile

Good Prompting

I don't know that much about good writing.

But Paul Graham wrote something recently that has been stuck in my head. He says writing that sounds right helps you find ideas that are right. When he rereads a draft, he is asking if anything catches. Does anything feel wrong?

I think this is also true when working with agents.

Maybe good prompting is not getting the first prompt right.

@peterp
peterp / gist:40a307d2fc4ef44967ce8bca70f9dce1
Created April 27, 2026 19:28
provision.ts & vm.ts changes
// Build a "ready-to-work" rootfs by running an install hook inside a
// base rootfs, then freezing the result to a tarball.
//
// pnpm provision # incremental — runs only what changed
// pnpm provision --force # ignore the stamp, full rebuild
//
// Three speedups stack up:
//
// 1. Incremental base. After the first successful provision we use
// ./app.tar.gz itself as the base for re-provisions. apt-get
➜ x yarn rw build -v
[STARTED] Generating Prisma Client...
Prisma schema loaded from db/schema.prisma
✔ Generated Prisma Client (v5.9.1) to ./../node_modules/@prisma/client in 31ms
Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
@peterp
peterp / Dockerfile
Created May 30, 2023 13:22
Snaplet Instant Preview Databases PostgreSQL on Fly Machines
FROM postgres:14.4-alpine
COPY postgresql.conf /etc/postgresql/
COPY stop-postgres-on-idle.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/stop-postgres-on-idle.sh
RUN echo '* * * * * /usr/local/bin/stop-postgres-on-idle.sh' > /etc/crontabs/root
COPY custom-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/custom-entrypoint.sh
@peterp
peterp / 1.js
Last active June 2, 2022 13:37
Mapped data values with Copycat
faker.internet.email.()
'Elva67@hotmail.com'
faker.internet.email.()
'Lonny74@yahoo.com
'faker.internet.email.()
'Clara16@hotmail.com’
faker.internet.email.()
'Gaetano87@yahoo.com’
import { transformSync } from '@swc/core'
import path from 'path'
import { AliasPathResolver } from './index'
test('named `src` imports', () => {
// create resolved path.
const out = transformSync(
`
import { woof } from 'src/lib/dog.ts'
@peterp
peterp / svgs2pngs.sh
Created July 23, 2017 07:48
React Native: Convert SVG images to PNG images
#!/bin/sh
rsvg-convert -v > /dev/null 2>&1 || { echo "rsvg-convert is not installed, use: brew install librsvg." >&2; exit 1; }
ASSETS_FOLDER=$1
if [ "$ASSETS_FOLDER" == "" ]; then
echo "Usage: $0 /path/to/svg/assets/" >&2
exit 1
fi
@peterp
peterp / gist:5199702
Last active December 15, 2015 04:09
Regex to parse a URL.
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
\d]{2}))|[;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?
:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-
fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-
)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?
:\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!