New fzf aliases and shortCuts
This commit is contained in:
parent
874c53d8e6
commit
225fe5b043
4 changed files with 80 additions and 16 deletions
|
@ -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."
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue