123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- #!/bin/bash
-
-
- test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
- && . /usr/share/git-core/contrib/completion/git-prompt.sh
-
-
-
-
-
-
-
-
-
- git() {
-
-
-
-
-
-
-
-
- if grep -Fwqse "$1" "$GIT_DISABLED_COMMANDS"; then
- echo "You don't want this." >&2
- return 1
- else
- command git "$@"
- fi
- }
-
- grepr() {
-
-
-
-
-
- local p=$1; shift
- grep --color -n --exclude-dir=".git" -e "$p" -r "$@"
- }
-
- greph() {
-
-
-
- history | sed 's/^ *//; s/ / /' | cut -d' ' -f2- | grep "$@"
- }
-
- gitcd() {
-
-
-
- cd "$(git rev-parse --show-toplevel)"
- }
-
- haste() {
-
-
-
- local a=$(cat)
- curl -X POST -s -d "$a" http://hastebin.com/documents \
- | awk -F '"' '{print "http://hastebin.com/"$4}'
- }
-
- clsz() {
-
-
-
- tput clear; tput cup "$(tput lines)" 0
- }
-
- bcdiff() {
-
-
-
- test $# -eq 2 && diff "$@" >/dev/null && return
- bcompare "$@" &
- }
-
- strip_colors() {
-
-
-
-
-
- sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
- }
-
- vims() {
-
-
-
-
-
-
-
-
-
-
- local swap="$HOME/.local/share/vim/swap"
- find "$swap" -type f -print0 \
- | xargs -0 -r stat -c "%y %n" \
- | sed "
- s| $swap/| |
- s|%|/|g
- s|.swp$||
- s| $HOME| ~|
- s| \(..:..\):[^ ]* +.... | \\1 |
- " \
- | sort \
- | tac
- }
-
- fixnl() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- local arg=$1
- local cache
- local nlcount
- local lastchr
- local single=keep
-
-
- case $arg in
- -c|--chop-single) single=chop ;;
- esac
- cache="$(mktemp -t fixnl.XXXXXXXX)"
- cat >"$cache"
- nlcount=$(<"$cache" wc -l)
- lastchr=$(<"$cache" tail -c1 | hexdump -e '"%02x"')
- case $nlcount:$lastchr:$single in
- 0:??:*) cat "$cache" ;;
- 1:0a:chop) head -c -1 "$cache" ;;
- 1:0a:keep) cat "$cache" ;;
- *:0a:*) cat "$cache" ;;
- *:??:*) cat "$cache"; echo ;;
- esac
- rm "$cache"
- }
-
- xop() {
-
-
-
- local op=$1
- local file=${2:-/dev/stdin}
- case $op in
- oo) xclip -selection clipboard -o | fixnl ;;
- o) xclip -o | fixnl ;;
- ii) fixnl -c | xclip -selection clipboard -i ;;
- i) fixnl -c | xclip -i ;;
- esac <"$file"
- }
-
- xod() {
-
-
-
-
-
-
-
- local name="${1:-clipboard_dump.txt}"
- local tmp=$(mktemp -d -t "xod.XXXXXXXX")
- xclip -o > "$tmp/$name"
- echo "$tmp/$name"
- }
-
- xood() {
-
-
-
- local name="${1:-clipboard_dump.txt}"
- local tmp=$(mktemp -d -t "xood.XXXXXXXX")
- xclip -selection clipboard -o > "$tmp/$name"
- echo "$tmp/$name"
- }
-
- yum_hasbin() {
-
-
-
- local bname
- for bname in "$@";
- do
- case $bname in
- */*) dnf provides "$bname" ;;
- *) dnf provides "*/bin/$bname" ;;
- esac \
- | grep '^.' \
- | grep -E '^[[:alnum:]_:.-]+ :'
- done
- }
-
-
-
-
-
- HISTCONTROL=ignoredups:erasedups
- shopt -s histappend
- PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
-
- HISTIGNORE="$HISTIGNORE:ls:ll:la:cd"
- HISTIGNORE="$HISTIGNORE:git dc:git st"
- HISTIGNORE="$HISTIGNORE:reset"
-
- HISTSIZE=-1
- HISTFILESIZE=100000
- GLOBIGNORE=.:..
- shopt -s histverify
-
-
- alias cal='cal -m'
- alias cls='clear'
- alias ll='ls -lh'
- alias lla='ls -lha'
- alias open='gnome-open'
- alias diff='colordiff -u'
- alias dmesg='dmesg --time-format iso'
- alias pad4='sed -e "/./s/^/ /"'
- alias grep='grep --color --binary-files=without-match'
- alias sc='se --direction=encz.cz'
- alias taskm='task modify'
- alias tasks='task rc.context:none'
- alias ts='ts "%F %T"'
- alias lsblk='lsblk -o +UUID,LABEL'
- alias virsh='virsh --connect qemu:///system'
- alias xaa='xclip -o | audit2allow'
- alias xi='xop i'
- alias xii='xop ii'
- alias xo='xop o'
- alias xoo='xop oo'
- alias reboot="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl reboot"
- alias poweroff="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl poweroff"
-
- RV_TMP="/tmp/bash-rv"
- mkdir -p "$RV_TMP"
-
-
-
-
-
- export LC_COLLATE=C
-
- export PRETTY=color
- export PRETTY_DEBUG_EXCLUDE=inigrep
-
-
- GIT_PS1_SHOWDIRTYSTATE=true
- GIT_PS1_SHOWUNTRACKEDFILES=true
- GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
- export GIT_PAGER='less -S'
-
-
-
- export GVFS_DISABLE_FUSE=1
-
-
- [[ ${!DISPLAY[@]} ]] && xset b off
-
-
- export PYTHONDONTWRITEBYTECODE=1
-
- ssh-add -l >& /dev/null || ssh-add
|