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
|
||||
alias sudo='sh -c "exit 1"'
|
||||
# Other aliases
|
||||
alias clear="printf '\033[2J\033[H'"
|
||||
alias clear="printf '\033c'" # faster than ncurses clear by a lot
|
||||
alias c='clear'
|
||||
alias ls='ls --color=auto -FAh'
|
||||
alias ll='ls -l'
|
||||
|
@ -30,7 +30,10 @@ alias lc='fc -nl $HISTCMD'
|
|||
complete -cf boas
|
||||
|
||||
# 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
|
||||
cpusage() {
|
||||
|
@ -42,11 +45,34 @@ update() { boas sh -c "$UPDATE"; }
|
|||
|
||||
# Im too lazy to type
|
||||
copy() {
|
||||
tee >($COPY_COMMAND)
|
||||
printf "%s" "$(</dev/stdin)" > >($COPY_COMMAND)
|
||||
}
|
||||
|
||||
# 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
|
||||
urlencode() {
|
||||
|
|
Loading…
Reference in New Issue