Skip to content

Instantly share code, notes, and snippets.

@barhoring
Created December 3, 2021 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barhoring/cfdce6c3d25addcacbd7ccf8f446a04b to your computer and use it in GitHub Desktop.
Save barhoring/cfdce6c3d25addcacbd7ccf8f446a04b to your computer and use it in GitHub Desktop.
codepen to git
# run like:
# LINK=https://codepen-api-export-production.s3.us-west-2.amazonaws.com/zip/PEN/*********/*****************/2a-end-flexbox-grid-system.zip
# sh gitpen.sh $LINK
# example
# sh gitpen.sh https://codepen-api-export-production.s3.us-west-2.amazonaws.com/zip/PEN/*********/*****************/2a-end-flexbox-grid-system.zip
#
MYVAR=$1
NAME="${MYVAR#http://}"
NAME=${NAME##*/}
printf "fetching $NAME...\n"
curl $1 -O -J -L -s
printf "unzipping $NAME...\n"
unzip -qq $NAME
# delete the downloaded .zip file
rm -rf $NAME
NAME=${NAME%.*}
cd $NAME
git init > /dev/null
COMMIT_NAME="${NAME} - initial commit"
git add --all
git commit -m "$COMMIT_NAME" --quiet
printf "created $NAME\n"
printf "run: \n cd $NAME\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment