Skip to content

Instantly share code, notes, and snippets.

@nari-ex
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nari-ex/136cbdd6f80ce3cbee14 to your computer and use it in GitHub Desktop.
Save nari-ex/136cbdd6f80ce3cbee14 to your computer and use it in GitHub Desktop.
#/bin/bash
set -euo pipefail
filepath=$1
# 10MBytes/sec
filesize=$(du -m ${filepath} | awk '{print $1}')
sleep_time=0.1
for num in $(seq 1 ${filesize});
do
truncate -s $((${filesize}-${num}))M ${filepath}
sleep ${sleep_time}
done
\rm ${filepath}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment