reposting this from twitter:
someone on discord asked for a quick shell script to burn a small amount (like 10%) of CPU time and we came up with this:
tr '\0' : < /dev/zero | while read -n 128 _it; do sleep 0.01; echo $_it | dd of=/dev/null 2>/dev/null; done
it turns the infinite stream of nulls into an infinite stream of colons, reads it 128 bytes at a time, waits a bit (adjust as necessary) then writes it into the bit bucket 128 bytes at a time.
once the caches warm up, this casually burns cpu time by context-switching and IO