Skip to content

Instantly share code, notes, and snippets.

@DrI-T
Last active July 6, 2021 20:14
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 DrI-T/65cc6c19da28ead41952892e0ca077fe to your computer and use it in GitHub Desktop.
Save DrI-T/65cc6c19da28ead41952892e0ca077fe to your computer and use it in GitHub Desktop.
SHA-loose
#
# ----------------------------------------------------------
locate -e .git/objects/ | isfile.pl | perl -ne 'print "$1$2\n" if m,/([0-9a-f]{2})/([0-9a-f]{38})$,' | perl -S uniq.pl | gzip -c > objects-0.lof.gz
find ~ -not -path "*/blocks*" -type d -path '*.git/objects' 2>/dev/null | tee -a gitdirs.lof
find /data -not -path "*/blocks*" -type d -path '*.git/objects' 2>/dev/null | tee -a gitdirs.lof
find /media/michelc/ -not -path "*/blocks*" -type d -path '*.git/objects' 2>/dev/null | tee -a gitdirs.lof
mount /media/cloud/SWITCH
find /media/cloud/SWITCH -not -path "*/blocks*" -type d -path '*.git/objects' 2>/dev/null | tee -a gitdirs-cloud.lof
#sudo umount /media/cloud/SWITCH
find /keybase/private/michelc -type d -name 'objects' 2>/dev/null | grep -e '\.git' | tee gitdirs-kb.lof
cat gitdirs.lof | xargs -I{} find {} -type f | perl -ne 'print "$1$2\n" if m,/([0-9a-f]{2})/([0-9a-f]{38})$,' | perl -S uniq.pl | gzip -c > objects-1.lof.gz
zcat objects-0.lof.gz object-1.lof.gz | perl -S uniq.pl > sha-loose.txt
wc -l sha-loose.txt
xxd -r -p sha-loose.txt > sha-loose.dat
dat2png.pl -r 1 -o sha-loose.png sha-loose.dat
# ----------------------------------------------------------
cat gitdirs.lof | xargs -I{} git -C {} rev-list --objects --all | cut -d' ' -f1 | perl -S uniq.pl | gzip -c > objects-3.lof.gz
cat gitdirs.lof | while read gitdir; do
echo $gitdir
git -C $gitdir rev-list --objects --all | cut -d' ' -f1 | gzip -c >> objects-4.lof.gz
done
zcat objects-*.lof.gz| perl -S uniq.pl | gzip -9 -c > object-hashes.txt.gz
zcat object-hashes.txt.gz | wc -l
rm objects-*.lof.gz
if [ -e object-hashes.png.ots ]; then
ots upgrade object-hashes.png.ots
fi
zcat object-hashes.txt.gz | xxd -r -p > object-hashes.dat
dat2png.pl -r 1 -o object-hashes.png object-hashes.dat
ots stamp object-hashes.png
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment