Skip to content

Instantly share code, notes, and snippets.

@copoer
Forked from erdincay/sugh.sh
Last active July 16, 2024 12:58
Show Gist options
  • Select an option

  • Save copoer/a0344872ff9963024aebcbb79efdf72d to your computer and use it in GitHub Desktop.

Select an option

Save copoer/a0344872ff9963024aebcbb79efdf72d to your computer and use it in GitHub Desktop.

Revisions

  1. copoer revised this gist Jan 9, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gitbackup.sh
    Original file line number Diff line number Diff line change
    @@ -30,4 +30,7 @@ do
    fi
    done

    # Pull Everything
    ls | xargs -P10 -I{} git -C {} pull

    exit 0
  2. copoer renamed this gist Jan 9, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. copoer revised this gist Jan 9, 2023. 1 changed file with 24 additions and 21 deletions.
    45 changes: 24 additions & 21 deletions sugh.sh
    Original file line number Diff line number Diff line change
    @@ -1,30 +1,33 @@
    #!/bin/bash

    if [ -z "$1" ]; then
    echo "waiting for the following arguments: username + max-page-number"
    exit 1
    else
    name=$1
    fi

    if [ -z "$2" ]; then
    max=2
    else
    max=$2
    fi

    name="copoer"
    cntx="users"
    page=1

    echo $name
    echo $max
    echo $cntx
    echo $page

    until (( $page -lt $max ))
    do
    curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | grep -e 'clone_url*' | cut -d \" -f 4 | xargs -L1 git clone
    $page=$page+1
    START=1
    END=3
    for (( page=$START; page<=$END; page++ ))
    do
    res=$(curl -s "https://gitlab.com/api/v4/$cntx/$name/projects?page=$page&per_page=100" | jq '.[]')
    if [[ $res == *"http_url_to_repo"* ]]; then
    echo $res | jq .'http_url_to_repo' | xargs -L1 git clone
    else
    echo "done git lab"
    break
    fi
    done

    for (( page=$START; page<=$END; page++ ))
    do
    res=$(curl -s "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | jq '.[]')
    if [[ $res == *"clone_url"* ]]; then
    echo $res | jq .'clone_url' | xargs -L1 git clone
    else
    echo "done git hub"
    break
    fi
    done

    exit 0
    exit 0
  4. @erdincay erdincay revised this gist Apr 11, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sugh.sh
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ echo $page

    until (( $page -lt $max ))
    do
    curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
    curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | grep -e 'clone_url*' | cut -d \" -f 4 | xargs -L1 git clone
    $page=$page+1
    done

  5. @erdincay erdincay renamed this gist Sep 17, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @erdincay erdincay revised this gist Sep 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sug.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    if [ -z "$1" ]; then
    echo "waiting for the following arguments: username + max-page-number"
    exit 0
    exit 1
    else
    name=$1
    fi
  7. @erdincay erdincay revised this gist Sep 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sug.sh
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ echo $page
    until (( $page -lt $max ))
    do
    curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
    $page=$page-1
    $page=$page+1
    done

    exit 0
  8. @erdincay erdincay created this gist Sep 17, 2018.
    30 changes: 30 additions & 0 deletions sug.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #!/bin/bash

    if [ -z "$1" ]; then
    echo "waiting for the following arguments: username + max-page-number"
    exit 0
    else
    name=$1
    fi

    if [ -z "$2" ]; then
    max=2
    else
    max=$2
    fi

    cntx="users"
    page=1

    echo $name
    echo $max
    echo $cntx
    echo $page

    until (( $page -lt $max ))
    do
    curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
    $page=$page-1
    done

    exit 0