Mand.

Short answers for your AI.

Cartoon of meneer Mandje

Before. After.

Does Python have a switch statement?

Without

Yes — since Python 3.10, there's the match statement (structural pattern matching), which covers switch-style use and more:

def http_status(code):
    match code:
        case 200:
            return "OK"
        case 404:
            return "Not Found"
        case 500 | 502 | 503:
            return "Server Error"
        case _:
            return "Unknown"

Key points:

  • case _: is the default/fallback.
  • | combines alternatives.
  • No fall-through between cases, so no break needed.
  • It can also destructure data:
match point:
    case (0, 0):
        print("Origin")
    case (x, 0):
        print(f"On x-axis at {x}")
    case {"type": "circle", "radius": r}:
        print(f"Circle with radius {r}")
    case Point(x=x, y=y) if x == y:
        print("On the diagonal")

Gotcha: a bare name in a case is a capture pattern, not a comparison. case RED: matches anything and binds it to RED. To compare against a constant, use a dotted name like case Color.RED:.

Before 3.10, the usual alternatives were if/elif chains or a dict lookup:

handlers = {"add": add, "sub": sub}
result = handlers.get(op, default_handler)(a, b)
167 words
Mand.

Not a classic one, but since Python 3.10 match does the same job and more:

match command:
    case "start":
        run()
    case "stop":
        halt()
    case _:
        print("unknown")

Before 3.10, people used if/elif chains or a dict of functions.

39 words

How do I undo my last git commit but keep the changes?

Without

Use a soft reset:

git reset --soft HEAD~1

This removes the last commit but keeps its changes staged, ready to recommit.

Variants:

  • git reset HEAD~1 (same as --mixed): undoes the commit and keeps the changes, but unstaged.
  • git reset --hard HEAD~1: discards the changes entirely. Avoid this if you want to keep your work.

If you already pushed the commit, resetting rewrites history, and you'd need to force-push (git push --force-with-lease). On shared branches, git revert HEAD is usually safer. It creates a new commit that undoes the last one without rewriting history, though it doesn't leave the changes in your working tree.

If you just want to fix the commit (message or contents), git commit --amend is often simpler than resetting.

126 words
Mand.

Run git reset --soft HEAD~1. It removes the commit and leaves the changes staged. Use git reset HEAD~1 instead if you want them unstaged. If you already pushed the commit, others may have it, so pushing after this needs a force push.

42 words

How do I delete all Docker containers, images and volumes to free up disk space?

Without

Here's how to wipe Docker's disk usage. All of these are destructive and irreversible — volumes especially may hold database data you can't recover.

Check what's using space first

docker system df        # summary
docker system df -v     # per-image/container/volume detail

The one-liner (nuclear option)

docker system prune -a --volumes

This removes:

  • all stopped containers
  • all images not used by a running container (-a; without it, only dangling images)
  • all unused networks
  • all unused volumes (--volumes)
  • all build cache

Add -f to skip the confirmation prompt.

Note: it won't touch anything in use by running containers. To truly delete everything, stop and remove those first:

docker stop $(docker ps -q)
docker rm -f $(docker ps -aq)
docker system prune -a --volumes -f

Piece by piece (if you want more control)

docker container prune          # stopped containers
docker image prune -a           # unused images
docker volume prune -a          # unused volumes (-a includes named volumes, Docker 23+)
docker builder prune -a         # build cache — often the biggest hog
docker network prune            # unused networks

macOS-specific tip

On Docker Desktop, all of this lives in a single VM disk image that doesn't always shrink automatically after pruning. If Finder still shows the space as used:

  • Docker Desktop → Settings → Resources → Advanced → lower the "Virtual disk limit", or
  • Troubleshoot (bug icon) → Clean / Purge data — resets everything and reclaims the full disk image.

If you want, I can run docker system df for you to see where the space is going before you delete anything.

277 words
Mand.

Run this to remove all stopped containers, unused images, networks, build cache and volumes:

docker stop $(docker ps -q)
docker system prune -a --volumes

This permanently deletes all volume data, including any databases stored in them. Skip --volumes if you want to keep that data.

47 words

Install

In Claude Code:

/plugin marketplace add incentro-ic/mand
/plugin install mand@mand

How to use

  1. Add “Mand.” to your question.

    How much does it cost to host this on AWS? Mand.
  2. Reply “Mand.” to a long answer. You get the TL;DR.

    Mand.
  3. Or type the command: /mand:mand with the plugin, /mand with the zip or manual install.

    /mand:mand

The rules

  1. Answer first. No intro, no restating the question.
  2. Only what was asked. No history, no extra tips, no recap.
  3. Plain words. Short sentences, no jargon you didn’t use first.
  4. No filler. No “great question”, no hedges, no asides.
  5. Prose by default. Lists only when you’ll scan or compare.
  6. One example, max. Only if it saves explaining.
  7. Short question, short answer. “Yes, since Python 3.7.”
  8. Short, never wrong. Caveats about safety, data or money stay.
  9. Code stays whole. Complete and runnable. Only the prose gets cut.
  10. Your language. Ask in Dutch, get Dutch.
  11. Want more? Ask. You get the detail, then it’s short again.