diff options
Diffstat (limited to 'misc/.bashrc')
-rw-r--r-- | misc/.bashrc | 74 |
1 files changed, 69 insertions, 5 deletions
diff --git a/misc/.bashrc b/misc/.bashrc index 5f8c3cf..2d44565 100644 --- a/misc/.bashrc +++ b/misc/.bashrc @@ -18,7 +18,9 @@ _checkexec () } # Machine-specific and personal settings -source ~/.bashrc_local +if [[ -f ~/.bashrc_local ]]; then + source ~/.bashrc_local +fi ## prompts # git prompt @@ -26,6 +28,8 @@ if [[ -f /usr/share/git/completion/git-prompt.sh ]]; then source /usr/share/git/completion/git-prompt.sh elif [[ -f /etc/bash_completion.d/git-prompt ]]; then source /etc/bash_completion.d/git-prompt +elif [[ -f /usr/share/git-core/contrib/completion/git-prompt.sh ]]; then + source /usr/share/git-core/contrib/completion/git-prompt.sh fi # prompt @@ -63,7 +67,9 @@ then fi # from ~/.bashrc_local, adding more to PATH -my_local_add_path +if [[ $(type -t my_local_add_path) == function ]]; then + my_local_add_path +fi export PATH @@ -109,7 +115,7 @@ export HISTCONTROL=ignoreboth # aliases test -s ~/.alias && . ~/.alias || true alias shutdown='sudo /sbin/shutdown -hP now' -alias reboot='sudo /sbin/reboot' +alias reboot='sudo reboot' alias wifi-menu='sudo /usr/bin/wifi-menu' alias cd-='cd -' alias cd#='cd ~' @@ -125,6 +131,8 @@ alias updatedb='sudo updatedb' alias wgets="wget -O- 2>/dev/null" # get url behind one redirection alias wgre="wget --spider --max-redirect=0" +# wget with spoofing googlebot +alias wggb='wget --header="X-Forwarded-For: 66.249.66.1" --user-agent="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"' # this allows to open an url with tor-browser from within emacs, see # `my-browse-url-tor-browser' alias tor-browser="tor-browser --allow-remote" @@ -177,6 +185,7 @@ then alias pQi="pacman -Qi" # local package details alias pQl="pacman -Ql" # local package file lists alias pQo="pacman -Qo" # which package owns this file + alias pQc="pacman -Qc" # show changelog # Remove packages alias pRs="sudo pacman -Rs" # remove package @@ -187,10 +196,28 @@ then # Clear cache alias pcache1="sudo paccache -rk 1" # remove cache except last item alias pcache0="sudo paccache -ruk0" # remove all cache + + # make an aur package + paur () { + pkg_name="${1%.tar.gz}" + tar xvf "$pkg_name.tar.gz" + cd "$pkg_name" + makepkg + } fi +alias systart="sudo systemctl start" +alias systop="sudo systemctl stop" +alias sysnow="sudo systemctl enable --now" +alias sysdis="sudo systemctl disable" +alias systat="systemctl status" +alias sysres="sudo systemctl restart" +alias sysrelo="sudo systemctl reload" + # from ~/.bashrc_local, more aliases -my_local_aliases +if [[ $(type -t my_local_aliases) == function ]]; then + my_local_aliases +fi #ibus export GTK_IM_MODULE=ibus @@ -200,6 +227,26 @@ export QT_IM_MODULE=ibus #fix small vlc interface export QT_AUTO_SCREEN_SCALE_FACTOR=0 +# ensure $XDG_RUNTIME_DIR is set +if [ -z "$XDG_RUNTIME_DIR" ]; then # It's not already set + XDG_RUNTIME_DIR=/run/user/$UID # Try systemd created path + if [ ! -d "$XDG_RUNTIME_DIR" ]; then + # systemd-created directory doesn't exist + XDG_RUNTIME_DIR=/tmp/$USER-runtime + if [ ! -d "$XDG_RUNTIME_DIR" ]; then # Doesn't already exist + mkdir -m 0700 "$XDG_RUNTIME_DIR" + fi + fi +fi +# Check dir has got the correct type, ownership, and permissions +if ! [[ -d "$XDG_RUNTIME_DIR" && -O "$XDG_RUNTIME_DIR" && + "$(stat -c '%a' "$XDG_RUNTIME_DIR")" = 700 ]]; then + echo "\$XDG_RUNTIME_DIR: permissions problem with $XDG_RUNTIME_DIR:" >&2 + ls -ld "$XDG_RUNTIME_DIR" >&2 + XDG_RUNTIME_DIR=$(mktemp -d /tmp/"$USER"-runtime-XXXXXX) + echo "Set \$XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >&2 +fi + # start the agent automatically and make sure that only one # ssh-agent process runs at a time if ! pgrep -u "$USER" ssh-agent > /dev/null; then @@ -220,4 +267,21 @@ export CCACHE_EXEC=/usr/bin/ccache export CVS_RSH="ssh" # from ~/.bashrc_local, export more stuff -my_local_export +if [[ $(type -t my_local_export) == function ]]; then + my_local_export +fi + +# ghostscript, extract pages into a new file +# gs-extract 4 11 page-4-thru-11.pdf original.pdf +gs-extract() { + gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=$1 -dLastPage=$2 \ + -sOutputFile="$3" "$4" +} + +# ghostscript, merge files: gs-merge merged.pdf 1.pdf 2.pdf +gs-merge() { + gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="$@" +} + +# dptrp1 +alias quaderno="dptrp1 --addr $QUADERNO_IP" |