Last active
September 10, 2020 15:44
-
-
Save Beefster09/58b526d5f11b3e173a4d611e30660dd4 to your computer and use it in GitHub Desktop.
Bash function for serving any directory with Python
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
# Little snippet for serving a directory with a simple http server | |
# This intended to be source'd from .bashrc | |
function serve-dir { | |
( | |
cd "${1:-.}" &&\ | |
python3 -m http.server "${2:-8080}" | |
) | |
} | |
# serve-dir snippet by Justin Snyder | |
# To the extent possible under law, the person who associated CC0 with | |
# serve-dir snippet has waived all copyright and related or neighboring rights | |
# to serve-dir snippet. | |
# You should have received a copy of the CC0 legalcode along with this | |
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment