-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.sh-common
90 lines (76 loc) · 3.59 KB
/
.sh-common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# append to the history file, don't overwrite it
shopt -s histappend
HISTFILE=~/.bash_history
HISTCONTROL=ignoredups:erasedups
HISTSIZE=200000
HISTFILESIZE=2000000
alias u="history -n"
export PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND};}history -a"
# Set urgent hint on promt
export PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND};}echo -ne '\a'"
# Show current command in titlebar
# https://gist.github.com/sgrankin/7882407
trap 'echo -ne "\033]0;${BASH_COMMAND%% *}\007"' DEBUG
function show_name {
if [[ -n "$BASH_COMMAND" ]]; then
echo -en "\033]0;"${PWD/#$HOME/\~}"\007"
fi
}
export PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%%;*( )};}'show_name'
export PYTHONDONTWRITEBYTECODE=1 # disable creation of pyc files
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
# Don't show error "Couldn't connect to accessibility bus: Failed to connect to socket..."
export NO_AT_BRIDGE=1
export PATH="${HOME}/fs/bin:${PATH}"
export PATH="/usr/lib/ccache/bin:${PATH}"
export PATH="${HOME}/.cargo/bin:${PATH}"
export PATH="${HOME}/fs/.node_modules/bin:${PATH}"
#export LESS="-R -i -j4"
#export LESS="-R -j4 -iMSx4 -FX"
export LESS="--RAW-CONTROL-CHARS --jump-target=4 --ignore-case"
#export LESS="--RAW-CONTROL-CHARS --jump-target=4 --ignore-case --long-prompt --chop-long-lines --tabs=4"
#export LESS_TERMCAP_me=$(printf '\e[0m')
#export LESS_TERMCAP_se=$(printf '\e[0m')
#export LESS_TERMCAP_ue=$(printf '\e[0m')
#export LESS_TERMCAP_mb=$(printf '\e[1;32m')
#export LESS_TERMCAP_md=$(printf '\e[1;34m')
#export LESS_TERMCAP_us=$(printf '\e[1;32m')
#export LESS_TERMCAP_so=$(printf '\e[1;44;1m')
iploc () { curl -s http://ip-api.com/json/"$1"|tr , '\n'|sed 's/[\"{}]//g'; }
iplocshort () { curl -s http://ip-api.com/json/"$1" | python -c 'import json,sys;s=sys.stdin.read();obj=json.loads(s);print(obj.get("country", "???") + " - " + obj.get("city", "???"))'; }
traceloc() {
while read -r line; do
ip=$(echo "$line" | awk '{print $2}' | grep -E "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
if [ -n "$ip" ]; then
printf '%-16s: ' $ip
iplocshort "$ip"
fi
done < <(stdbuf -o0 tracepath -n $1)
}
installhistory() { expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort; }
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias ll='/usr/bin/ls --color=auto -la --full-time'
alias gl='git log --pretty=oneline --graph --decorate --color'
alias lsd='ls -lahrt --time-style=full-iso'
alias rmpyc="find . -name '*.pyc' -delete"
alias vcp="rsync -ah --progress"
alias srlayout="setxkbmap -option grp:lalt_lshift_toggle -layout usrsl,rs -variant ,yz"
alias tvim="gvim --servername `gvim --serverlist | head -1` --remote-tab"
alias startx2="startx -- vt1 -keeptty &> $HOME/.xorg.log 2>&1"
alias pull-subfolders-git="find . -maxdepth 1 -type d ! -path . -exec sh -c '(cd {} && git pull)' ';'"
alias lsvfiogroups="find /sys/kernel/iommu_groups/ -type l"
alias removeorphans='sudo pacman -Rns $(pacman -Qtdq)'
alias checkpackages='sudo pacman -Qkk 1> /dev/null'
alias checkreboot="sudo lsof | grep 'DEL.*lib'"
checkrestart() { lsof +c 0 | grep 'DEL.*lib'; }
checkrestart2() { lsof +c 0 | grep 'DEL.*lib' | awk '1 { print $1 ": " $NF }' | sort -u; }
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }