diff --git a/.config/zsh/.zsh_plugins.txt b/.config/zsh/.zsh_plugins.txt index 93e3b24..e9d9f4e 100644 --- a/.config/zsh/.zsh_plugins.txt +++ b/.config/zsh/.zsh_plugins.txt @@ -33,3 +33,6 @@ zsh-users/zsh-autosuggestions zsh-users/zsh-completions zdharma-continuum/fast-syntax-highlighting kind:defer zsh-users/zsh-history-substring-search + +# Managing Personal Scripts +ianthehenry/sd diff --git a/.config/zsh/.zsh_plugins.zsh b/.config/zsh/.zsh_plugins.zsh index b4f97c6..c5497f2 100644 --- a/.config/zsh/.zsh_plugins.zsh +++ b/.config/zsh/.zsh_plugins.zsh @@ -42,3 +42,5 @@ fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLA zsh-defer source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search ) source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ianthehenry-SLASH-sd ) +source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ianthehenry-SLASH-sd/sd.plugin.zsh diff --git a/scripts/luakit-adblock/adblock-update-list.sh b/scripts/luakit-adblock/adblock-update-list.sh deleted file mode 100755 index 5e80b83..0000000 --- a/scripts/luakit-adblock/adblock-update-list.sh +++ /dev/null @@ -1,9 +0,0 @@ - -value=$(<./adblock-list) - -echo $value - -for entry in $value - do - ./adblock-update.sh $entry -done diff --git a/scripts/get-pass.sh b/sd/get-pass.sh similarity index 100% rename from scripts/get-pass.sh rename to sd/get-pass.sh diff --git a/scripts/luakit-adblock/adblock-list b/sd/luakit-adblock/adblock-list similarity index 100% rename from scripts/luakit-adblock/adblock-list rename to sd/luakit-adblock/adblock-list diff --git a/sd/luakit-adblock/adblock-update-list.sh b/sd/luakit-adblock/adblock-update-list.sh new file mode 100755 index 0000000..439a662 --- /dev/null +++ b/sd/luakit-adblock/adblock-update-list.sh @@ -0,0 +1,15 @@ +#!/bin/bash +parent_path=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + pwd -P +) + +cd "$parent_path" + +value=$(<./adblock-list) + +echo $value + +for entry in $value; do + ./adblock-update.sh $entry +done diff --git a/scripts/luakit-adblock/adblock-update.sh b/sd/luakit-adblock/adblock-update.sh similarity index 77% rename from scripts/luakit-adblock/adblock-update.sh rename to sd/luakit-adblock/adblock-update.sh index 00dd704..d5dbea9 100755 --- a/scripts/luakit-adblock/adblock-update.sh +++ b/sd/luakit-adblock/adblock-update.sh @@ -7,10 +7,16 @@ # URL URL of the filterlist to download # -h, --help Display this help-message and exit +parent_path=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + pwd -P +) + +cd "$parent_path" + # help message -function usage () -{ -cat << EOF +function usage() { + cat < 1 ));then +elif (($# > 1)); then usage exit 11 fi @@ -43,7 +48,7 @@ fi wget -N --connect-timeout=10 --tries=20 --retry-connrefused --waitretry=5 ${listname} # if download failed move old file back in place -if (( $? != 0 )); then +if (($? != 0)); then [[ -f ${listname}.b ]] && cp -p ${listname}.b ${listname} && rm ${listname}.b echo "Error: List Download Failed!" exit 11 diff --git a/sd/usephp b/sd/usephp new file mode 100755 index 0000000..a9e325e --- /dev/null +++ b/sd/usephp @@ -0,0 +1,16 @@ +#!/bin/sh +[ "$#" -lt "1" ] && { + echo "Configure current shell to use a specific major PHP version. + + Usage: usephp 7" + exit 0 +} +binary="php${1}" +wanted="/usr/bin/${binary}" +[ ! -f "${wanted}" ] && { + echo "'${binary}' not found. Using 'php'." + wanted="/usr/bin/php" +} +ln -sf "${wanted}" "${HOME}/bin/php" +inUse=$(php -nr "echo phpversion();") +echo "Shell configured to use PHP ${inUse}." \ No newline at end of file