From b71207ca51d50c7b10817fb16ba51d59f756e369 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sun, 7 Jul 2019 20:22:32 +0200 Subject: [PATCH] Add helper scripts for finding and loading active repos (on github) [ci skip] --- scripts/find-active.sh | 10 ++++++++++ scripts/load-active.sh | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 scripts/find-active.sh create mode 100755 scripts/load-active.sh diff --git a/scripts/find-active.sh b/scripts/find-active.sh new file mode 100755 index 0000000..14c5a73 --- /dev/null +++ b/scripts/find-active.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +set -e + +DIR=${1:-repos} + +for url in $(./scripts/list.sh "${DIR}") +do + (curl "${url}" --silent | grep -q hitsofcode) && echo "${url}" +done diff --git a/scripts/load-active.sh b/scripts/load-active.sh new file mode 100755 index 0000000..497160f --- /dev/null +++ b/scripts/load-active.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +set -e + +ACTIVE=${1} + +if [ -z "${ACTIVE}" ] +then + echo "Usage: $0 " + exit 1 +fi + +while IFS= read -r url +do + imgs=$(curl "${url}" --silent | grep hitsofcode | grep -o -P 'https://camo.githubusercontent.com/[a-z0-9]+/[a-z0-9]+') + [ -z "${imgs}" ] || echo "${url}" + for img in ${imgs} + do + curl "$img" --silent > /dev/null + done +done < "${ACTIVE}"