dp.cx blog

Posted on

Filed under mysql, work, pv, and shell

Some of the code at $job (sadly) uses blind inserts, which makes changes to the tables behind them tricky. We were about to embark on a series of changes to tables for our Data Warehouse project, and I needed to verify if anything would be affected by these table changes.

After looking around for a bit, not finding anything that worked well enough for me that was simple, I came up with the following:

_data=$( curl -s https://api.github.com/orgs/example.com/repos?per_page=500 \
| grep 'ssh_url' | tr ',' '\n' | cut -d\" -f4 | sort ); for repo in $_data; do \
git clone -q $repo; echo $repo;
done | pv -leps $( echo $_data | tr ' ' '\n' | wc -l ) > /dev/null

This clones each of our repos, but also uses one of my favorite utilities to keep progress for me. So I know that I have time to go to lunch while this runs, instead of sticking around, constantly wondering.