New fzf aliases and shortCuts

This commit is contained in:
Jonathan Hodgson 2019-10-18 09:02:22 +01:00
parent 23ce8e4e46
commit 54bcccfe08
4 changed files with 80 additions and 16 deletions

View file

@ -247,3 +247,47 @@ function ssh(){
source $HOME/.dotfiles/shells/zsh/current-color-scheme
fi
}
function proxy_on() {
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
if (( $# > 0 )); then
valid=$(echo $@ | sed -n 's/\([0-9]\{1,3\}.\?\)\{4\}:\([0-9]\+\)/&/p')
if [[ $valid != $@ ]]; then
>&2 echo "Invalid address"
return 1
fi
local proxy=$1
export http_proxy="$proxy" \
https_proxy=$proxy \
ftp_proxy=$proxy \
rsync_proxy=$proxy
echo "Proxy environment variable set."
return 0
fi
echo -n "username: "; read username
if [[ $username != "" ]]; then
echo -n "password: "
read -es password
local pre="$username:$password@"
fi
echo -n "server: "; read server
echo -n "port: "; read port
local proxy=$pre$server:$port
export http_proxy="$proxy" \
https_proxy=$proxy \
ftp_proxy=$proxy \
rsync_proxy=$proxy \
HTTP_PROXY=$proxy \
HTTPS_PROXY=$proxy \
FTP_PROXY=$proxy \
RSYNC_PROXY=$proxy
}
function proxy_off(){
unset http_proxy https_proxy ftp_proxy rsync_proxy \
HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY
echo -e "Proxy environment variable removed."
}