Skip to content

eppingere/gpi-url-shortener

Repository files navigation

gpi-url-shortener

A demo of how github can be made into a url shortener

Made for CMU GPI to help students learn git.

Getting started using your own url shortener

  1. Fork this repo
  2. Clone your forked repo. If you have ssh setup:
git clone git@github.com:[your github username]/gpi-url-shortener.git

Everyone else:

git clone https://github.com/[your github username]/gpi-url-shortener.git
  1. Rename the example_github_config.py to github_config.py, add your github username or custom github url in the file, and put the absolute path to your repo. Remember that when inside the repo pwd can give you the current directory's absolute path.
  2. Make sure that you have ssh keys setup for your github. If you are not sure how to do this, you can follow this tutorial.
  3. Add to your .bashrc, .bash_profle, .zshrc, etc. the following:
shortenurl(){
  current_dir=$(pwd)
  cd /ABSOLUTE/PATH/TO/gpi-url-shortener/
  python3 url_shortener.py
  cd $current_dir
}

Don't forget to re-source your rc file!!

  1. In the repository settings turn on ghpages from the master branch
  2. You're all set!! Simply from terminal run:
shortenurl

And you should be walked through the process of shortening a url.

You should see something like this:

what url do you want to shorten?
url to be shortened: http(s)://thebomb.com.net.gov
shorten to https://[your github id].github.io/gpi-url-shortener/this_is_super_short
doing some stuff....
url has been shortened to: https://[your github id].github.io/gpi-url-shortener/this_is_super_short/
it might take ~5 mins for the link to become active
  1. If you have a custom domain you want to use with your url shortener, you can set it up for the github repo by following the instructions here.

Have fun and let us know if you have any questions on piazza!!!

Don't forget to hit the quan and yell YEAAAAAHHHH DONNER 👌 👌 👌 👌

About

A demo of how github can be made into a url shortener

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published