-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
66 lines (54 loc) · 1.68 KB
/
.bashrc
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
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
setxkbmap gb
function prompt_command {
NUMCPUS=$(nproc)
ONEMINLOAD=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g")
LOAD=$(echo -e "scale=0 \n $ONEMINLOAD/0.01/$NUMCPUS \nquit \n" | bc)
if [ $LOAD -gt 99 ]
then
LOAD_COLOUR='0;31m'
elif [ $LOAD -gt 49 ]
then
LOAD_COLOUR='0;33m'
else
LOAD_COLOUR='0;94m'
fi
HOST=$(uname -n)
if [ $HOST != 'arthur' ]
then
HOST_COLOURBG='102m'
HOST_COLOURBG2='42m'
HOST_COLOURFG='92m'
HOST_COLOURFG2='32m'
else
HOST_COLOURBG='104m'
HOST_COLOURBG2='44m'
HOST_COLOURFG='94m'
HOST_COLOURFG2='34m';
fi
}
PROMPT_COMMAND=prompt_command
if [[ ${EUID} == 0 ]] ; then
PS1=$'\n\[\e[$LOAD_COLOUR\e[101m\]\ue0b0\[\e[0;97m\e[101m\] \h \ue0b1 \u \[\e[91m\e[41m\]\ue0b0\[\e[1;97m\] \W \[\e[0;31m\e[100m\]\ue0b0\[\e[0;97m\e[100m\] \$ \[\e[90m\e[49m\]\ue0b0\[\e[0m\] '
else
PS1=$'\n\[\e[$LOAD_COLOUR\e[$HOST_COLOURBG\]\ue0b0\[\e[0;97m\e[$HOST_COLOURBG\] \h \ue0b1 \u \[\e[$HOST_COLOURFG\e[$HOST_COLOURBG2\]\ue0b0\[\e[1;97m\] \W \[\e[0;$HOST_COLOURFG2\e[100m\]\ue0b0\[\e[0;97m\e[100m\] \$ \[\e[90m\e[49m\]\ue0b0\[\e[0m\] '
fi
please(){
sudo -- "${SHELL:-bash}" -c "$(fc -ln -1)"
}
export EDITOR=vim
export SUDO_EDITOR=vim
alias mpv-yt='mpv --ytdl-format "bestvideo[height=1080]+bestaudio/best+protocol!=http_dash_segments" --save-position-on-quit' --cache-default=1024000
alias cd..='cd ..'
alias ..='cd ..'
alias duh='du -h --max-depth=1'
alias bedtime='~/.i3/i3lock-custom && systemctl hibernate'
if [ -e ~/.bashrc_private ]; then
source ~/.bashrc_private
fi