Last active
December 27, 2022 20:20
Revisions
-
dbeley revised this gist
Jan 31, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ mkdir -p "$USER_DIR" [ -f "$USER_DIR/$USER.txt" ] && printf "##### $USER_DIR/$USER.txt file detected.\nDelete it if you want to update the repository list.\n" if [ ! -f "$USER_DIR/$USER.txt" ]; then printf "##### Extracting repos for $USER.\n" PAGE_NUMBER=`curl -sI "https://api.github.com/users/"$USER"/repos" | awk "/^link/" | cut -d? -f3` for PAGE in `seq 1 ${PAGE_NUMBER//[!0-9]/}`; do printf "##### Extracting starred repos from page $PAGE\n" URL="https://api.github.com/users/$USER/repos?page=$PAGE" -
dbeley revised this gist
Jan 20, 2021 . 1 changed file with 20 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,29 +8,34 @@ Usage: ./archive_github_user.sh [-h] USER } if [ "$1" == "-h" ]; then usage fi USER=$1 USER_DIR="$DIR/repos/$USER" mkdir -p "$USER_DIR" [ -f "$USER_DIR/$USER.txt" ] && printf "##### $USER_DIR/$USER.txt file detected.\nDelete it if you want to update the repository list.\n" if [ ! -f "$USER_DIR/$USER.txt" ]; then printf "##### Extracting repos for $USER.\n" PAGE_NUMBER=`curl -sI "https://api.github.com/users/"$USER"/repos" | awk "/^Link/" | cut -d? -f3` for PAGE in `seq 1 ${PAGE_NUMBER//[!0-9]/}`; do printf "##### Extracting starred repos from page $PAGE\n" URL="https://api.github.com/users/$USER/repos?page=$PAGE" curl -s "$URL" | jq -r '.[]|.html_url' >> "$USER_DIR/$USER.txt" done fi for URL in `cat "$USER_DIR/$USER".txt`; do REPO=`basename -s ".git" "$URL"` FOLDER="$USER_DIR/$REPO" if [ ! -d "$FOLDER" ] ; then printf "##### Cloning $URL in $FOLDER.\n" mkdir -p "$FOLDER" git clone $URL "$FOLDER" else printf "##### Updating $URL in $FOLDER.\n" cd "$FOLDER" git pull $URL cd "$DIR" fi done -
dbeley revised this gist
Jan 20, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ USER_DIR="$DIR/repos/$USER" mkdir -p "$USER_DIR" [ -f "$USER_DIR/$USER.txt" ] && printf "##### $USER_DIR/$USER.txt file detected.\nDelete it if you want to update the repository list.\n" if [ ! -f "$USER_DIR/$USER.txt" ]; then printf "##### Extracting repos for $USER.\n" curl -s https://api.github.com/users/"$USER"/repos | jq -r '.[]|.html_url' > "$USER_DIR/$USER".txt fi -
dbeley revised this gist
Jan 18, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,4 +33,4 @@ for URL in `cat "$USER_DIR/$USER".txt`; do git pull $URL cd "$DIR" fi done -
dbeley revised this gist
Jan 18, 2021 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,29 +8,29 @@ Usage: ./archive_github_user.sh [-h] USER } if [ "$1" == "-h" ]; then usage fi USER=$1 USER_DIR="$DIR/repos/$USER" mkdir -p "$USER_DIR" [ -f "$USER_DIR/$USER.txt" ] && printf "##### $USER_DIR/$USER.txt file detected.\nDelete it if you want to update the repository list.\n" if [! -f "$USER_DIR/$USER.txt" ]; then printf "##### Extracting repos for $USER.\n" curl -s https://api.github.com/users/"$USER"/repos | jq -r '.[]|.html_url' > "$USER_DIR/$USER".txt fi for URL in `cat "$USER_DIR/$USER".txt`; do REPO=`basename -s ".git" "$URL"` FOLDER="$USER_DIR/$REPO" if [ ! -d "$FOLDER" ] ; then printf "##### Cloning $URL in $FOLDER.\n" mkdir -p "$FOLDER" git clone $URL "$FOLDER" else printf "##### Updating $URL in $FOLDER.\n" cd "$FOLDER" git pull $URL cd "$DIR" fi done -
dbeley renamed this gist
Jan 18, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
dbeley created this gist
Jan 18, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/usr/bin/env bash set -eEu -o pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P)" usage() { printf "%s" "\ Usage: ./archive_github_user.sh [-h] USER "; exit 0; } if [ "$1" == "-h" ]; then usage fi USER=$1 USER_DIR="$DIR/repos/$USER" mkdir -p "$USER_DIR" [ -f "$USER_DIR/$USER.txt" ] && printf "##### $USER_DIR/$USER.txt file detected.\nDelete it if you want to update the repository list.\n" if [! -f "$USER_DIR/$USER.txt" ]; then printf "##### Extracting repos for $USER.\n" curl -s https://api.github.com/users/"$USER"/repos | jq -r '.[]|.html_url' > "$USER_DIR/$USER".txt fi for URL in `cat "$USER_DIR/$USER".txt`; do REPO=`basename -s ".git" "$URL"` FOLDER="$USER_DIR/$REPO" if [ ! -d "$FOLDER" ] ; then printf "##### Cloning $URL in $FOLDER.\n" mkdir -p "$FOLDER" git clone $URL "$FOLDER" else printf "##### Updating $URL in $FOLDER.\n" cd "$FOLDER" git pull $URL cd "$DIR" fi done