New fzf aliases and shortCuts

This commit is contained in:
Jonathan Hodgson 2019-10-18 09:02:22 +01:00
parent 874c53d8e6
commit 225fe5b043
4 changed files with 80 additions and 16 deletions

View file

@ -148,7 +148,8 @@ alias updateTime="sudo ntpd -qg"
# Keyboard - reset
# Sometimes, if I turn the screens off, the keyboard resets itself to defaults. Not sure why but this will put my keyboard back to how I like it
alias kb="xmodmap ~/.Xmodmap; xset r rate 200 70; xcape"
#alias kb="xmodmap ~/.Xmodmap; xset r rate 200 70; xcape"
alias kb="setxkbmap -layout gb,gb -variant \"colemak,\" -option grp:shifts_toggle; xset r rate 200 70; xinput --list | grep -E 'ErgoDox EZ ErgoDox EZ\s+id' | grep -oE 'id=[0-9]+' | cut -d'=' -f2 | xargs setxkbmap -layout gb -device"
alias colemak="setxkbmap -layout gb,gb -variant \"colemak,\" -option grp:shifts_toggle"
alias qwerty="setxkbmap -layout gb"
@ -157,7 +158,7 @@ alias ol="open-local"
alias globalip="drill myip.opendns.com @resolver1.opendns.com | sed -n '/ANSWER SECTION/,/AUTHORITY SECTION/ p' | sed -n '2 p' | awk '{print \$5}'"
alias ss="cat /usr/share/exploitdb/files_exploits.csv | fzf | cut -d',' -f1 | xargs searchsploit -m"
alias ss="tail -n +2 /usr/share/exploitdb/files_exploits.csv | awk -F ',' '{print \$2 \"\t\" \$3 \"\t(\" \$1 \")\"}' | fzf --preview-window=up --preview='echo {} | cut -d\" \" -f1 | xargs echo \"/usr/share/exploitdb/\" | tr -d \" \" | xargs bat --color=always' | cut -d' ' -f3 | tr -d \"()\" | xargs searchsploit -m"
alias ddg="ddgr"

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."
}