add basic shell function to scan nginx logs
[dotfiles] / .bashrc
1 #!/bin/sh
2
3
4 # python setup.py --command-packages=stdeb.command sdist_dsc
5
6 # dns servers 80.67.169.12 || 2001:910:800::12
7 # 31.14.133.188 (ns5.it) -- 99.30% uptime
8 # 87.98.242.252 (ns11.fr) -- 99.58% uptime
9 # 87.98.175.85 (ns10.fr) -- 99.61% uptime
10 # 193.183.98.154 (ns1.it) -- 99.84% uptime
11
12 # unicode characters https://en.wikipedia.org/wiki/List_of_Unicode_characters
13
14 # ~/.bashrc: executed by bash(1) for non-login shells.
15 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
16 # for examples
17
18 # vcprompt & other things
19 export PATH=$PATH:$HOME/bin
20
21 # nim lang
22 export PATH=$PATH:$HOME/bin/nim-0.10.2/bin
23
24 # If not running interactively, don't do anything
25 case $- in
26 *i*) ;;
27 *) return;;
28 esac
29
30
31 # make less more friendly for non-text input files, see lesspipe(1)
32 #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
33
34 # set variable identifying the chroot you work in (used in the prompt below)
35 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
36 debian_chroot=$(cat /etc/debian_chroot)
37 fi
38
39 # set a fancy prompt (non-color, unless we know we "want" color)
40 case "$TERM" in
41 xterm-color) color_prompt=yes;;
42 esac
43
44 # uncomment for a colored prompt, if the terminal has the capability; turned
45 # off by default to not distract the user: the focus in a terminal window
46 # should be on the output of commands, not on the prompt
47 force_color_prompt=yes
48
49 if [ -n "$force_color_prompt" ]; then
50 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
51 # We have color support; assume it's compliant with Ecma-48
52 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
53 # a case would tend to support setf rather than setaf.)
54 color_prompt=yes
55 else
56 color_prompt=
57 fi
58 fi
59
60 # export command for coloring
61 # '\e[x;ym $PS1 \e[m' or [\033[x;ym\] $PS1 [\033[00m\] x;y being the color pair to use
62
63 if [ "$color_prompt" = yes ]; then
64 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(__git_ps1 "[%s]") \$ '
65 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(vcprompt -f %b%a%m%u) > '
66 if [ $USER='nsukami' ]; then
67 #PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]\h\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] > '
68 #PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n > '
69 #PS1='${debian_chroot:+($debian_chroot)}\[\033[31m\]\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n '
70 #PS1=$'\u03c6 \w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n '
71 PS1=$'\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n\u21D2 '
72 else
73 PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] \n > '
74 fi
75 else
76 #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(__git_ps1 "[%s]") \$ '
77 if [ $USER='nsukami' ]; then
78 #PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]\h\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) > '
79 PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) \n > '
80 else
81 PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) \n > '
82 fi
83
84 fi
85 unset color_prompt force_color_prompt
86
87 # If this is an xterm set the title to user@host:dir
88 case "$TERM" in
89 xterm*|rxvt*)
90 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w $(vcprompt -f %b%a%m%u) \a\]$PS1"
91 ;;
92 *)
93 ;;
94 esac
95
96 # enable color support of ls
97 if [ -x /usr/bin/dircolors ]; then
98 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
99 alias ls='ls --color=auto'
100 fi
101
102
103
104 # enable programmable completion features (you don't need to enable
105 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
106 # sources /etc/bash.bashrc).
107 if ! shopt -oq posix; then
108 if [ -f /usr/share/bash-completion/bash_completion ]; then
109 . /usr/share/bash-completion/bash_completion
110 elif [ -f /etc/bash_completion ]; then
111 . /etc/bash_completion
112 fi
113 fi
114
115 # start gpg agent
116 # be sure to have done apt install gpg-agent pinentry-curses first
117 eval `gpg-agent --daemon`
118
119 # print available tmux sessions if available
120 tmux list-sessions 2> /dev/null
121
122 # always put prompt at bottom
123 # PS1="\[$(tput cup "$LINES")\]"$PS1
124 PS1='\[$(retval=$?;tput cup "$LINES";exit $retval)\]'$PS1
125
126 # Hook for desk activation
127 [ -n "$DESK_ENV" ] && source "$DESK_ENV"
128
129 # Alias definitions.
130 # You may want to put all your additions into a separate file like
131 # ~/.bash_aliases, instead of adding them here directly.
132 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
133 [[ -f ~/.bash_aliases ]] && . ~/.bash_aliases
134
135 # git completion
136 [[ -f ~/.git_completion ]] && . ~/.git_completion
137
138 # personal customization
139 [[ -f ~/.bash_customization ]] && . ~/.bash_customization
140
141 # personal functions
142 [[ -f ~/.bash_function ]] && . ~/.bash_function
143
144 # personal export
145 [[ -f ~/.bash_export ]] && . ~/.bash_export
146
147 # personal color
148 [[ -f ~/.bash_color ]] && . ~/.bash_color
149
150 # personal shopt
151 [[ -f ~/.bash_shopt ]] && . ~/.bash_shopt
152
153 # git completion
154 [[ -f ~/.git_completion ]] && . ~/.git_completion
155
156 # is or is not
157 [[ -f ~/.bash_is ]] && . ~/.bash_is
158
159 # jump to directories
160 [[ -f ~/.bash_marks ]] && . ~/.bash_marks
161
162 # tmux completion script
163 [[ -f ~/.bash_tmux ]] && . ~/.bash_tmux
164
165 # jump completion script
166 [[ -f ~/.bash_compl ]] && . ~/.bash_compl
167
168 # jump completion script
169 [[ -f ~/.bash_base64 ]] && . ~/.bash_base64
170
171 # emacs launcher script
172 [[ -f ~/.bash_emacs ]] && . ~/.bash_emacs
173
174 # memo
175 [[ -f ~/.bash_memo ]] && . ~/.bash_memo
176
177 # custom bindings
178 [[ -f ~/.bash_bind ]] && . ~/.bash_bind
179
180 # custom filters
181 [[ -f ~/.bash_filters ]] && . ~/.bash_filters
182
183 # openssl
184 [[ -f ~/.bash_openssl ]] && . ~/.bash_openssl
185
186 # pomodoro
187 [[ -f ~/.bash_pomodoro ]] && . ~/.bash_pomodoro
188
189 # django
190 [[ -f ~/.bash_django ]] && . ~/.bash_django
191
192 # nginx
193 [[ -f ~/.bash_nginx ]] && . ~/.bash_nginx