Mand.
Short answers for your AI.
Before. After.
Does Python have a switch statement?
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
breakneeded. - 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)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.
How do I undo my last git commit but keep the changes?
Use a soft reset:
git reset --soft HEAD~1This 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.
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.
How do I delete all Docker containers, images and volumes to free up disk space?
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 detailThe one-liner (nuclear option)
docker system prune -a --volumesThis 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 -fPiece 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 networksmacOS-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.
Run this to remove all stopped containers, unused images, networks, build cache and volumes:
docker stop $(docker ps -q)
docker system prune -a --volumesThis permanently deletes all volume data, including any databases stored in them. Skip --volumes if you want to keep that data.
Heeft Python een switch-statement?
Ja, sinds Python 3.10 heeft Python het match-statement (structural pattern matching, PEP 634). Het lijkt op een switch, maar kan meer:
def http_status(code):
match code:
case 200:
return "OK"
case 404:
return "Not Found"
case 500 | 502 | 503: # meerdere waarden
return "Server error"
case _: # default
return "Onbekend"Verschillen met een klassieke switch:
- Geen
breaknodig: er is geen fall-through, alleen de eerste passendecasewordt uitgevoerd. _is de wildcard (dedefault).- Je kunt op structuur matchen, niet alleen op waarden:
match punt:
case (0, 0):
print("Oorsprong")
case (x, 0):
print(f"Op de x-as, x={x}")
case (x, y) if x == y: # guard
print("Op de diagonaal")
case {"type": "cirkel", "r": r}: # dicts
print(f"Cirkel met straal {r}")
case Punt(x=0, y=y): # objecten/dataclasses
print(f"Op de y-as, y={y}")Let op: een losse naam in een case is een capture, geen vergelijking. case STATUS_OK: matcht dus alles en kent de waarde toe aan STATUS_OK. Gebruik een gestippelde naam (case Status.OK:) of een letterlijke waarde om te vergelijken.
Vóór 3.10 gebruikte je meestal if/elif/else of een dictionary:
acties = {"start": start, "stop": stop}
acties.get(commando, onbekend)()Ja, sinds Python 3.10 met match/case (structural pattern matching). Daarvoor gebruikte je if/elif of een dict.
match status:
case 200:
print("OK")
case 404:
print("Niet gevonden")
case _:
print("Iets anders")Hoe maak ik mijn laatste git-commit ongedaan maar houd ik de wijzigingen?
Gebruik git reset met --soft of --mixed:
git reset --soft HEAD~1De commit verdwijnt, maar je wijzigingen blijven gestaged (klaar om opnieuw te committen).
git reset HEAD~1 # zelfde als --mixedDe commit verdwijnt, je wijzigingen blijven in je werkmap maar zijn niet gestaged.
Let op:
- Gebruik niet
--hard, want dan ben je de wijzigingen kwijt. - Is de commit al gepusht? Dan herschrijf je met
resetde geschiedenis en moet je force-pushen (git push --force-with-lease). Op een gedeelde branch isgit revert HEADveiliger. Dat maakt een nieuwe commit die de vorige ongedaan maakt. - Wil je alleen het commitbericht of de inhoud aanpassen? Dan volstaat
git commit --amend.
Gebruik git reset --soft HEAD~1. De commit verdwijnt, maar je wijzigingen blijven staan en blijven gestaged.
Wil je ze ook unstagen, gebruik dan git reset HEAD~1. Heb je de commit al gepusht, gebruik dan liever git revert HEAD, anders moet je force-pushen.
Hoe verwijder ik alle Docker-containers, images en volumes om schijfruimte vrij te maken?
Je kunt dit het beste stap voor stap doen. Bekijk eerst wat er ruimte inneemt en voer daarna pas de opruimcommando's uit.
1. Kijk wat er ruimte inneemt
docker system dfVoor meer detail per image, container en volume:
docker system df -v2. Alles in één keer opruimen
docker system prune -a --volumesDit verwijdert:
- alle gestopte containers
- alle ongebruikte images (
-a: ook images met een tag, niet alleen "dangling") - alle ongebruikte netwerken
- alle ongebruikte volumes (
--volumes) - de build cache
Docker vraagt om bevestiging. Met -f sla je die vraag over.
3. Ook draaiende containers verwijderen (echt alles)
prune laat draaiende containers en hun images en volumes staan. Wil je een volledig schone lei:
docker stop $(docker ps -q) # stop alle draaiende containers
docker rm -f $(docker ps -aq) # verwijder alle containers
docker rmi -f $(docker images -aq) # verwijder alle images
docker volume rm $(docker volume ls -q) # verwijder alle volumes
docker builder prune -a -f # verwijder de build cachePer onderdeel (selectiever)
docker container prune # gestopte containers
docker image prune -a # ongebruikte images
docker volume prune -a # ongebruikte volumes (-a ook voor named volumes, Docker ≥ 23)
docker builder prune -a # build cache⚠️ Let op
- Volumes bevatten vaak data, zoals databases van lokale dev-omgevingen. Na verwijderen is die data weg. Controleer eerst met
docker volume lsof je iets wilt bewaren. - Docker Desktop op macOS: de schijfruimte zit in een virtuele disk (
Docker.raw). Die krimpt niet altijd meteen. Zie je geen verschil, gebruik dan in Docker Desktop Troubleshoot → Clean / Purge data, of verklein de disk limit onder Settings → Resources.
Zal ik eerst docker system df voor je uitvoeren, zodat je ziet hoeveel er vrij te maken valt?
Gebruik docker system prune. Dit verwijdert alle gestopte containers, ongebruikte images, netwerken, volumes en de build-cache:
docker system prune -a --volumesWil je ook draaiende containers weg, stop en verwijder die eerst:
docker rm -f $(docker ps -aq)Let op: volumes bevatten vaak data, zoals databases. Die ben je daarna definitief kwijt. Controleer met docker system df hoeveel ruimte je terugkrijgt.
Install
In Claude Code:
/plugin marketplace add incentro-ic/mand/plugin install mand@mandUnzip into ~/.claude/skills/, or upload the zip as a skill in Claude.ai.
curl -L -o mand.zip https://github.com/incentro-ic/mand/releases/latest/download/mand.zip && unzip mand.zip -d ~/.claude/skills/Copy the skill folder into your skills directory:
git clone https://github.com/incentro-ic/mand.git && cp -r mand/skills/mand ~/.claude/skills/mandAnother agent? Codex reads ~/.codex/skills/ and Copilot ~/.copilot/skills/. Gemini CLI and most others read .agents/skills/ in your project.
How to use
Add “Mand.” to your question.
How much does it cost to host this on AWS? Mand.Reply “Mand.” to a long answer. You get the TL;DR.
Mand.Or type the command:
/mand:mand/mand:mandwith the plugin,/mandwith the zip or manual install.
The rules
- Answer first. No intro, no restating the question.
- Only what was asked. No history, no extra tips, no recap.
- Plain words. Short sentences, no jargon you didn’t use first.
- No filler. No “great question”, no hedges, no asides.
- Prose by default. Lists only when you’ll scan or compare.
- One example, max. Only if it saves explaining.
- Short question, short answer. “Yes, since Python 3.7.”
- Short, never wrong. Caveats about safety, data or money stay.
- Code stays whole. Complete and runnable. Only the prose gets cut.
- Your language. Ask in Dutch, get Dutch.
- Want more? Ask. You get the detail, then it’s short again.