aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2018-06-07 14:14:35 +0200
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2018-06-07 14:14:35 +0200
commitd7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25 (patch)
treebfaa0e7da1bfb7e4dd15f29cc4e6efa919a46147
parenta38e3b313d7aa0c3de2f85ce9bdd39d186c18b18 (diff)
downloaddotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.tar.gz
dotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.tar.bz2
dotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.zip
Updated
-rwxr-xr-xbash/.bashrc183
-rw-r--r--liquidprompt/.liquidpromptrc2
2 files changed, 101 insertions, 84 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index 48c3ee6..4be0f7f 100755
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -1,13 +1,8 @@
1#
2# ~/.bashrc
3#
4
5# If not running interactively, don't do anything 1# If not running interactively, don't do anything
6[[ $- != *i* ]] && return 2[[ $- != *i* ]] && return
7 3
8[ -f "/etc/bashrc" ] && source "/etc/bashrc" 4[ -f "/etc/bashrc" ] && source "/etc/bashrc"
9 5
10
11# Default PS1 6# Default PS1
12export PS1='[\d][\t]\u on \h\n\w $ ' 7export PS1='[\d][\t]\u on \h\n\w $ '
13 8
@@ -28,7 +23,6 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib"
28export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/lib" 23export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/lib"
29export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/local/lib" 24export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/local/lib"
30 25
31
32export ANDROID_HOME="$HOME/Android/Sdk" 26export ANDROID_HOME="$HOME/Android/Sdk"
33 27
34# Quit the shell like in vim 28# Quit the shell like in vim
@@ -36,157 +30,180 @@ alias :q="exit"
36 30
37# Keep OS compatibility 31# Keep OS compatibility
38case "$(uname)" in 32case "$(uname)" in
39 Linux) 33 Linux)
40 alias ls="ls --color=auto" 34 alias ls="ls --color=auto"
41 usr="/usr" 35 usr="/usr"
42 ;; 36 ;;
43 FreeBSD|Darwin) 37 FreeBSD|Darwin)
44 alias ls="ls -G" 38 alias ls="ls -G"
45 usr="/usr/local" 39 usr="/usr/local"
46 ;; 40 ;;
47esac 41esac
48 42
49# Colorfull manpages 43# Colorfull manpages
50man() { 44man() {
51 env LESS_TERMCAP_mb=$'\E[01;31m' \ 45 env LESS_TERMCAP_mb=$'\E[01;31m' \
52 LESS_TERMCAP_md=$'\E[01;38;5;74m' \ 46 LESS_TERMCAP_md=$'\E[01;38;5;74m' \
53 LESS_TERMCAP_me=$'\E[0m' \ 47 LESS_TERMCAP_me=$'\E[0m' \
54 LESS_TERMCAP_se=$'\E[0m' \ 48 LESS_TERMCAP_se=$'\E[0m' \
55 LESS_TERMCAP_so=$'\E[38;5;246m' \ 49 LESS_TERMCAP_so=$'\E[38;5;246m' \
56 LESS_TERMCAP_ue=$'\E[0m' \ 50 LESS_TERMCAP_ue=$'\E[0m' \
57 LESS_TERMCAP_us=$'\E[04;38;5;146m' \ 51 LESS_TERMCAP_us=$'\E[04;38;5;146m' \
58 man "$@" 52 man "$@"
59} 53}
60 54
61# Helpfull functions 55# Helpfull functions
62exists() { 56exists() {
63 type $@ &> /dev/null 57 type $@ &> /dev/null
64} 58}
65 59
66is_function() { 60is_function() {
67 function=$(type $@ 2> /dev/null | awk '/is a function/ { print "1" }') 61 function=$(type $@ 2> /dev/null | awk '/is a function/ { print "1" }')
68 if [ -n "$function" ]; then 62 if [ -n "$function" ]; then
69 return 0 63 return 0
70 else 64 else
71 return 1 65 return 1
72 fi 66 fi
73} 67}
74 68
75is_alias() { 69is_alias() {
76 alias=$(type $1 2> /dev/null | awk '/is aliased to/ { print "1" }') 70 alias=$(type $1 2> /dev/null | awk '/is aliased to/ { print "1" }')
77 if [ -n "$alias" ]; then 71 if [ -n "$alias" ]; then
78 return 0 72 return 0
79 else 73 else
80 return 1 74 return 1
81 fi 75 fi
82} 76}
83 77
84# Set autocomplete for sudo 78# Set autocomplete for sudo
85if exists complete && exists sudo; then 79if exists complete && exists sudo; then
86 complete -cf sudo 80 complete -cf sudo
87fi 81fi
88 82
89# Jupiterbroadcasting live stream 83# Jupiterbroadcasting live stream
90if exists mpv; then 84if exists mpv; then
91 alias jblive='mpv rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' 85 alias jblive='mpv rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream'
92elif exists vlc; then 86elif exists vlc; then
93 alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' 87 alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream'
94fi 88fi
95 89
96# Set the default editor 90# Set the default editor
97if exists nvim; then 91if exists nvim; then
98 export EDITOR="nvim" 92 export EDITOR="nvim"
99elif exists vim; then 93elif exists vim; then
100 export EDITOR="vim" 94 export EDITOR="vim"
101elif exists vi; then 95elif exists vi; then
102 export EDITOR="vi" 96 export EDITOR="vi"
103fi 97fi
104 98
105vim() { 99vim() {
106 vim_bin=$(which $EDITOR) 100 vim_bin=$(which $EDITOR)
107 if [[ -z "$@" ]]; then 101 if [[ -z "$@" ]]; then
108 $vim_bin 102 $vim_bin
109 elif [[ -d "$@" ]]; then 103 elif [[ -d "$@" ]]; then
110 dir=$(pwd) 104 dir=$(pwd)
111 cd $@ && $vim_bin && cd $dir 105 cd $@ && $vim_bin && cd $dir
112 else 106 else
113 $vim_bin $@ 107 $vim_bin $@
114 fi 108 fi
115} 109}
116 110
117# Programming language specifics 111# Programming language specifics
118if exists go; then 112if exists go; then
119 export GOPATH="$HOME/programming/go" 113 export GOPATH="$HOME/programming/go"
120 export PATH="$PATH:$GOPATH/bin" 114 export PATH="$PATH:$GOPATH/bin"
121fi 115fi
122 116
123if exists gem; then 117if exists gem; then
124 export GEM_HOME="$(ruby -e 'print Gem.user_dir')" 118 export GEM_HOME="$(ruby -e 'print Gem.user_dir')"
125 export PATH="$PATH:$GEM_HOME/bin" 119 export PATH="$GEM_HOME/bin:$PATH"
126fi 120fi
127 121
128# Ezjail shortcuts 122# Ezjail shortcuts
129if exists ezjail-admin && exists sudo; then 123if exists ezjail-admin && exists sudo; then
130 jl() { 124 jl() {
131 sudo ezjail-admin $1 $2\.tomvanderlee.com 125 sudo ezjail-admin $1 $2\.tomvanderlee.com
132 } 126 }
133fi 127fi
134 128
135# Showbanned ipadresses 129# Showbanned ipadresses
136if exists pfctl && exists sudo; then 130if exists pfctl && exists sudo; then
137 showbanned () { 131 showbanned () {
138 for table in "fail2ban" "permaban"; do 132 for table in "fail2ban" "permaban"; do
139 banned=$(sudo pfctl -t $table -T show 2> /dev/null) 133 banned=$(sudo pfctl -t $table -T show 2> /dev/null)
140 134
141 if [ -z "$banned" ]; then 135 if [ -z "$banned" ]; then
142 nrBanned="0" 136 nrBanned="0"
143 else 137 else
144 nrBanned=$(echo "$banned" | wc -l | awk '{ print $1 }') 138 nrBanned=$(echo "$banned" | wc -l | awk '{ print $1 }')
145 fi 139 fi
146 140
147 echo -e "$table ($nrBanned)\n$banned" 141 echo -e "$table ($nrBanned)\n$banned"
148 done 142 done
149 } 143 }
150fi 144fi
151 145
152# Always use pacaur even if it is not installed 146# Always use pacaur even if it is not installed
153if (exists pacman && ! exists pacaur) && exists sudo; then 147if (exists pacman && ! exists pacaur) && exists sudo; then
154 alias pacaur="sudo pacman" 148 alias pacaur="sudo pacman"
155fi 149fi
156 150
157# Set the default pager 151# Set the default pager
158if exists less; then 152if exists less; then
159 export PAGER="less" 153 export PAGER="less"
160fi 154fi
161 155
162# Set the virtualenv parameters 156# Set the virtualenv parameters
163if exists virtualenvwrapper.sh; then 157if exists virtualenvwrapper.sh; then
164 export WORKON_HOME=$HOME/.virtualenvs 158 export WORKON_HOME=$HOME/.virtualenvs
165 source $(which virtualenvwrapper.sh) 2> /dev/null 159 source $(which virtualenvwrapper.sh) 2> /dev/null
166fi 160fi
167 161
168# Start gnome-keyring-daemon 162# Start gnome-keyring-daemon
169if exists gnome-keyring-daemon; then 163if exists gnome-keyring-daemon; then
170 if [ -n "$DESKTOP_SESSION" ];then 164 if [ -n "$DESKTOP_SESSION" ];then
171 eval $(gnome-keyring-daemon --start 2> /dev/null) 165 eval $(gnome-keyring-daemon --start 2> /dev/null)
172 export SSH_AUTH_SOCK 166 export SSH_AUTH_SOCK
173 fi 167 fi
174fi 168fi
175 169
176if exists sensible.bash; then 170if exists sensible.bash; then
177 source sensible.bash 171 source sensible.bash
178fi 172fi
179 173
180# Fancy bash prompt 174# Fancy bash prompt
181if exists liquidprompt; then 175if exists liquidprompt; then
182 source $(which liquidprompt) 2> /dev/null 176 source $(which liquidprompt) 2> /dev/null
183fi 177fi
184 178
185# Fancy system info 179# Fancy system info