2022-12-04 22:59:34 +01:00
|
|
|
# ksh environment file
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ENVIRONMENT VARIABLES
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
### SEARCH PATHS
|
2023-02-16 10:12:03 +01:00
|
|
|
PATH=~/.bin\
|
2022-12-04 22:59:34 +01:00
|
|
|
:/bin\
|
|
|
|
:/sbin\
|
|
|
|
:/usr/bin\
|
|
|
|
:/usr/sbin\
|
|
|
|
:/usr/local/bin\
|
|
|
|
:/usr/local/sbin\
|
|
|
|
:/usr/X11R6/bin\
|
2024-02-14 15:56:52 +01:00
|
|
|
:/usr/ports/infrastructure/bin
|
2022-12-04 22:59:34 +01:00
|
|
|
export PATH
|
|
|
|
|
|
|
|
### LANGUAGE
|
|
|
|
LANG=en_US.UTF-8
|
|
|
|
LC_MESSAGES=C
|
|
|
|
LC_NUMERIC=C
|
2023-11-19 08:40:50 +01:00
|
|
|
LC_TIME=de_DE.UTF-8
|
2024-02-14 07:54:31 +01:00
|
|
|
export LANG LC_MESSAGES LC_NUMERIC LC_TIME
|
2022-12-04 22:59:34 +01:00
|
|
|
|
2023-10-24 16:14:42 +02:00
|
|
|
### SOFTWARE PREFERENCES
|
|
|
|
EDITOR="vim"
|
|
|
|
VISUAL="vim"
|
2024-01-24 08:07:09 +01:00
|
|
|
BROWSER="chrome"
|
2023-10-24 16:14:42 +02:00
|
|
|
PAGER="less"
|
|
|
|
export EDITOR VISUAL BROWSER PAGER
|
|
|
|
|
2023-11-01 16:08:10 +01:00
|
|
|
PRINTER="rp"
|
|
|
|
export PRINTER
|
|
|
|
|
2024-02-14 16:09:57 +01:00
|
|
|
########################################################################
|
|
|
|
# LOAD LOCAL STUFF
|
|
|
|
########################################################################
|
|
|
|
[ -f ~/.ksh.local ] && . ~/.ksh.local
|
|
|
|
|
2022-12-04 22:59:34 +01:00
|
|
|
########################################################################
|
|
|
|
# STOP HERE IF NON INTERACTIVE
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
|
|
|
########################################################################
|
2024-02-14 07:54:31 +01:00
|
|
|
# INTERACTIVE ENVIRONMENT
|
2022-12-04 22:59:34 +01:00
|
|
|
########################################################################
|
|
|
|
|
|
|
|
### HISTORY
|
|
|
|
HISTCONTROL=ignoredups:ignorespace:erasedups
|
|
|
|
HISTFILE=$HOME/.ksh-history
|
|
|
|
HISTSIZE=2000
|
|
|
|
export HISTCONTROL HISTFILE HISTSIZE
|
|
|
|
|
|
|
|
# LESS
|
2023-01-10 22:18:46 +01:00
|
|
|
LESS="-giJmR--tilde"
|
2022-12-04 22:59:34 +01:00
|
|
|
LESSHISTFILE="$HOME/.less-history"
|
|
|
|
export LESS LESSHISTFILE
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# SHELL SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
ulimit -c 0
|
|
|
|
stty -ixon -ixoff
|
|
|
|
set -o emacs
|
|
|
|
set bell-style none
|
|
|
|
|
|
|
|
########################################################################
|
2024-02-14 16:09:57 +01:00
|
|
|
# LOAD COMPLETION FILE
|
2022-12-04 22:59:34 +01:00
|
|
|
########################################################################
|
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
[ -f ~/.ksh.complete ] && . ~/.ksh.complete
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# PROMPT
|
|
|
|
########################################################################
|
2023-01-13 13:46:11 +01:00
|
|
|
|
2024-03-17 18:13:15 +01:00
|
|
|
# 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
|
2024-03-23 09:50:32 +01:00
|
|
|
PS1="${x}${RED}\${?}|\w\\$ ${RESET}${x}"
|
2024-03-17 18:13:15 +01:00
|
|
|
else
|
2024-03-23 09:50:32 +01:00
|
|
|
PS1="${x}${GREY}\${?}|\w\\$ ${RESET}${x}"
|
2024-03-17 18:13:15 +01:00
|
|
|
fi
|
2024-01-01 13:48:13 +01:00
|
|
|
|
|
|
|
########################################################################
|
2024-02-14 07:54:31 +01:00
|
|
|
# ALIASES
|
2024-01-01 13:48:13 +01:00
|
|
|
########################################################################
|
2022-12-04 22:59:34 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
# config files
|
|
|
|
alias kshrc="vim ~/.kshrc"
|
2024-02-15 08:12:36 +01:00
|
|
|
alias kshrc.local="vim ~/.ksh.local"
|
2024-02-14 07:54:31 +01:00
|
|
|
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 vifmrc="vim ~/.config/vifm/vifmrc"
|
2024-02-14 16:47:38 +01:00
|
|
|
alias tmuxrc="vim ~/.tmux.conf"
|
2024-02-14 07:54:31 +01:00
|
|
|
|
|
|
|
# task warrior
|
|
|
|
alias t=task
|
2024-02-15 07:51:52 +01:00
|
|
|
alias ta="t add"
|
|
|
|
alias tm="t mod"
|
|
|
|
alias tc="t completed"
|
|
|
|
alias tlog="t log +LOG"
|
2024-02-14 07:54:31 +01:00
|
|
|
|
|
|
|
# social media
|
|
|
|
alias tuta="tut -u 'sh@bsd.network uugrn@chaos.social'"
|
|
|
|
|
|
|
|
# servers
|
|
|
|
alias x="ssh -t sdk@home.codevoid.de tmux -u at \|\| tmux"
|
|
|
|
|
2024-02-16 10:09:12 +01:00
|
|
|
alias inssh="ssh -o HostKeyAlgorithms=+ssh-rsa \
|
|
|
|
-o KexAlgorithms=+diffie-hellman-group1-sha1 \
|
|
|
|
-o Ciphers=+aes256-cbc"
|
|
|
|
|
2024-02-14 15:56:52 +01:00
|
|
|
myps() { ps -fU $(whoami); }
|
2024-02-14 16:47:38 +01:00
|
|
|
mytop() { top -u $(whoami); }
|
2024-02-14 07:54:31 +01:00
|
|
|
|
|
|
|
alias portroach="portroach-cli -m codevoid"
|
|
|
|
|
|
|
|
alias ugrep="\ugrep -nI --exclude=tags --exclude=.tags --exclude='cscope.*'"
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# AMUSED
|
|
|
|
########################################################################
|
2024-02-14 15:56:52 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
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"
|
|
|
|
}
|
2022-12-04 22:59:34 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
_amused_jump() {
|
|
|
|
S="$(echo "$(amused show | cut -d'/' -f5-)" | sort -h | fzf -i -e)"
|
|
|
|
[ ! -z "$S" ] \
|
|
|
|
&& _amused_cmd jump "$S"
|
|
|
|
}
|
2022-12-04 22:59:34 +01:00
|
|
|
|
|
|
|
########################################################################
|
2024-02-14 07:54:31 +01:00
|
|
|
# EMAIL HANDLING
|
2022-12-04 22:59:34 +01:00
|
|
|
########################################################################
|
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
# 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
|
|
|
|
########################################################################
|
2024-02-14 15:56:52 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
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
|
2022-12-04 22:59:34 +01:00
|
|
|
}
|
2024-02-14 15:56:52 +01:00
|
|
|
|
2024-02-25 14:11:12 +01:00
|
|
|
obsd-full-system-update() {(
|
|
|
|
set -x
|
|
|
|
cvs-update-all
|
|
|
|
set -e
|
|
|
|
obsdmake kernel
|
|
|
|
obsdmake base
|
|
|
|
obsdmake xenocara
|
|
|
|
doas pkg_add -u
|
|
|
|
)}
|
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
########################################################################
|
|
|
|
# REMIND
|
|
|
|
########################################################################
|
2022-12-04 22:59:34 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
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"
|
2024-07-21 19:26:41 +02:00
|
|
|
alias rem-uugrn="rem-edit-uugrn"
|
2024-02-14 07:54:31 +01:00
|
|
|
|
|
|
|
rem-edit() {
|
|
|
|
vim sftp://sdk@home.codevoid.de/.reminders/$1.rem
|
|
|
|
scp -q sdk@home.codevoid.de:.reminders/$1.rem ~sdk/.reminders/$1.rem
|
2024-07-21 19:26:41 +02:00
|
|
|
}
|
|
|
|
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 \
|
2024-02-14 07:54:31 +01:00
|
|
|
|| true
|
|
|
|
}
|
2024-02-16 07:50:50 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# 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
|
|
|
|
}
|