2019-11-05 21:11:48 +02:00
|
|
|
## -*- mode: sh -*-
|
|
|
|
|
|
|
|
export RANGER_LOAD_DEFAULT_RC=FALSE
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
## Exports
|
|
|
|
############################################################
|
|
|
|
export EDITOR='nvim'
|
|
|
|
export PAGER='less'
|
|
|
|
export BROWSER='qutebrowser'
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
## Functions
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
# Transfer files to transfer.sh
|
|
|
|
transfer()
|
|
|
|
{
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo -e "No arguments specified.
|
|
|
|
Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer
|
|
|
|
test.md";
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
tmpfile=$( mktemp -t transferXXX );
|
|
|
|
|
|
|
|
if tty -s; then
|
|
|
|
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
|
|
|
|
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
|
|
|
|
else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
|
|
|
|
fi;
|
|
|
|
|
|
|
|
cat $tmpfile;
|
|
|
|
rm -f $tmpfile;
|
|
|
|
}
|
|
|
|
|
2020-03-16 03:16:46 +02:00
|
|
|
# Format a file close to suckless.org guidelines
|
|
|
|
indent_suckless()
|
|
|
|
{
|
|
|
|
indent $1 -brs \
|
|
|
|
-nprs \
|
|
|
|
-npcs \
|
|
|
|
-i8 \
|
|
|
|
-fc1 \
|
|
|
|
-br \
|
|
|
|
-brf \
|
|
|
|
-saf \
|
|
|
|
-sai \
|
|
|
|
-saw \
|
|
|
|
-ncs \
|
|
|
|
-nfca \
|
|
|
|
-il0 \
|
|
|
|
-ce \
|
|
|
|
-nss \
|
|
|
|
-c0 \
|
|
|
|
-cd0 \
|
|
|
|
-ut \
|
|
|
|
-o $2
|
|
|
|
}
|
2019-11-05 21:11:48 +02:00
|
|
|
|
|
|
|
############################################################
|
|
|
|
## Aliases
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
# neo- aliases
|
|
|
|
alias vim="nvim"
|
|
|
|
alias mutt='neomutt'
|
|
|
|
alias qemacs='emacs -q -nw'
|
|
|
|
alias sqemacs='sudo -q emacs -nw'
|
|
|
|
|
|
|
|
# Priv escalation
|
|
|
|
alias svim='sudo vim'
|
|
|
|
alias zzz='sudo zzz'
|
|
|
|
alias vm='sudo vm'
|
|
|
|
alias dmesg='sudo dmesg'
|
|
|
|
|
|
|
|
# Config files
|
|
|
|
alias fstab="$EDITOR /etc/fstab"
|
|
|
|
alias dwmconf="$EDITOR $DWM_CONF"
|
|
|
|
alias zshrcl="$EDITOR ~/.zshrc.local"
|
|
|
|
alias zshrc="$EDITOR ~/.zshrc"
|
|
|
|
alias muttrc="$EDITOR ~/.neomuttrc"
|
|
|
|
alias muttrcs="$EDITOR ~/.neomutt"
|
|
|
|
alias xinitrc="$EDITOR ~/.xinitrc"
|
|
|
|
|
|
|
|
# Convenience and helpers
|
|
|
|
alias h="history"
|
|
|
|
alias cd..="cd .."
|
|
|
|
alias reloadzsh="source ~/.zshrc.local"
|
|
|
|
alias rotatewacom='xsetwacom set "Wacom ISDv4 EC Pen stylus" Rotate'
|
|
|
|
alias myip='dig TXT +short o-o.myaddr.l.google.com @ns1.google.com'
|
|
|
|
alias watchsync='watch grep -e Dirty: -e Writeback: /proc/meminfo'
|
|
|
|
alias ducks='du -cks -h * | sort -rn | head -11'
|
|
|
|
alias speedtest='wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip'
|
|
|
|
alias cls='echo -ne "\033c"'
|
|
|
|
alias clearhistory='cat /dev/null > ~/.zsh_history && history -c && exit'
|
|
|
|
alias sshfs_mount='sshfs -C -o allow_other'
|
|
|
|
alias mountyadisk='sudo mount -t davfs https://webdav.yandex.ru /home/sakhmatd/mnt/yadisk'
|
|
|
|
alias mountallsync='sudo mount -t davfs https://cloud.allsync.com /home/sakhmatd/mnt/allsync'
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
# OS-Specific Modules
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
# FreeBSD
|
|
|
|
if [[ $(uname) == "FreeBSD" ]] then
|
|
|
|
# Fix FreeBSD's backspace behavior.
|
|
|
|
stty erase "^?"
|
|
|
|
|
|
|
|
# Package management
|
|
|
|
alias pkg='sudo pkg'
|
|
|
|
|
|
|
|
# BSD config files
|
|
|
|
alias bootloader.conf="sudo $EDITOR /boot/loader.conf"
|
|
|
|
alias rc.conf="sudo $EDITOR /etc/rc.conf"
|
|
|
|
alias sysctl.conf="sudo $EDITOR /etc/sysctl.conf"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Void Linux
|
|
|
|
if xbps-install -V &> /dev/null; then
|
|
|
|
alias xbps-install='sudo xbps-install'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ArchLinux
|
|
|
|
if pacman -V &> /dev/null; then
|
|
|
|
alias pacman='sudo pacman'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Slackware
|
|
|
|
if [[ -e /etc/slackware-release ]]; then
|
|
|
|
alias slapt-get='sudo slapt-get'
|
|
|
|
alias slackpkg='sudo slackpkg'
|
|
|
|
fi
|