first upload
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
# .roidrc: a compact, single-file Bash shell environment tweaker
|
||||
# for rooted Void Linux environments like Roid or Voideck
|
||||
# Only include in the interactive sessions, e.g. for bash:
|
||||
# [[ $- == *i* ]] && . $HOME/.roidrc
|
||||
# Core deps: less, nano (8.x+), sed, ed, rlwrap, curl, openssh, dtach
|
||||
# Created by Luxferre in 2026, released into public domain
|
||||
|
||||
# override the editor (needs Nano 8 and up) and pager
|
||||
export EDITOR='nano -FEDSMAGic/max%_T2'
|
||||
export PAGER='less -RXF'
|
||||
alias nn="$EDITOR"
|
||||
alias pg="$PAGER"
|
||||
|
||||
# edit and/or live-reload this very file
|
||||
alias reload-rc=". $BASH_SOURCE"
|
||||
alias edit-rc="$EDITOR $BASH_SOURCE && . $BASH_SOURCE"
|
||||
|
||||
# get the most recent command run on this shell
|
||||
alias lastcmd='history | tail -q -n 2 | head -q -n 1 | sed "s/^[[:space:]]*[0-9]*[[:space:]]*//"'
|
||||
|
||||
# custom alias management framework (defalias/toalias/savealias)
|
||||
alias defalias='___(){ __="$1";shift;alias $__="_$__(){ $*; };_$__";unset __; };___'
|
||||
defalias toalias 'defalias "$1" "$(lastcmd)";alias "$1"'
|
||||
defalias savealias "[ -n \"\$1\" ] && echo \"alias \$(alias \$1 | sed 's/^alias //')\" >> $BASH_SOURCE"
|
||||
|
||||
# most important aliases
|
||||
alias rw='rlwrap -R'
|
||||
alias ee='rlwrap -R ed -p:'
|
||||
alias eer='sudo rlwrap -R ed -p:'
|
||||
defalias l 'ls -lahF --time-style=long-iso --color=always $* | less -RXF'
|
||||
defalias sshed 'f="$(mktemp)";scp $1 $f && $EDITOR $f && scp $f $1 && rm -f $f && unset f'
|
||||
alias dl='curl -sSLO'
|
||||
|
||||
# less important aliases
|
||||
alias n='echo -e "$(date -Im)\t$*" >> ~/n'
|
||||
defalias r13 'echo "$*" | tr "A-Za-z" "N-ZA-Mn-za-m"'
|
||||
alias websrv='python3 -m http.server'
|
||||
alias gcm='git commit -a -m'
|
||||
alias gp='git push origin'
|
||||
alias gpm='git push origin master'
|
||||
alias jpm-build='jpm clean && jpm build --build-type=release --ldflags="-s"'
|
||||
alias jpm-build-static='jpm clean && jpm build --build-type=release --ldflags="-s" --janet-cflags="-static"'
|
||||
|
||||
# Void-specific aliases
|
||||
alias pkgadd='xbps-install -Sy'
|
||||
alias pkgdel='xbps-remove -oy'
|
||||
alias pkgsearch='xbps-query -Rs'
|
||||
alias sysup='xbps-install -Suy && vkpurge rm all && xbps-remove -OOoy'
|
||||
alias sysclean='vkpurge rm all && xbps-remove -OOoy'
|
||||
|
||||
# Roid-specific aliases
|
||||
alias tmhome='cd $TERMUX_HOME'
|
||||
alias gui='exec termux-x11 :0 -xstartup "dbus-launch --exit-with-session i3"'
|
||||
|
||||
# OpenSSL-based vault helper
|
||||
ovault() {
|
||||
local pw="$4"
|
||||
local op='-d'
|
||||
[ "$1" = 'e' ] && op='-e'
|
||||
if [ -z "$pw" ]; then
|
||||
read -rs -p 'Enter vault password: ' pw
|
||||
fi
|
||||
openssl aes-256-cbc $op -pbkdf2 -iter 100000 -pass pass:"$pw" -in "$2" -out "$3"
|
||||
}
|
||||
|
||||
# dmux, a simple dtach based terminal session manager, as a Bash function
|
||||
dmux() {
|
||||
local SDIR="$HOME/.dtsess" SPFILE="$SDIR/.list" sname
|
||||
local -a MENU
|
||||
mkdir -p "$SDIR"
|
||||
touch "$SPFILE"
|
||||
mapfile -t MENU < "$SPFILE"
|
||||
if [[ -z "$(ls -1 "$SDIR")" ]]; then
|
||||
for sname in "${MENU[@]}"; do
|
||||
dtach -n "$SDIR/$sname" $SHELL
|
||||
done
|
||||
fi
|
||||
PS3='Select a session: '
|
||||
while true; do
|
||||
select sname in "${MENU[@]}" New Quit; do break; done
|
||||
[[ "$sname" = 'Quit' ]] && printf '\033[0m' && break
|
||||
[[ "$sname" = 'New' ]] && read -r -p 'New session name: ' sname
|
||||
[[ -n "$sname" ]] && printf '\033[0m' && dtach -A "$SDIR/$sname" $SHELL
|
||||
ls -1 "$SDIR" > "$SPFILE"
|
||||
mapfile -t MENU < "$SPFILE"
|
||||
done
|
||||
}
|
||||
|
||||
# ...custom saved aliases will go here
|
||||
Reference in New Issue
Block a user