# This is needed if you are planing to run XQuertz on MacOSX in Zsh and X11 over SSH
##################################
# HiddenSSH/XQuartz
#
# XQuartz to normal terminal
export DISPLAY=:0
# Collection of MacOSX specific .zsh tweaks
##################################
# MACOSX
#
alias cpuinfo='echo "CPU Frequency (MHz): $(sysctl -n hw.cpufrequency) \
\nCPU Model: $(sysctl -n machdep.cpu.brand_string) \
\nPhysical CPU Packages: $(sysctl -n hw.packages) \
\nLogical CPU Cores: $(sysctl -n hw.logicalcpu) \
\nPhysical CPU Cores: $(sysctl -n hw.physicalcpu)"'
# Function to display system information
sysinfo() {
# Set variables for each of the outputs from uname command
PROCESSOR_TYPE=$(/usr/bin/uname -p)
MACHINE_HARDWARE_NAME=$(uname -m)
KERNEL_RELEASE=$(uname -r)
KERNEL_NAME=$(uname -s)
KERNEL_VERSION=$(uname -v)
NODE_NAME=$(uname -n)
# Echo the variables
echo "Processor Type: $PROCESSOR_TYPE"
echo "Machine Hardware Name: $MACHINE_HARDWARE_NAME"
echo "Kernel Release: $KERNEL_RELEASE"
echo "Kernel Name: $KERNEL_NAME"
echo "Kernel Version: $KERNEL_VERSION"
echo "Node Name: $NODE_NAME"
}
# Firewall
alias firewall-show='echo "Location: /etc/pf.conf" && cat /etc/pf.conf'
alias firewall-restart="sudo pfctl -f /etc/pf.conf"
# Show Interfaces
showinterfacesinfo() {
# Detect the operating system
local OS=$(uname -s)
# Display interface information based on the OS
if [[ "$OS" == "Darwin" ]]; then
# macOS commands
local interfaces=($(ifconfig | grep '^[a-z]' | awk '{print $1}' | tr -d ':'))
for intf in $interfaces; do
local ip_and_mask=$(ifconfig $intf | grep 'inet ' | awk '{print $2, $4}')
print "$intf: $ip_and_mask"
done
elif [[ "$OS" == "Linux" ]]; then
# Linux commands
local interfaces=($(ip -o link show | awk -F': ' '{print $2}' | tr -d '@'))
for intf in $interfaces; do
local ip_and_mask=$(ip -o -f inet addr show $intf | awk '{print $4}')
print "$intf: $ip_and_mask"
done
else
print "Unsupported operating system." >&2
fi
}
# Aliases to make life easyer
##################################
# TREZOR
#
alias trezorconnected='trezorctl list'
alias remoteserver='trezor-agent -e ed25519 -c user@remote-server.hiddenssh.com'
# SSHFS Mount Function for .zsh
# Remember to replace User1 and Directory
##################################
# SSHFS Mount Function
# change user1 part
sshfsmount() {
sshfs -o reconnect \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=3 \
-o IdentityFile=~/.ssh/sshfs.key \
sshfs@sshfs:/home/user1/remote-direcory/ \
/Users/user1/directory-localy
}