This commit is contained in:
Ray Elliott 2026-10-27 12:01:57 +00:00
commit 6ad08b973b
3 changed files with 56 additions and 80 deletions

View file

@ -1,27 +1,15 @@
#!/bin/sh #!/usr/bin/env bash
ALIASES_BLACK='\033[0;30m' # Black # shellcheck shell=bash
ALIASES_RED='\033[0;31m' # Red
ALIASES_GREEN='\033[0;32m' # Green ALIASES_GREEN='\033[0;32m' # Green
ALIASES_YELLOW='\033[0;33m' # Yellow (or Brown)
ALIASES_BLUE='\033[0;34m' # Blue ALIASES_BLUE='\033[0;34m' # Blue
ALIASES_MAGENTA='\033[0;35m' # Magenta
ALIASES_CYAN='\033[0;36m' # Cyan
ALIASES_LIGHT_GRAY='\033[0;37m' # Light Gray (or White)
ALIASES_DARK_GRAY='\033[1;30m' # Dark Gray
ALIASES_LIGHT_RED='\033[1;31m' # Light Red
ALIASES_LIGHT_GREEN='\033[1;32m' # Light Green
ALIASES_LIGHT_YELLOW='\033[1;33m' # Light Yellow
ALIASES_LIGHT_BLUE='\033[1;34m' # Light Blue
ALIASES_LIGHT_MAGENTA='\033[1;35m' # Light Magenta
ALIASES_LIGHT_CYAN='\033[1;36m' # Light Cyan
ALIASES_WHITE='\033[1;37m' # White ALIASES_WHITE='\033[1;37m' # White
ALIASES_NC='\033[0m' # No Color ALIASES_NC='\033[0m' # No Color
echo "Aliases added:" echo "Aliases added:"
echo -e "${ALIASES_WHITE} cs venv" echo -e "${ALIASES_WHITE} cs pc venv cdlf lfcd"
echo " n ns pc cdlf lfcd g gg gitknow disk-usage sx debug.log" echo " e er et en ens ea ee"
echo " mc newsh smartresize" echo " g gg disk-usage debug.log"
echo " backup update re mc"
echo " mac red alice phthalo zirconia datapasa ultra kermit singsay pi4" echo " mac red alice phthalo zirconia datapasa ultra kermit singsay pi4"
echo -e " ${ALIASES_NC}client:${ALIASES_WHITE} crafty lv" echo -e " ${ALIASES_NC}client:${ALIASES_WHITE} crafty lv"
echo -e "${ALIASES_NC}" echo -e "${ALIASES_NC}"
@ -52,7 +40,6 @@ alias speak='/usr/local/src/kokora/speak'
alias debug.log='clear && echo "" > debug.log && tail -f debug.log' alias debug.log='clear && echo "" > debug.log && tail -f debug.log'
alias g='git status' alias g='git status'
alias gg='git add . && git commit -m "update" && git push' alias gg='git add . && git commit -m "update" && git push'
alias gitknow='cd ~/knowledge-base && git add . && git status && git commit -m update && git push ; cd -'
alias ls='LC_COLLATE=C ls --color=auto -h --group-directories-first --time-style=+"%d.%m.%Y %H:%M" -F' alias ls='LC_COLLATE=C ls --color=auto -h --group-directories-first --time-style=+"%d.%m.%Y %H:%M" -F'
@ -99,49 +86,33 @@ else
fi fi
cdlf() { cdlf() {
cd "$(cat ~/.cache/lf-last-dir)" local last_dir
[ -r "$HOME/.cache/lf-last-dir" ] || return 1
IFS= read -r last_dir < "$HOME/.cache/lf-last-dir"
[ -n "$last_dir" ] || return 1
cd -- "$last_dir" || return
} }
lfcd() { lfcd() {
lf -last-dir-path="$HOME"/.cache/lf-last-dir lf -last-dir-path="$HOME"/.cache/lf-last-dir && cdlf
cdlf
} }
update() { update() {
echo -e "Executing \"${ALIASES_GREEN}pacman -Syu${ALIASES_NC}\" via \"${ALIASES_BLUE}archnews_wrap${ALIASES_NC}\" wrapper" echo -e "Executing \"${ALIASES_GREEN}pacman -Syu${ALIASES_NC}\" via \"${ALIASES_BLUE}archnews_wrap${ALIASES_NC}\" wrapper"
sudo ~/.src/archnews/archnews_wrap -Syu \ sudo ~/.src/archnews/archnews_wrap -Syu || return
&& systemctl --user start --no-block package-status-refresh.service systemctl --user start --no-block package-status-refresh.service >/dev/null 2>&1 || true
}
# functions
# $1 - output directory
# $2 - size
# $3 - filename
smartresize() {
mogrify -path "$3" -filter Triangle -define filter:support=2 -thumbnail "$2" -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB "$1"
} }
re() { re() {
git clone ssh://git@git.rayelliott.dev:3222/rayelliott/"$1".git $2 if [ -n "${2:-}" ]; then
git clone "ssh://git@git.rayelliott.dev:3222/rayelliott/$1.git" "$2"
else
git clone "ssh://git@git.rayelliott.dev:3222/rayelliott/$1.git"
fi
} }
mc() { mc() {
mkdir "$1" && cd "$1" mkdir "$1" || return
} cd "$1" || return
newsh() {
set -e
if [ -f "$1" ] ; then
echo "Error: file exists: $1"
exit 1
fi
echo "#!/bin/sh" > "$1"
echo "" >> "$1"
echo "$2" >> "$1"
chmod +x "$1"
nvim "$1" +3
} }

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -e "$HOME/.profile" ] ; then if [ -e "$HOME/.profile" ] || [ -L "$HOME/.profile" ] ; then
mv "$HOME/.profile" "$HOME/.profile-original-$(date +%s)" mv "$HOME/.profile" "$HOME/.profile-original-$(date +%s)"
fi fi

