generated from me/template-mit
Compare commits
3 Commits
672d8d424a
...
40d6450428
| Author | SHA1 | Date | |
|---|---|---|---|
| 40d6450428 | |||
| 18b4ef7a8a | |||
| c0762fb23e |
+73
-2
@@ -257,7 +257,7 @@ function pull {
|
|||||||
|
|
||||||
function push {
|
function push {
|
||||||
if [[ -d .git ]]; then
|
if [[ -d .git ]]; then
|
||||||
git push && load-stage && load-prod
|
git push && eval load-stage && eval load-prod
|
||||||
else
|
else
|
||||||
send-master
|
send-master
|
||||||
fi
|
fi
|
||||||
@@ -479,7 +479,7 @@ function process-video {
|
|||||||
return $status
|
return $status
|
||||||
}
|
}
|
||||||
alias pv="process-video"
|
alias pv="process-video"
|
||||||
alias qpv="pv ./raw/YouCut*.mp4 $(basename `pwd`).mp4"
|
alias qpv='pv ./raw/YouCut*.mp4 $(basename `pwd`).mp4'
|
||||||
|
|
||||||
# Allow converting video to audio and other smaller
|
# Allow converting video to audio and other smaller
|
||||||
# tasks than what process-video is intended to do.
|
# tasks than what process-video is intended to do.
|
||||||
@@ -581,6 +581,75 @@ alias pull-audio="v2a"
|
|||||||
alias pa="v2a"
|
alias pa="v2a"
|
||||||
|
|
||||||
|
|
||||||
|
### Web ###
|
||||||
|
|
||||||
|
function download-website {
|
||||||
|
website="$1"
|
||||||
|
if [[ -z "$website" ]]; then
|
||||||
|
echo "ERROR: Website not provided. $website"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ "$website" != "http"* ]]; then
|
||||||
|
website="http://$website"
|
||||||
|
fi
|
||||||
|
# https://simpleit.rocks/linux/how-to-download-a-website-with-wget-the-right-way/
|
||||||
|
# Does not simplify the links for offline usage.
|
||||||
|
# wget --wait=2 \
|
||||||
|
# --level=inf \
|
||||||
|
# --limit-rate=20K \
|
||||||
|
# --recursive \
|
||||||
|
# --page-requisites \
|
||||||
|
# --user-agent=Mozilla \
|
||||||
|
# --no-parent \
|
||||||
|
# --convert-links \
|
||||||
|
# --adjust-extension \
|
||||||
|
# --no-clobber \
|
||||||
|
# -e robots=off \
|
||||||
|
# $website &&
|
||||||
|
|
||||||
|
# https://www.digitalcitizen.life/how-to-download-entire-website-for-offline-viewing/
|
||||||
|
# This one is supposed to work too and is much smaller.
|
||||||
|
# wget --mirror \
|
||||||
|
# --convert-links \
|
||||||
|
# --adjust-extension \
|
||||||
|
# --page-requisites \
|
||||||
|
# --no-parent \
|
||||||
|
# $website &&
|
||||||
|
|
||||||
|
# Combine the two by using mirow and removing the rate limit.
|
||||||
|
wget --mirror \
|
||||||
|
--wait=2 \
|
||||||
|
--level=inf \
|
||||||
|
--recursive \
|
||||||
|
--page-requisites \
|
||||||
|
--user-agent=Mozilla \
|
||||||
|
--no-parent \
|
||||||
|
--convert-links \
|
||||||
|
--adjust-extension \
|
||||||
|
--no-clobber \
|
||||||
|
-e robots=off \
|
||||||
|
--timeout=15 \
|
||||||
|
--tries=0 \
|
||||||
|
--continue \
|
||||||
|
--waitretry=5 \
|
||||||
|
--random-wait \
|
||||||
|
$website &&
|
||||||
|
{
|
||||||
|
echo -e "\nSuccess!"
|
||||||
|
} || {
|
||||||
|
echo -e "\nERROR: Command reported a failure. (Error code '$?')"
|
||||||
|
echo "This may mean that the URL was not converted to local links."
|
||||||
|
echo "Please check the error and contents and try again if needed."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alias website-download="download-website"
|
||||||
|
alias curl-site="download-website"
|
||||||
|
alias pull-site="download-website"
|
||||||
|
alias curl-www="download-website"
|
||||||
|
alias pull-www="download-website"
|
||||||
|
alias www-pull="download-website"
|
||||||
|
|
||||||
|
|
||||||
## Finalize ##
|
## Finalize ##
|
||||||
|
|
||||||
# Export all functions! #
|
# Export all functions! #
|
||||||
@@ -622,3 +691,5 @@ eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
|
|||||||
|
|
||||||
[[ $(whoami) != "root" ]] &&
|
[[ $(whoami) != "root" ]] &&
|
||||||
echo "`date` - Shared RC Config - Complete!"
|
echo "`date` - Shared RC Config - Complete!"
|
||||||
|
|
||||||
|
export _LOADED_SHARED_RC=true
|
||||||
|
|||||||
Reference in New Issue
Block a user