update for arm linux
This commit is contained in:
1
aliases
1
aliases
@@ -19,6 +19,7 @@ alias gcc="gcc -g"
|
|||||||
alias hora='date "+%H:%M:%S"'
|
alias hora='date "+%H:%M:%S"'
|
||||||
alias wthr='curl wttr.in/san_luis_obispo'
|
alias wthr='curl wttr.in/san_luis_obispo'
|
||||||
alias nf='cl; neofetch; shownetinfo && lab && batt'
|
alias nf='cl; neofetch; shownetinfo && lab && batt'
|
||||||
|
alias servers='python3 /Users/smparkin/Development/server_stats/servers.py'
|
||||||
|
|
||||||
# School
|
# School
|
||||||
alias 429='cd /Users/smparkin/Library/Mobile\ Documents/com\~apple\~CloudDocs/CalPoly/2020-21/Winter21/CSC429'
|
alias 429='cd /Users/smparkin/Library/Mobile\ Documents/com\~apple\~CloudDocs/CalPoly/2020-21/Winter21/CSC429'
|
||||||
|
|||||||
74
functions
74
functions
@@ -1,46 +1,46 @@
|
|||||||
function shownetinfo() {
|
function shownetinfo() {
|
||||||
OSTYPE=$(uname -s)
|
OSTYPE=$(uname -s)
|
||||||
IP=""
|
IP=""
|
||||||
GW=""
|
GW=""
|
||||||
NET=""
|
NET=""
|
||||||
|
|
||||||
if [ "$OSTYPE" = "Linux" ]; then
|
if [ "$OSTYPE" = "Linux" ]; then
|
||||||
IP=$(ifconfig | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f10)
|
IP=$(ip addr show | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f6 | cut -d "/" -f1)
|
||||||
NET=$(ip route | grep default | cut -d " " -f3)
|
NET=$(ip route | grep default | cut -d " " -f3)
|
||||||
elif [ "$OSTYPE" = "Darwin" ]; then
|
elif [ "$OSTYPE" = "Darwin" ]; then
|
||||||
NET=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1)
|
NET=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1)
|
||||||
IP=$(ifconfig | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f2)
|
IP=$(ifconfig | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f2)
|
||||||
fi
|
fi
|
||||||
if [ "$NET" != "" ]; then
|
if [ "$NET" != "" ]; then
|
||||||
GW=$(curl -s icanhazip.com)
|
GW=$(curl -s icanhazip.com)
|
||||||
fi
|
fi
|
||||||
tput setaf 7; tput bold; echo -en "Net: "
|
tput setaf 7; tput bold; echo -en "Net: "
|
||||||
tput sgr0
|
tput sgr0
|
||||||
tput setaf 7; echo -en "internal $IP"
|
tput setaf 7; echo -en "internal $IP"
|
||||||
if [ "$NET" != "" ]; then
|
if [ "$NET" != "" ]; then
|
||||||
echo -en ", external $GW"
|
echo -en ", external $GW"
|
||||||
echo -en ", router $NET"
|
echo -en ", router $NET"
|
||||||
fi
|
fi
|
||||||
tput sgr0
|
tput sgr0
|
||||||
}
|
}
|
||||||
|
|
||||||
function batt() {
|
function batt() {
|
||||||
tput setaf 7
|
tput setaf 7
|
||||||
tput bold
|
tput bold
|
||||||
echo -en " | "
|
echo -en " | "
|
||||||
tput sgr0
|
tput sgr0
|
||||||
tput setaf 7; tput bold; echo -en "Bat: "
|
tput setaf 7; tput bold; echo -en "Bat: "
|
||||||
tput sgr0
|
tput sgr0
|
||||||
tput setaf 7
|
tput setaf 7
|
||||||
echo -en $(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
echo -en $(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||||
echo "%"
|
echo "%"
|
||||||
tput sgr0
|
tput sgr0
|
||||||
}
|
}
|
||||||
|
|
||||||
function lab() {
|
function lab() {
|
||||||
tput setaf 7; tput bold; echo -en "Lab: "
|
tput setaf 7; tput bold; echo -en "Lab: "
|
||||||
tput sgr0
|
tput sgr0
|
||||||
tput setaf 7
|
tput setaf 7
|
||||||
echo -en $(curl -s https://thewhitehat.club/api/v1/status | jq ".data.status" | tr -d "\"")
|
echo -en $(curl -s https://thewhitehat.club/api/v1/status | jq ".data.status" | tr -d "\"")
|
||||||
tput sgr0
|
tput sgr0
|
||||||
}
|
}
|
||||||
|
|||||||
14
zshrc
14
zshrc
@@ -40,10 +40,12 @@ elif [ "$OSTYPE" = "Darwin" ]; then
|
|||||||
batt
|
batt
|
||||||
fi
|
fi
|
||||||
# configure homebrew for arm and x86
|
# configure homebrew for arm and x86
|
||||||
ARCH=$(uname -m)
|
if [ "$OSTYPE" = "Darwin" ]; then
|
||||||
if [ "$ARCH" = "arm64" ]; then
|
ARCH=$(uname -m)
|
||||||
export PATH="/opt/homebrew/bin:$PATH"
|
if [ "$ARCH" = "arm64" ]; then
|
||||||
export PATH="/opt/homebrew/sbin:$PATH"
|
export PATH="/opt/homebrew/bin:$PATH"
|
||||||
elif [ "$ARCH" = "x86_64" ]; then
|
export PATH="/opt/homebrew/sbin:$PATH"
|
||||||
export PATH="/usr/local/bin:$PATH"
|
elif [ "$ARCH" = "x86_64" ]; then
|
||||||
|
export PATH="/usr/local/bin:$PATH"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user