291 lines
8.8 KiB
Bash
291 lines
8.8 KiB
Bash
# ksh environment file
|
|
|
|
########################################################################
|
|
# ENVIRONMENT VARIABLES
|
|
########################################################################
|
|
|
|
### SEARCH PATHS
|
|
PATH=~/.bin\
|
|
:/bin\
|
|
:/sbin\
|
|
:/usr/bin\
|
|
:/usr/sbin\
|
|
:/usr/local/bin\
|
|
:/usr/local/sbin\
|
|
:/usr/X11R6/bin\
|
|
:/usr/ports/infrastructure/bin
|
|
export PATH
|
|
|
|
### LANGUAGE
|
|
LC_ALL=en_US.UTF-8
|
|
LANG=en_US.UTF-8
|
|
LC_MESSAGES=C
|
|
LC_NUMERIC=C
|
|
LC_TIME=de_DE.UTF-8
|
|
export LANG LC_MESSAGES LC_NUMERIC LC_TIME
|
|
|
|
### SOFTWARE PREFERENCES
|
|
EDITOR="vim"
|
|
VISUAL="vim"
|
|
BROWSER="chrome"
|
|
PAGER="less"
|
|
export EDITOR VISUAL BROWSER PAGER
|
|
|
|
PRINTER="rp"
|
|
export PRINTER
|
|
|
|
########################################################################
|
|
# LOAD LOCAL STUFF
|
|
########################################################################
|
|
[ -f ~/.ksh.local ] && . ~/.ksh.local
|
|
|
|
########################################################################
|
|
# STOP HERE IF NON INTERACTIVE
|
|
########################################################################
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
########################################################################
|
|
# INTERACTIVE ENVIRONMENT
|
|
########################################################################
|
|
|
|
### HISTORY
|
|
HISTCONTROL=ignoredups:ignorespace:erasedups
|
|
HISTFILE=$HOME/.ksh-history
|
|
HISTSIZE=2000
|
|
export HISTCONTROL HISTFILE HISTSIZE
|
|
|
|
# LESS
|
|
LESS="-giJmR--tilde"
|
|
LESSHISTFILE="$HOME/.less-history"
|
|
export LESS LESSHISTFILE
|
|
|
|
########################################################################
|
|
# SHELL SETTINGS
|
|
########################################################################
|
|
|
|
ulimit -c 0
|
|
stty -ixon -ixoff
|
|
set -o emacs
|
|
set bell-style none
|
|
|
|
########################################################################
|
|
# LOAD COMPLETION FILE
|
|
########################################################################
|
|
|
|
[ -f ~/.ksh.complete ] && . ~/.ksh.complete
|
|
|
|
########################################################################
|
|
# PROMPT
|
|
########################################################################
|
|
|
|
# C1="\[$(tput setaf 241)\]" # gray
|
|
# C2="\[$(tput setaf 208)\]" # orange
|
|
# C0="\[$(tput op)\]" # reset
|
|
# x=$(echo -e \\001) # hack from ksh(1)
|
|
#
|
|
# [ $(id -u) -eq 0 ] \
|
|
# && C2="\[$(tput setaf 196)\]" # gray
|
|
#
|
|
# PS1="${C1}[${C2}\h${C1}](${C2}\${?}${C1})(${C2}\w${C1})\$ ${C0}"
|
|
|
|
RED="\[$(tput setaf 196)\]"
|
|
GREY="\[$(tput setaf 248)\]"
|
|
RESET="\[$(tput op)\]"
|
|
|
|
if [ $(id -u) -eq 0 ]
|
|
then
|
|
PS1="${x}${RED}\${?}|\w\\$ ${RESET}${x}"
|
|
else
|
|
PS1="${x}${GREY}\${?}|\w\\$ ${RESET}${x}"
|
|
fi
|
|
|
|
########################################################################
|
|
# ALIASES
|
|
########################################################################
|
|
|
|
# config files
|
|
alias kshrc="vim ~/.kshrc"
|
|
alias kshrc.local="vim ~/.ksh.local"
|
|
alias muttrc="vim ~/.mutt/rc-common"
|
|
alias vimrc="vim ~/.vim/vimrc"
|
|
alias luakitrc="vim ~/.config/luakit/rc.lua"
|
|
alias spectrwmrc="vim ~/.config/spectrwm/spectrwm.conf"
|
|
alias cwmrc="vim ~/.cwmrc"
|
|
alias vifmrc="vim ~/.config/vifm/vifmrc"
|
|
alias tmuxrc="vim ~/.tmux.conf"
|
|
|
|
# task warrior
|
|
alias t=task
|
|
alias ta="t add"
|
|
alias tm="t mod"
|
|
alias tc="t completed"
|
|
alias tlog="t log +LOG"
|
|
|
|
# social media
|
|
alias tuta="tut -u 'sh@bsd.network uugrn@chaos.social'"
|
|
|
|
# servers
|
|
alias x="ssh -t sdk@home.codevoid.de 'tmux -u new-session -d -s main; tmux -u new-session -t main \; set-option destroy-unattached'"
|
|
|
|
alias inssh="ssh -o HostKeyAlgorithms=+ssh-rsa \
|
|
-o KexAlgorithms=+diffie-hellman-group1-sha1 \
|
|
-o Ciphers=+aes256-cbc"
|
|
|
|
myps() { ps -fU $(whoami); }
|
|
mytop() { top -u $(whoami); }
|
|
|
|
alias portroach="portroach-cli -m codevoid"
|
|
|
|
alias ugrep="\ugrep -nI --exclude=tags --exclude=.tags --exclude='cscope.*'"
|
|
|
|
########################################################################
|
|
# AMUSED
|
|
########################################################################
|
|
|
|
alias amused-next="_amused_cmd next"
|
|
alias amused-prev="_amused_cmd prev"
|
|
alias amused-play="_amused_cmd play"
|
|
alias amused-stop="_amused_cmd stop"
|
|
alias amused+="_amused_cmd seek +15"
|
|
alias amused-="_amused_cmd seek -15"
|
|
alias amused-jump="_amused_jump"
|
|
alias amused-shuffle="amused show | sort -R | amused load"
|
|
alias amused-sort="amused show | sort -h | amused load"
|
|
|
|
_amused_cmd() {
|
|
. ~/.bin/_config
|
|
amused "${@}" 2>&1 > /dev/null
|
|
STATUS="$(amused status | head -1 | cut -d'/' -f5-)"
|
|
NOTIFY_CMD "$STATUS"
|
|
echo "$@: $STATUS"
|
|
}
|
|
|
|
_amused_jump() {
|
|
S="$(echo "$(amused show | cut -d'/' -f5-)" | sort -h | fzf -i -e)"
|
|
[ ! -z "$S" ] \
|
|
&& _amused_cmd jump "$S"
|
|
}
|
|
|
|
########################################################################
|
|
# EMAIL HANDLING
|
|
########################################################################
|
|
|
|
# mailboxes
|
|
MUTT_HOST="imaps://mail.codevoid.de"
|
|
|
|
# account aliases
|
|
alias mutt-acc-gmx="\mutt -F $HOME/.mutt/rc-account-gmx"
|
|
alias mutt-acc-priv="\mutt -F $HOME/.mutt/rc-account-private"
|
|
alias mutt-acc-work="\mutt -F $HOME/.mutt/rc-account-work"
|
|
alias mutt-acc-offl="\mutt -F $HOME/.mutt/rc-account-offline"
|
|
alias mutt-acc-mborg="\mutt -F $HOME/.mutt/rc-account-mborg"
|
|
alias mutt-acc-uugrn="\mutt -F $HOME/.mutt/rc-account-uugrn"
|
|
|
|
# default
|
|
alias mutt="mutt-acc-priv"
|
|
alias muttopen="\mutt -F ~/.mutt/rc-common -f"
|
|
|
|
# select mailbox
|
|
mutt-textmail() { mutt-acc-priv -f $MUTT_HOST/Mailboxes/textmail.me/$1; }
|
|
mutt-codevoid() { mutt-acc-priv -f $MUTT_HOST/Mailboxes/codevoid.de/sh+$1; }
|
|
|
|
# shortcuts
|
|
alias mutt-all="mutt -f $MUTT_HOST/Virtual/ALL"
|
|
alias mutt-last-day="mutt -f $MUTT_HOST/Virtual/LAST_DAY"
|
|
alias mutt-last-week="mutt -f $MUTT_HOST/Virtual/LAST_WEEK"
|
|
alias mutt-last-month="mutt -f $MUTT_HOST/Virtual/LAST_MONTH"
|
|
alias mutt-last-year="mutt -f $MUTT_HOST/Virtual/LAST_YEAR"
|
|
alias mutt-openbsd-all="mutt -f $MUTT_HOST/Virtual/OpenBSD"
|
|
alias mutt-amazon="mutt-textmail amazon"
|
|
alias mutt-ccc-intern="mutt-textmail ccc-intern"
|
|
alias mutt-lieferando="mutt-textmail lieferando"
|
|
alias mutt-mutt-users="mutt-codevoid mutt-users"
|
|
alias mutt-openbsd-bugs="mutt-codevoid openbsd-bugs"
|
|
alias mutt-openbsd-hackers="mutt-codevoid openbsd-hackers"
|
|
alias mutt-openbsd-misc="mutt-codevoid openbsd-misc"
|
|
alias mutt-openbsd-ports-bugs="mutt-codevoid openbsd-ports-bugs"
|
|
alias mutt-openbsd-ports-cvs="mutt-codevoid openbsd-ports-cvs"
|
|
alias mutt-openbsd-ports="mutt-codevoid openbsd-ports"
|
|
alias mutt-openbsd-sparc="mutt-codevoid openbsd-sparc"
|
|
alias mutt-openbsd-src-cvs="mutt-codevoid openbsd-src-cvs"
|
|
alias mutt-openbsd-tech="mutt-codevoid openbsd-tech"
|
|
alias mutt-openbsd-x11="mutt-codevoid openbsd-x11"
|
|
alias mutt-paypal="mutt-textmail paypal"
|
|
alias mutt-uugrn="mutt-codevoid uugrn"
|
|
alias mutt-vorstand="mutt-codevoid vorstand"
|
|
|
|
########################################################################
|
|
# PORT TOOLS
|
|
########################################################################
|
|
|
|
CVSROOT="sdk@cvs.openbsd.org:/cvs"
|
|
export CVSROOT
|
|
|
|
po() { cd $(make show=WRKSRC); }
|
|
pj() {
|
|
[ -z $1 ] && return 1
|
|
cd /usr/ports
|
|
PATTERN="pobj|plist|CVS|locks|packages|distfiles|infrastructure"
|
|
LIST=$( ls -d1 \
|
|
*$1* \
|
|
*/*$1* \
|
|
mystuff/*$1* \
|
|
mystuff/*/*$1* \
|
|
openbsd-wip/*$1* \
|
|
openbsd-wip/*/*$1* \
|
|
2>/dev/null \
|
|
| grep -Ev "$PATTERN" \
|
|
| sort -u
|
|
)
|
|
|
|
[ $(echo "$LIST" | wc -l) -gt 1 ] \
|
|
&& cd $(echo "$LIST" | fzf -e -i) \
|
|
|| cd $LIST
|
|
}
|
|
|
|
obsd-full-system-update() {(
|
|
set -x
|
|
cvs-update-all
|
|
set -e
|
|
obsdmake kernel
|
|
obsdmake base
|
|
obsdmake xenocara
|
|
doas pkg_add -u
|
|
)}
|
|
|
|
########################################################################
|
|
# REMIND
|
|
########################################################################
|
|
|
|
alias rem="remind -@1,1,1 -c+cu4 -wt ~sdk/.reminders.rem"
|
|
alias remy="remind -@1,1,1 -c+cu52 -wt ~sdk/.reminders.rem | less"
|
|
alias rems="remind -n ~sdk/.reminders | sort -n | head -10"
|
|
alias remc="remindcal ~sdk/.reminders"
|
|
alias rem-personal="rem-edit personal"
|
|
alias rem-birthdays="rem-edit birthdays"
|
|
alias rem-uugrn="rem-edit-uugrn"
|
|
|
|
rem-edit() {
|
|
vim sftp://sdk@home.codevoid.de/.reminders/$1.rem
|
|
scp -q sdk@home.codevoid.de:.reminders/$1.rem ~sdk/.reminders/$1.rem
|
|
}
|
|
rem-edit-uugrn() {
|
|
vim sftp://vorstand@vorstand.uugrn.org/.reminders/uugrn.rem
|
|
scp -q vorstand@vorstand.uugrn.org:.reminders/uugrn.rem ~sdk/.reminders/uugrn.rem
|
|
scp -q ~sdk/.reminders/uugrn.rem vorstand@vorstand.uugrn.org:private/Kalender/uugrn.rem
|
|
ssh sdk@vorstand.uugrn.org sh \
|
|
~sdk/.bin/make_calendar.sh \
|
|
|| true
|
|
}
|
|
|
|
########################################################################
|
|
# UPDATE SCRATCHPAD DIMENSIONS
|
|
########################################################################
|
|
update-scratchpad() {
|
|
echo "Updating Lines to: $LINES"
|
|
echo "Updating Rows to: $COLUMNS"
|
|
sed -i "s/^COLUMNS=.*/COLUMNS=$COLUMNS/g" ~/.bin/scratchpad
|
|
sed -i "s/^ROWS=.*/ROWS=$LINES/g" ~/.bin/scratchpad
|
|
}
|