Limit process resources (cgroup) linux

Run a command in a transient systemd scope with resource limits

systemd-run --scope -p MemoryMax=512M -p CPUQuota=50% -- ./heavy.sh