Update after 400 years
Signed-off-by: Moxie "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
parent
2736c6a371
commit
255ac30cff
50
.bashrc
50
.bashrc
|
@ -25,6 +25,7 @@ alias gc='git commit -sS'
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
alias wv='mpv $($PASTE_COMMAND)'
|
alias wv='mpv $($PASTE_COMMAND)'
|
||||||
alias lc='fc -nl $HISTCMD'
|
alias lc='fc -nl $HISTCMD'
|
||||||
|
alias curl='curl -L'
|
||||||
|
|
||||||
# Completions for elevation program (https://codeberg.org/Bowuigi/Unit21 in management/boas)
|
# Completions for elevation program (https://codeberg.org/Bowuigi/Unit21 in management/boas)
|
||||||
complete -cf boas
|
complete -cf boas
|
||||||
|
@ -47,26 +48,6 @@ copy() {
|
||||||
printf "%s" "$(</dev/stdin)" > >($COPY_COMMAND)
|
printf "%s" "$(</dev/stdin)" > >($COPY_COMMAND)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get local IP
|
|
||||||
lip() {
|
|
||||||
local OLD_IFS="$IFS"
|
|
||||||
local LINE_NUM=0
|
|
||||||
while read -r _ IP _; do
|
|
||||||
if [[ "$IP" == "${1:-$WIFI}": ]]; then
|
|
||||||
((LINE_NUM++))
|
|
||||||
if [[ $LINE_NUM == 2 ]]; then
|
|
||||||
IFS="/"
|
|
||||||
for STR in $IP; do
|
|
||||||
echo "$STR"
|
|
||||||
break 3
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
[[ $LINE_NUM -gt 0 ]] && ((LINE_NUM++))
|
|
||||||
done <<< "$(ip a)"
|
|
||||||
IFS="$OLD_IFS"
|
|
||||||
}
|
|
||||||
|
|
||||||
# URL-encode stdin
|
# URL-encode stdin
|
||||||
urlencode() {
|
urlencode() {
|
||||||
LC_COLLATE_OLD=$LC_COLLATE
|
LC_COLLATE_OLD=$LC_COLLATE
|
||||||
|
@ -91,3 +72,32 @@ fixdh() {
|
||||||
cp $SRC $DEST;
|
cp $SRC $DEST;
|
||||||
done;
|
done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlen() {
|
||||||
|
N=$(wc -c <<< "$*")
|
||||||
|
((N--))
|
||||||
|
printf '%u\n' "$N"
|
||||||
|
}
|
||||||
|
|
||||||
|
uppweb() {
|
||||||
|
pushd ~/git/cobra.vern.cc
|
||||||
|
local DIR="/home/cobra/git/cobra.vern.cc"
|
||||||
|
rsync -rtvzP --exclude ".git" --exclude ".gitignore" --exclude 'README.md' --exclude 'LICENSE' $DIR/* vern.cc:~/public_html/
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
upvweb() {
|
||||||
|
pushd ~/git/website
|
||||||
|
rsync --rsh='ssh -p1813' -rtvzP --exclude '.git' --exclude 'LICENSE' /home/cobra/git/website/ root@vern.cc:/var/www/website
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
upvgem() {
|
||||||
|
pushd ~/git/gemini
|
||||||
|
rsync --rsh='ssh -p1813' -rtvzP --exclude '.git' --exclude 'LICENSE' /home/cobra/git/gemini/ root@vern.cc:/home/gemini/gemini/vern.cc
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
pubdate() {
|
||||||
|
date +'%a, %d %b %Y %T %z'
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
browser "mpv --user-agent=Mozilla/5.0 '--ytdl-format=bestvideo[height=?480][fps<=?30]+bestaudio/best' %u"
|
browser "mpv --user-agent=Mozilla/5.0 '--ytdl-format=bestvideo[height=?720][fps<=?30]+bestaudio/best' %u"
|
||||||
|
use-proxy yes
|
||||||
|
proxy-type socks5h
|
||||||
|
proxy 127.0.0.1:9050
|
||||||
|
|
11
.profile
11
.profile
|
@ -1,3 +1,12 @@
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
export INVIDIOUS="https://invidious.snopyta.org"
|
export INVIDIOUS="https://inv.vern.cc"
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
export LESS_TERMCAP_mb='[01;32m'
|
||||||
|
export LESS_TERMCAP_md='[01;32m'
|
||||||
|
export LESS_TERMCAP_me='[0m'
|
||||||
|
export LESS_TERMCAP_se='[0m'
|
||||||
|
export LESS_TERMCAP_so='[01;47;34m'
|
||||||
|
export LESS_TERMCAP_ue='[0m'
|
||||||
|
export LESS_TERMCAP_us='[01;36m'
|
||||||
|
export LESS=-R
|
||||||
|
|
118
.prompt
118
.prompt
|
@ -33,69 +33,69 @@ __get_cmd_time() {
|
||||||
local HOUR
|
local HOUR
|
||||||
local MINS
|
local MINS
|
||||||
local SECS
|
local SECS
|
||||||
((YEAR=10#0$(($(TZ=UTC printf '%(%Y)T' $CMD_TIME)))-1970))
|
((YEAR=10#$(($(TZ=UTC printf '%(%Y)T' "$CMD_TIME")))-1970))
|
||||||
((DAYS=10#0$(TZ=UTC printf '%(%j)T' $CMD_TIME)))
|
((DAYS=10#$(TZ=UTC printf '%(%j)T' "$CMD_TIME")))
|
||||||
((HOUR=10#0$(TZ=UTC printf '%(%H)T' $CMD_TIME)))
|
((HOUR=10#$(TZ=UTC printf '%(%H)T' "$CMD_TIME")))
|
||||||
((MINS=10#0$(TZ=UTC printf '%(%M)T' $CMD_TIME)))
|
((MINS=10#$(TZ=UTC printf '%(%M)T' "$CMD_TIME")))
|
||||||
((SECS=10#0$(TZ=UTC printf '%(%S)T' $CMD_TIME)))
|
((SECS=10#$(TZ=UTC printf '%(%S)T' "$CMD_TIME")))
|
||||||
|
|
||||||
# Choose whether or not to print hours minutes and seconds
|
# Choose whether or not to print hours minutes and seconds
|
||||||
[[ $CMD_TIME -ge 31536000 ]] && printf '%sy ' ${YEAR}
|
[[ $CMD_TIME -ge 31536000 ]] && printf '%sy ' "${YEAR}"
|
||||||
[[ $CMD_TIME -ge 86400 ]] && printf '%sd ' ${DAYS}
|
[[ $CMD_TIME -ge 86400 ]] && printf '%sd ' "${DAYS}"
|
||||||
[[ $CMD_TIME -ge 3600 ]] && printf '%sh ' ${HOUR}
|
[[ $CMD_TIME -ge 3600 ]] && printf '%sh ' "${HOUR}"
|
||||||
[[ $CMD_TIME -ge 60 ]] && printf '%sm ' ${MINS}
|
[[ $CMD_TIME -ge 60 ]] && printf '%sm ' "${MINS}"
|
||||||
[[ $CMD_TIME -ge 1 ]] && printf '%ss ' ${SECS}
|
[[ $CMD_TIME -ge 1 ]] && printf '%ss ' "${SECS}"
|
||||||
# If you want to have a limit uncomment the next line and replace somenum with
|
# If you want to have a limit uncomment the next line and replace somenum with
|
||||||
# the minimum microseconds
|
# the minimum microseconds
|
||||||
# [[ $CMD_US -ge somenum ]] &&
|
# [[ $CMD_US -ge somenum ]] &&
|
||||||
printf '%sμs' ${CMD_US:-0}
|
printf '%sμs' "${CMD_US:-0}"
|
||||||
}
|
}
|
||||||
|
|
||||||
__sig() {
|
__sig() {
|
||||||
# Giant switch case for getting the name of the signal (`kill -l`)
|
# Giant switch case for getting the name of the signal (`kill -l`)
|
||||||
local ITR=0
|
local ITR=0
|
||||||
local RET
|
local RET
|
||||||
for RET in $@; do
|
for RET in "$@"; do
|
||||||
if [[ $ITR != 0 ]]; then
|
if [[ $ITR != 0 ]]; then
|
||||||
printf '%s|%s' "$_WHT" "$_RED"
|
printf '%s|%s' "$_WHT" "$_RED"
|
||||||
fi
|
fi
|
||||||
((ITR++))
|
((ITR++))
|
||||||
case $RET in
|
case $RET in
|
||||||
126): ACCES ;;
|
126): "ACCES" ;;
|
||||||
127): NOENT ;;
|
127): "NOENT" ;;
|
||||||
129): HUP ;;
|
129): "HUP" ;;
|
||||||
130): INT ;;
|
130): "INT" ;;
|
||||||
131): QUIT ;;
|
131): "QUIT" ;;
|
||||||
132): ILL ;;
|
132): "ILL" ;;
|
||||||
133): TRAP ;;
|
133): "TRAP" ;;
|
||||||
134): ABRT ;;
|
134): "ABRT" ;;
|
||||||
135): BUS ;;
|
135): "BUS" ;;
|
||||||
136): FPE ;;
|
136): "FPE" ;;
|
||||||
137): KILL ;;
|
137): "KILL" ;;
|
||||||
138): USR1 ;;
|
138): "USR"1 ;;
|
||||||
139): SEGV ;;
|
139): "SEGV" ;;
|
||||||
140): USR2 ;;
|
140): "USR"2 ;;
|
||||||
141): PIPE ;;
|
141): "PIPE" ;;
|
||||||
142): ALRM ;;
|
142): "ALRM" ;;
|
||||||
143): TERM ;;
|
143): "TERM" ;;
|
||||||
144): STKFLT ;;
|
144): "STKFLT" ;;
|
||||||
145): CHLD ;;
|
145): "CHLD" ;;
|
||||||
146): CONT ;;
|
146): "CONT" ;;
|
||||||
147): STOP ;;
|
147): "STOP" ;;
|
||||||
148): TSTP ;;
|
148): "TSTP" ;;
|
||||||
149): TTIN ;;
|
149): "TTIN" ;;
|
||||||
150): TTOU ;;
|
150): "TTOU" ;;
|
||||||
151): URG ;;
|
151): "URG" ;;
|
||||||
152): XCPU ;;
|
152): "XCPU" ;;
|
||||||
153): XFSZ ;;
|
153): "XFSZ" ;;
|
||||||
154): VTALRM ;;
|
154): "VTALRM" ;;
|
||||||
155): PROF ;;
|
155): "PROF" ;;
|
||||||
156): WINCH ;;
|
156): "WINCH" ;;
|
||||||
157): IO ;;
|
157): "IO" ;;
|
||||||
158): PWR ;;
|
158): "PWR" ;;
|
||||||
159): SYS ;;
|
159): "SYS" ;;
|
||||||
16[3-9]|1[7-8][0-9]|19[0-2]): RT$(($RET-128)) ;; # Savagery
|
16[3-9]|1[7-8][0-9]|19[0-2]): "RT$((RET-128))" ;; # Savagery
|
||||||
*): $RET ;; # Print exit code if not in list
|
*): "$RET" ;; # Print exit code if not in list
|
||||||
esac
|
esac
|
||||||
printf '%s' "$_"
|
printf '%s' "$_"
|
||||||
done
|
done
|
||||||
|
@ -115,7 +115,7 @@ __ssh() {
|
||||||
|
|
||||||
__prompt() {
|
__prompt() {
|
||||||
# Get exit code (must be first)
|
# Get exit code (must be first)
|
||||||
local PLC=(${PIPESTATUS[@]})
|
local PLC=("${PIPESTATUS[@]}")
|
||||||
|
|
||||||
# Reset time when prompt was first displayed after command
|
# Reset time when prompt was first displayed after command
|
||||||
# this contributes to the ~40 microsecond difference in $CMD_US and the actual time it took
|
# this contributes to the ~40 microsecond difference in $CMD_US and the actual time it took
|
||||||
|
@ -142,10 +142,16 @@ __prompt() {
|
||||||
((CMD_TIME=CMD_US/1000000))
|
((CMD_TIME=CMD_US/1000000))
|
||||||
|
|
||||||
[[ ${#CMD_US} -lt 6 ]] || CMD_US="${CMD_US: -6}"
|
[[ ${#CMD_US} -lt 6 ]] || CMD_US="${CMD_US: -6}"
|
||||||
((CMD_US=10#0$CMD_US))
|
((CMD_US=10#$CMD_US))
|
||||||
|
|
||||||
# Set prompt sections
|
# Set prompt sections
|
||||||
|
|
||||||
|
local SIG
|
||||||
|
local COL
|
||||||
|
local UHD
|
||||||
|
local TIME
|
||||||
|
local IND
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
|
|
||||||
# ssh detection and indicator
|
# ssh detection and indicator
|
||||||
|
@ -153,23 +159,23 @@ __prompt() {
|
||||||
|
|
||||||
# [INT], [4], etc.
|
# [INT], [4], etc.
|
||||||
local RET
|
local RET
|
||||||
for RET in ${PLC[@]}; do
|
for RET in "${PLC[@]}"; do
|
||||||
if [[ $RET > 0 ]]; then
|
if [[ $RET -gt 0 ]]; then
|
||||||
local SIG="$(printf '%s[%s%s%s] ' "$_BLU" "$_RED" "$(__sig ${PLC[@]})" "$_BLU")"
|
SIG="$(printf '%s[%s%s%s] ' "$_BLU" "$_RED" "$(__sig "${PLC[@]}")" "$_BLU")"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# [user@homeserver:~]
|
# [user@homeserver:~]
|
||||||
local COL="$([[ $UID == 0 ]] && printf '%s' "$_RED" || printf '%s' "$_YLW")"
|
COL="$([[ $UID == 0 ]] && printf '%s' "$_RED" || printf '%s' "$_YLW")"
|
||||||
local UHD="${_BLD}${_BLU}[${COL}\u${_PRP}@${_CYN}\h${_PRP}:${_GRN}\w${_BLU}]"
|
UHD="${_BLD}${_BLU}[${COL}\u${_PRP}@${_CYN}\h${_PRP}:${_GRN}\w${_BLU}]"
|
||||||
|
|
||||||
# 2y 351d 12m 43s 382969μs
|
# 2y 351d 12m 43s 382969μs
|
||||||
local TIME="${_YLW}$(__get_cmd_time)"
|
TIME="${_YLW}$(__get_cmd_time)"
|
||||||
|
|
||||||
# Random colored $ or #
|
# Random colored $ or #
|
||||||
_RAND256="\[\033[38;2;$((RANDOM%256));$((RANDOM%256));$((RANDOM%256))m\]"
|
_RAND256="\[\033[38;2;$((RANDOM%256));$((RANDOM%256));$((RANDOM%256))m\]"
|
||||||
local IND="${_RAND256}\\$"
|
IND="${_RAND256}\\$"
|
||||||
|
|
||||||
# Set the prompt
|
# Set the prompt
|
||||||
PS1="${_NON}${SSH}${SIG}${UHD} ${TIME} ${IND} ${_NON}"
|
PS1="${_NON}${SSH}${SIG}${UHD} ${TIME} ${IND} ${_NON}"
|
||||||
|
|
Loading…
Reference in New Issue