Update bashrc
Signed-off-by: Aleksandar 'The Cobra' Widulski <thecobra@riseup.net>
This commit is contained in:
parent
fc2e2d8078
commit
f7dbd1b694
34
.bashrc
34
.bashrc
|
@ -12,7 +12,7 @@ export GPG_TTY=$(tty)
|
||||||
# We hate sudo here
|
# We hate sudo here
|
||||||
alias sudo='sh -c "exit 1"'
|
alias sudo='sh -c "exit 1"'
|
||||||
# Other aliases
|
# Other aliases
|
||||||
alias clear="printf '\033[2J\033[H'"
|
alias clear="printf '\033c'" # faster than ncurses clear by a lot
|
||||||
alias c='clear'
|
alias c='clear'
|
||||||
alias ls='ls --color=auto -FAh'
|
alias ls='ls --color=auto -FAh'
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
|
@ -30,7 +30,10 @@ alias lc='fc -nl $HISTCMD'
|
||||||
complete -cf boas
|
complete -cf boas
|
||||||
|
|
||||||
# Random string (passwords)
|
# Random string (passwords)
|
||||||
randstr() { tr -cd [:graph:] </dev/urandom | head -c${1:-256}; }
|
randstr() {
|
||||||
|
tr -cd [:graph:] </dev/urandom | read -r -n 256 RAND
|
||||||
|
echo "$RAND"
|
||||||
|
}
|
||||||
|
|
||||||
# Get CPU usage
|
# Get CPU usage
|
||||||
cpusage() {
|
cpusage() {
|
||||||
|
@ -42,11 +45,34 @@ update() { boas sh -c "$UPDATE"; }
|
||||||
|
|
||||||
# Im too lazy to type
|
# Im too lazy to type
|
||||||
copy() {
|
copy() {
|
||||||
tee >($COPY_COMMAND)
|
printf "%s" "$(</dev/stdin)" > >($COPY_COMMAND)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get local IP
|
# Get local IP
|
||||||
lip() { ip a | grep ${1:-$WIFI} | sed 1d | cut -d' ' -f6 | cut -d/ -f1; }
|
lip() {
|
||||||
|
local OLD_IFS="$IFS"
|
||||||
|
local LINE_NUM=0
|
||||||
|
local STR_NUM=0
|
||||||
|
while read -r LINE; do
|
||||||
|
if [[ "$LINE" == *"${1:-$WIFI}"* ]]; then
|
||||||
|
LINE_NUM=$((LINE_NUM+1))
|
||||||
|
if [[ $LINE_NUM == 2 ]]; then
|
||||||
|
for STR in $LINE; do
|
||||||
|
STR_NUM=$((STR_NUM+1))
|
||||||
|
if [[ $STR_NUM == 2 ]]; then
|
||||||
|
local IP="$STR"
|
||||||
|
IFS="/"
|
||||||
|
for STR in $IP; do
|
||||||
|
echo "$STR"
|
||||||
|
break 3
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <<< "$(ip a)"
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
}
|
||||||
|
|
||||||
# URL-encode stdin
|
# URL-encode stdin
|
||||||
urlencode() {
|
urlencode() {
|
||||||
|
|
2
.devspec
2
.devspec
|
@ -8,6 +8,6 @@ if [[ "$SXMO_WM" ]]; then
|
||||||
else
|
else
|
||||||
UPDATE="apt update && apt upgrade && apt autoremove"
|
UPDATE="apt update && apt upgrade && apt autoremove"
|
||||||
COPY_COMMAND="xclip -i -selection clipboard"
|
COPY_COMMAND="xclip -i -selection clipboard"
|
||||||
PASTE_COMMAND="xclip -o"
|
PASTE_COMMAND="xclip -o -selection clipboard"
|
||||||
WIFI=wlp2s0
|
WIFI=wlp2s0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue