Skip to content

Instantly share code, notes, and snippets.

@sbryant
Created June 6, 2014 19:47
Show Gist options
  • Save sbryant/8a22ca8f14884b1bd4d0 to your computer and use it in GitHub Desktop.
Save sbryant/8a22ca8f14884b1bd4d0 to your computer and use it in GitHub Desktop.
Repo data generate tools.
#!/usr/bin/env bash
number=$RANDOM
file_name=$1
repo=$2
cd $repo
read -n$number -s -r < /dev/urandom
printf "%s" $REPLY > $file_name
git add $file_name > /dev/null
git commit -m "Adding $1 to $2" > /dev/null
cd -
#!/usr/bin/env bash
num_commits=$1
num=$2
repo="$num-$(openssl rand -hex 20)"
mkdir $repo > /dev/null
# init repo
cd $repo
git init > /dev/null
cd -
if [[ "$num_commits" -gt "0" ]]; then
seq 1 $num_commits |
xargs -n1 -Iidx ./generate_commit.sh idx $repo
fi
#!/usr/bin/env bash
num_repos=$1
num_repos=${num_repos:-100}
num_commits=$2
num_commits=${num_commits:-100}
concurrency=$3
concurrency=${concurrency:-4}
seq 1 $num_repos |
xargs -n1 -P$concurrency -t ./generate_repo.sh $num_commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment