forked from six/CryptoZSH
157 lines
4.2 KiB
Bash
Executable File
157 lines
4.2 KiB
Bash
Executable File
#Aliases
|
|
alias py='python3'
|
|
alias python='python3'
|
|
alias ratesx='curl rate.sx'
|
|
alias hash-identifier='python3 ~/.cryptozsh_tools/hash-identifier.py'
|
|
# Add yours :)
|
|
|
|
# Menuselect and requirements for v3das (changing this might break v3das)
|
|
autoload -U compinit
|
|
compinit
|
|
zstyle ':completion:*' menu select=2
|
|
|
|
# Make ctrl+backwards work
|
|
bindkey "^[[1;5C" emacs-forward-word
|
|
bindkey "^[[1;5D" emacs-backward-word
|
|
|
|
# History
|
|
HISTFILE=~/.zsh_history
|
|
HISTSIZE=69
|
|
SAVEHIST=50
|
|
setopt appendhistory
|
|
|
|
# Opts
|
|
setopt AUTO_CD
|
|
setopt COMPLETE_IN_WORD
|
|
setopt ALWAYS_TO_END
|
|
setopt PROMPT_SUBST
|
|
setopt interactivecomments
|
|
|
|
|
|
# Terminal colors
|
|
autoload colors; colors
|
|
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
|
|
eval PR_$COLOR='%{$fg_no_bold[${(L)COLOR}]%}'
|
|
eval PR_BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
|
|
done
|
|
eval RESET='$reset_color'
|
|
export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK
|
|
export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE
|
|
export PR_BOLD_WHITE PR_BOLD_BLACK
|
|
# Clear LSCOLORS
|
|
#unset LSCOLORS
|
|
#export CLICOLOR=1
|
|
#export LS_COLORS=exfxcxdxbxegedabagacad
|
|
|
|
|
|
# Prompt
|
|
function git_prompt_info {
|
|
local ref=$(=git symbolic-ref HEAD 2> /dev/null)
|
|
local gitst="$(=git status 2> /dev/null)"
|
|
|
|
if [[ -f .git/MERGE_HEAD ]]; then
|
|
if [[ ${gitst} =~ "unmerged" ]]; then
|
|
gitstatus=" %{$fg[red]%}unmerged%{$reset_color%}"
|
|
else
|
|
gitstatus=" %{$fg[green]%}merged%{$reset_color%}"
|
|
fi
|
|
elif [[ ${gitst} =~ "Changes to be committed" ]]; then
|
|
gitstatus=" %{$fg[blue]%}!%{$reset_color%}"
|
|
elif [[ ${gitst} =~ "use \"git add" ]]; then
|
|
gitstatus=" %{$fg[red]%}!%{$reset_color%}"
|
|
elif [[ -n `git checkout HEAD 2> /dev/null | grep ahead` ]]; then
|
|
gitstatus=" %{$fg[yellow]%}*%{$reset_color%}"
|
|
else
|
|
gitstatus=''
|
|
fi
|
|
|
|
if [[ -n $ref ]]; then
|
|
echo "%{$fg_bold[green]%}/${ref#refs/heads/}%{$reset_color%}$gitstatus"
|
|
fi
|
|
}
|
|
PROMPT='%{$fg[yellow]%}$(whoami)%{$reset_color%} %~%<< $(git_prompt_info) ${PR_BOLD_WHITE}>%{${reset_color}%} '
|
|
|
|
|
|
# btc price check on coindesk
|
|
function btcp {
|
|
#. torsocks on # Turn on for extra security
|
|
echo "BTC price on CoinDesk "
|
|
curl -s https://api.coindesk.com/v1/bpi/currentprice.json | cut -d '"' -f 38
|
|
}
|
|
|
|
|
|
# Timezone converter from cst to budapest
|
|
function tconv {
|
|
ton
|
|
conv=$1
|
|
wget -qO- http://worldcitytime.com/$conv/cst/to/budapest|grep time |grep binding|tail -2|cut -d'>' -f3|cut -d'<' -f1
|
|
}
|
|
|
|
|
|
# Quickly check batter percentage
|
|
function batt {
|
|
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep perc
|
|
|
|
}
|
|
|
|
|
|
# Extract files faster
|
|
function extract {
|
|
echo Running extract on $1 ...
|
|
if [ -f $1 ] ; then
|
|
case $1 in
|
|
*.tar.bz2) tar xjf $1 ;;
|
|
*.tar.gz) tar xzf $1 ;;
|
|
*.bz2) bunzip2 $1 ;;
|
|
*.rar) unrar x $1 ;;
|
|
*.gz) gunzip $1 ;;
|
|
*.tar) tar xf $1 ;;
|
|
*.tbz2) tar xjf $1 ;;
|
|
*.tgz) tar xzf $1 ;;
|
|
*.zip) unzip $1 ;;
|
|
*.Z) uncompress $1 ;;
|
|
*.7z) 7z x $1 ;;
|
|
*.xz) unxz $1 ;;
|
|
*) echo "'$1' cannot be extracted via extract()" ;;
|
|
esac
|
|
else
|
|
echo "'$1' is not a valid file"
|
|
fi
|
|
}
|
|
|
|
|
|
# Check current ip address
|
|
function wip {
|
|
# check public ip
|
|
if [ $RANDOM -gt $RANDOM ]
|
|
then
|
|
wget -qO- -U "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" ipecho.net/plain
|
|
else
|
|
wget -qO- -U "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" icanhazip.com
|
|
fi
|
|
# curl -s checkip.dyndns.org | sed 's#.*Address: \(.*\)</b.*#\1#' # Alternative 1
|
|
# dig +short myip.opendns.com @resolver1.opendns.com # Alternative 2
|
|
}
|
|
|
|
|
|
# Tor commands / switching ip
|
|
function ton {
|
|
. torsocks on
|
|
}
|
|
function tof {
|
|
. torsocks off
|
|
}
|
|
function tip {
|
|
# check if tor is really used or not
|
|
wget -qO- https://check.torproject.org/ -U "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" | egrep -i "Congratulations. This browser is configured to use Tor.|Sorry. You are not using Tor." | uniq
|
|
}
|
|
|
|
|
|
# Temporary file for notes, etc
|
|
function tmp {
|
|
curran=$RANDOM$RANDOM
|
|
echo "Temporary file name: /tmp/$curran"
|
|
vim /tmp/$curran
|
|
}
|
|
|