update funny bashrc

Signed-off-by: Aleksandar 'The Cobra' Widulski <thecobra@riseup.net>
This commit is contained in:
Aleksandar 'The Cobra' Widulski 2022-04-24 14:49:55 -04:00
parent e45f6ff387
commit 10eb443874
No known key found for this signature in database
GPG Key ID: C8F7E7CA91BCBA64
2 changed files with 25 additions and 10 deletions

20
.bashrc
View File

@ -1,5 +1,8 @@
# Source prompt
. ~/.prompt
[ -r ~/.devspec ] && . ~/.devspec
. $COLORS
# History stuff
export HISTCONTROL=ignoredups:erasedups
@ -20,7 +23,8 @@ alias sshd='boas /usr/sbin/sshd'
alias ga='git add'
alias gc='git commit -sS'
alias gp='git push'
alias wv='mpv $(wl-paste)'
alias wv='mpv $($PASTE_COMMAND)'
alias lc='fc -nl $HISTCMD'
# Completions for elevation program (https://codeberg.org/Bowuigi/Unit21 in management/boas)
complete -cf boas
@ -34,19 +38,15 @@ cpusage() {
}
# Update and upgrade system
update() { boas sh -c 'apk update && apk upgrade -aiv && apk fix'; }
update() { boas sh -c "$UPDATE"; }
# Im too lazy to type
copy() {
printf '%s' "$(</dev/stdin)" | tee >(wl-copy)
echo
tee >($COPY_COMMAND)
}
# Source colors for tty
. ~/.config/sxmo/isotope.dark
# Get local IP
lip() { ip a | grep ${1:-wlan0} | sed 1d | cut -d' ' -f6 | cut -d/ -f1; }
lip() { ip a | grep ${1:-$WIFI} | sed 1d | cut -d' ' -f6 | cut -d/ -f1; }
# URL-encode stdin
urlencode() {
@ -65,6 +65,6 @@ urlencode() {
LC_COLLATE=$LC_COLLATE_OLD
}
diffhome() { find . -type f -regex '\./\.[^g].*' -exec diff -q ~/{} {} \;; }
diffhome() { find . -type f -regex '\./\.[^g].*' -exec diff -q ~/{} {} 2> /dev/null \;; }
fixdh() { find . -type f -regex '\./\.[^g].*' -exec diff -q ~/{} {} \; | awk '{print $2 " " $4}' | while read -r line; do cp $line; done; }
fixdh() { diffhome | awk '{print $2 " " $4}' | while read -r line; do cp $line; done; }

15
.devspec Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
if [[ "$SXMO_WM" ]]; then
UPDATE="apk update && apk upgrade -aiv && apk fix"
COPY_COMMAND="wl-copy"
PASTE_COMMAND="wl-paste"
WIFI=wlan0
COLORS=~/.config/sxmo/isotope.dark
elif DISPLAY=:0 xrandr &>/dev/null; then
UPDATE="apt update && apt upgrade && apt autoremove"
COPY_COMMAND="xclip -i -selection clipboard"
PASTE_COMMAND="xclip -o"
WIFI=wlp2s0
COLORS=~/.config/isotope.dark
fi