diff options
| author | 2018-06-07 14:14:35 +0200 | |
|---|---|---|
| committer | 2018-06-07 14:14:35 +0200 | |
| commit | d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25 (patch) | |
| tree | bfaa0e7da1bfb7e4dd15f29cc4e6efa919a46147 | |
| parent | a38e3b313d7aa0c3de2f85ce9bdd39d186c18b18 (diff) | |
| download | dotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.tar.gz dotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.tar.bz2 dotfiles-d7317826c3d8a4cc9d46c7379c6dcc6af5e7fa25.zip | |
Updated
| -rwxr-xr-x | bash/.bashrc | 183 | ||||
| -rw-r--r-- | liquidprompt/.liquidpromptrc | 2 |
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 |
| 12 | export PS1='[\d][\t]\u on \h\n\w $ ' | 7 | export PS1='[\d][\t]\u on \h\n\w $ ' |
| 13 | 8 | ||
| @@ -28,7 +23,6 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib" | |||
| 28 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/lib" | 23 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/lib" |
| 29 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/local/lib" | 24 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/usr/local/lib" |
| 30 | 25 | ||
| 31 | |||
| 32 | export ANDROID_HOME="$HOME/Android/Sdk" | 26 | export 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 |
| 38 | case "$(uname)" in | 32 | case "$(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 | ;; |
| 47 | esac | 41 | esac |
| 48 | 42 | ||
| 49 | # Colorfull manpages | 43 | # Colorfull manpages |
| 50 | man() { | 44 | man() { |
| 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 |
| 62 | exists() { | 56 | exists() { |
| 63 | type $@ &> /dev/null | 57 | type $@ &> /dev/null |
| 64 | } | 58 | } |
| 65 | 59 | ||
| 66 | is_function() { | 60 | is_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 | ||
| 75 | is_alias() { | 69 | is_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 |
| 85 | if exists complete && exists sudo; then | 79 | if exists complete && exists sudo; then |
| 86 | complete -cf sudo | 80 | complete -cf sudo |
| 87 | fi | 81 | fi |
| 88 | 82 | ||
| 89 | # Jupiterbroadcasting live stream | 83 | # Jupiterbroadcasting live stream |
| 90 | if exists mpv; then | 84 | if 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' |
| 92 | elif exists vlc; then | 86 | elif 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' |
| 94 | fi | 88 | fi |
| 95 | 89 | ||
| 96 | # Set the default editor | 90 | # Set the default editor |
| 97 | if exists nvim; then | 91 | if exists nvim; then |
| 98 | export EDITOR="nvim" | 92 | export EDITOR="nvim" |
| 99 | elif exists vim; then | 93 | elif exists vim; then |
| 100 | export EDITOR="vim" | 94 | export EDITOR="vim" |
| 101 | elif exists vi; then | 95 | elif exists vi; then |
| 102 | export EDITOR="vi" | 96 | export EDITOR="vi" |
| 103 | fi | 97 | fi |
| 104 | 98 | ||
| 105 | vim() { | 99 | vim() { |
| 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 |
| 118 | if exists go; then | 112 | if 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" |
| 121 | fi | 115 | fi |
| 122 | 116 | ||
| 123 | if exists gem; then | 117 | if 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" |
| 126 | fi | 120 | fi |
| 127 | 121 | ||
| 128 | # Ezjail shortcuts | 122 | # Ezjail shortcuts |
| 129 | if exists ezjail-admin && exists sudo; then | 123 | if 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 | } |
| 133 | fi | 127 | fi |
| 134 | 128 | ||
| 135 | # Showbanned ipadresses | 129 | # Showbanned ipadresses |
| 136 | if exists pfctl && exists sudo; then | 130 | if 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 | } |
| 150 | fi | 144 | fi |
| 151 | 145 | ||
| 152 | # Always use pacaur even if it is not installed | 146 | # Always use pacaur even if it is not installed |
| 153 | if (exists pacman && ! exists pacaur) && exists sudo; then | 147 | if (exists pacman && ! exists pacaur) && exists sudo; then |
| 154 | alias pacaur="sudo pacman" | 148 | alias pacaur="sudo pacman" |
| 155 | fi | 149 | fi |
| 156 | 150 | ||
| 157 | # Set the default pager | 151 | # Set the default pager |
| 158 | if exists less; then | 152 | if exists less; then |
| 159 | export PAGER="less" | 153 | export PAGER="less" |
| 160 | fi | 154 | fi |
| 161 | 155 | ||
| 162 | # Set the virtualenv parameters | 156 | # Set the virtualenv parameters |
| 163 | if exists virtualenvwrapper.sh; then | 157 | if 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 |
| 166 | fi | 160 | fi |
| 167 | 161 | ||
| 168 | # Start gnome-keyring-daemon | 162 | # Start gnome-keyring-daemon |
| 169 | if exists gnome-keyring-daemon; then | 163 | if 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 |
| 174 | fi | 168 | fi |
| 175 | 169 | ||
| 176 | if exists sensible.bash; then | 170 | if exists sensible.bash; then |
| 177 | source sensible.bash | 171 | source sensible.bash |
| 178 | fi | 172 | fi |
| 179 | 173 | ||
| 180 | # Fancy bash prompt | 174 | # Fancy bash prompt |
| 181 | if exists liquidprompt; then | 175 | if exists liquidprompt; then |
| 182 | source $(which liquidprompt) 2> /dev/null | 176 | source $(which liquidprompt) 2> /dev/null |
| 183 | fi | 177 | fi |
| 184 | 178 | ||
| 185 | # Fancy system info | 179 | # Fancy system info |
