Last active
February 6, 2022 01:02
-
-
Save daerich/77a146d949881de91fee8bf98d4073fa to your computer and use it in GitHub Desktop.
Bash run commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
alias ls='ls --color=auto' | |
PS1='\[\033[0;32m\]<\u\[\033[0;31m\]::\[\033[0;32m\]\h\[\033[1;34m\] \W \$\[\033[0;32m\] > \[\033[0m\]' | |
# Convenience functions | |
startway(){ | |
if [ -r "${HOME}/.waylandrc" ];then | |
sh "${HOME}/.waylandrc" | |
else | |
printf "Could'nt find '.waylandrc'!" | |
return 1 | |
fi | |
} | |
connect(){ | |
nmcli device wifi connect "$@" | |
} | |
compile(){ | |
local cc=$1; | |
local file=$2 | |
shift | |
$cc "$@" -o ${file%.*} | |
} | |
length(){ | |
printf "$*" |wc -m | |
} | |
therminfo() { | |
local count=0 | |
for x in $(cat /sys/class/thermal/thermal_zone*/type);do | |
ttypes[$count]=$x | |
count=$((count+1)) | |
done | |
count=0 | |
for x in $(cat /sys/class/thermal/thermal_zone*/temp);do | |
printf "${ttypes[$count]}: $x\n" | |
count=$((count+1)) | |
done; | |
} | |
powerstat(){ | |
for bat in /sys/class/power_supply/BAT* ;do | |
cat $bat/model_name|sed 's/$/:/g'; | |
cat $bat/{status,capacity}; | |
done; | |
} | |
verify() { | |
if [[ $# -ne 2 ]]; then | |
printf "USAGE:\nverify FILE HASH\n" | |
return | |
fi | |
local file=$(sha256sum $1 |awk '{print $1}') hsh=$2; | |
if [ "$file" == "$hsh" ]; then | |
echo "Match!"; | |
else | |
echo "Fail!"; | |
fi | |
} | |
dsize () { | |
if [ $# -eq 0 ]; then | |
printf "Usage:\n dsize PKG..\n" | |
return | |
fi | |
local pkg count=0; | |
for pkg in $(xbps-install -n "$@" |awk '{print $5}');do | |
count=$((pkg+count)) | |
done | |
echo $count | |
} | |
cck() { | |
if [ $# -ne 2 ]; then | |
printf "Usage:\n$0 FILE CCKSUM\n" | |
return 0 | |
fi | |
printf "SHA256 ($1) = $2\n" | |
} | |
alias len=length | |
alias ll='ls -lh' | |
alias la='ls -lah' | |
alias cls='clear' | |
alias u='uptime' | |
alias g='grep -E' | |
alias doas='sudo' | |
PATH=${PATH}:/opt/bin | |
. "$HOME/.cargo/env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment