Last active
May 19, 2022 11:55
-
-
Save jpigla/6cb35af49003d905ed7679382e9d0b6c to your computer and use it in GitHub Desktop.
ZSH Functions (Shell)
This file contains 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 characters
# create requirements.txt from Jupyter Notebook file ($1 = name of file) | |
pipreqs_nb() { | |
if [ -z "$1" ]; then | |
echo "Select a notebook to convert" | |
else | |
{ | |
jupyter nbconvert --output-dir="./reqs" --to script $1.ipynb | |
cd reqs | |
pipreqs --force --mode gt | |
cp requirements.txt ../requirements.txt | |
cd .. | |
rm -rf reqs | |
} &> /dev/null | |
echo "requirements.txt created" | |
fi | |
} | |
check-statuscode() { | |
if [ -z "$1" ]; then | |
echo "Select a notebook to convert" | |
else: | |
result="$(curl -I $1 2>/dev/null | head -n 1 | cut -d$' ' -f2)" | |
echo $result | |
fi | |
} | |
check-redirect() { | |
if [ -z "$1" ]; then | |
echo "Select a notebook to convert" | |
else: | |
result="$(curl -LIsm 10 -o /dev/null -w %{url_effective} $1)" | |
echo $result | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.