RagingTiger / Omega-Notebook

The Jupyter Docker Image for all your ML/AI/DS needs.
0 stars 0 forks source link

Getting List of Python Packages From ALL GitHub User's Repos #4

Closed RagingTiger closed 1 year ago

RagingTiger commented 1 year ago

First, how to get all GitHub user's repos:

#!/bin/bash

# This BASH script clones all github.com repositories for a specified user!
# HOW TO USE THE SCRIPT: 
# CD to the directory where you want to download all the repositories (or open terminal there)
# then execute the script by defining the path to where you saved the .sh file, followed by your Github username:
# "sh the/path/to/download-all-repos.sh <github_user_name_here>"
# Then hit RETURN and watch the magic happen

if [ $# -eq 0 ]
  then
    echo "ERROR: Github username is missing, you shoud type THIS in your terminal: "
    echo "$0 <github_user_name_here> "
    exit;
fi

# set user var
GITHUB_USER=$1

# clone all repos into github user dir
mkdir $GITHUB_USER && \
cd $GITHUB_USER && \
for repo in `curl -s https://api.github.com/users/$GITHUB_USER/repos?per_page=1000 | grep clone_url | awk '{print $2}'| sed 's/"\(.*\)",/\1/'`;do
  git clone $repo;
done;

References:

RagingTiger commented 1 year ago

Second how to generate a requirements.txt file from all their repos:

pipreqsnb $GITHUB_USER_REPOS_DIR

References:

RagingTiger commented 1 year ago

Additional references on using GitHub API:

RagingTiger commented 1 year ago

Strategy no longer relevant