59
profile
View file

@ -1,46 +1,51 @@
#!/bin/sh
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state" export XDG_STATE_HOME="$HOME/.local/state"
export XDG_CACHE_HOME="$HOME/.cache" export XDG_CACHE_HOME="$HOME/.cache"
export SHELL_CONFIG="$SHELL_CONFIG:.profile" export SHELL_CONFIG="${SHELL_CONFIG:+${SHELL_CONFIG}:}.profile"
export EDITOR=/usr/bin/vim export EDITOR=/usr/bin/vim
export BROWSER=/usr/bin/qutebrowser export BROWSER=/usr/bin/qutebrowser
export GOPATH="$HOME/.go" export GOPATH="$HOME/.go"
if command -v ruby ; then _path_prepend() {
ruby_path=$(ruby -r rubygems -e "puts Gem.user_dir")/bin case ":${PATH}:" in
export PATH="$ruby_path:$PATH" *":$1:"*) ;;
fi &> /dev/null *) PATH="$1${PATH:+:${PATH}}" ;;
esac
}
if command -v php ; then _path_append() {
phpcs_path=$(composer global config bin-dir --absolute) case ":${PATH}:" in
export PATH="$phpcs_path:$PATH" *":$1:"*) ;;
fi &> /dev/null *) PATH="${PATH:+${PATH}:}$1" ;;
esac
}
export PATH="$PATH:$HOME/.local/bin" if command -v ruby >/dev/null 2>&1; then
export PATH="$PATH:/opt/neovim/nvim-linux-x86_64/bin" ruby_path=$(ruby -r rubygems -e 'puts Gem.user_dir' 2>/dev/null)
[ -n "$ruby_path" ] && _path_prepend "$ruby_path/bin"
fi
if command -v composer >/dev/null 2>&1; then
phpcs_path=$(composer global config bin-dir --absolute 2>/dev/null)
[ -n "$phpcs_path" ] && _path_prepend "$phpcs_path"
fi
_path_append "$GOPATH/bin"
_path_append "$HOME/.local/bin"
_path_append /opt/neovim/nvim-linux-x86_64/bin
export PATH
# https://developers.google.com/web/tools/puppeteer/troubleshooting # https://developers.google.com/web/tools/puppeteer/troubleshooting
export CHROME_DEVEL_SANDBOX=/usr/lib/chromium/chrome-sandbox export CHROME_DEVEL_SANDBOX=/usr/lib/chromium/chrome-sandbox
export HISTFILE=~/.histfile [ -r "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
#disable suspend and resume unset ruby_path phpcs_path
stty -ixon unset -f _path_prepend _path_append 2>/dev/null || true
# autoenv activate
export AUTOENV_ENV_FILENAME=.in
export AUTOENV_ENV_LEAVE_FILENAME=.out
export AUTOENV_ENABLE_LEAVE=1
[ -f "$HOME/.src/autoenv/activate.sh" ] && . "$HOME/.src/autoenv/activate.sh"
# custom aliases
[ -f "$HOME/.config/profile/aliases.sh" ] && . "$HOME/.config/profile/aliases.sh"
. "$HOME/.cargo/env"
# vim: filetype=sh # vim: filetype=sh