Skip to content

Instantly share code, notes, and snippets.

@MParvin
Last active April 12, 2025 08:14
Show Gist options
  • Save MParvin/8314dad43e7ab22187aec3777cf1c89a to your computer and use it in GitHub Desktop.
Save MParvin/8314dad43e7ab22187aec3777cf1c89a to your computer and use it in GitHub Desktop.
My Aliases and functions
alias zource='source ~/.zshrc'
alias vourse='source .venv/bin/activate'
# Wrong command as alias
alias sl='ls'
alias greo='grep'
# SSH key aliases
#alias myKey='cat ~/.ssh/id_ed25519.pub | xclip -selection c && echo "key copied to clipboard"'
alias myKey='cat ~/.ssh/id_ed25519.pub | /usr/bin/pbcopy && echo "key copied to clipboard"'
#alias myOldKey='cat ~/.ssh/id_rsa.pub | xclip -selection c && echo "key copied to clipboard"'
alias myOldKey='cat ~/.ssh/id_rsa.pub | /usr/bin/pbcopy && echo "key copied to clipboard"'
alias myKeyShow='cat ~/.ssh/id_ed25519.pub'
alias myKeyOldShow='cat ~/.ssh/id_rsa.pub'
# Dig aliases
alias d8='dig @8.8.8.8'
alias d8s='dig @8.8.8.8 +short'
alias d4s='dig @4.2.2.4 +short'
# CD aliases
alias MyGit='cd $MYGIT_DIR'
alias github='cd $MYGIT_DIR/github'
alias gitlab='cd $MYGIT_DIR/gitlab'
alias DastYar='cd $MYGIT_DIR/github/Bash/Dastyar'
# Ping aliases
alias p8='ping 8.8.8.8'
alias p4='ping 4.2.2.4'
alias p1='ping 1.1.1.1'
alias p192='ping 192.168.1.1'
# Shecan aliases
alias shecan='echo -e "178.22.122.100\n185.51.200.2\n\n\nnameserver 178.22.122.100\nnameserver 185.51.200.2\n \n\nPro:\n\nnameserver 178.22.122.101\nnameserver 185.51.200.1\n"'
alias dshecan='dig @178.22.122.100 +short'
alias dshecan2='dig @185.51.200.2 +short'
alias dshecanpro='dig @178.22.122.101 +short'
alias dshecanpro2='dig @185.51.200.1 +short'
# Alias finder
alias al='alias | grep -i '
# Watch aliases
alias w1d='watch -n1 -d'
alias w3d='watch -n3 -d'
alias w1dk='watch -n1 -d kubectl'
# Kill ssh
alias pks='pkill ssh'
# VIM aliases
alias vizshrc='vim ~/.zshrc'
# Taskfile
alias ta='task'
# Terraform aliases
alias t='terraform'
# Docker aliases
alias dpu='noti docker pull'
alias dtag='docker tag'
alias dps='docker ps'
# Molecule
alias mol='molecule'
# Vagrant aliases
alias v='noti vagrant'
# Operator SDK
alias os='operator-sdk'
# Netstat aliases
alias netstat-mac='netstat -anp udp tcp'
alias nltp='netstat -nltp | grep '
# Kubectl aliases
alias k='kubectl'
alias kctx='k ctx'
alias kns='k ns'
alias kl='kube-linter'
alias ing='kubectl get ingress -A | grep '
# Text browser
alias browsh='docker run --rm -it browsh/browsh'
# Find and notify
alias f='noti find'
# Docker compose
alias dcp='docker compose'
# vs code
alias c.='code .'
# ssc
alias ssc2ansible="awk \"{9print $2 \" \" \"ansible_host=\"$4 \" \" \"ansible_user=\"$6}\""
# Ansible
alias ap='ansible-playbook'
alias an='ansible'
# AI
alias ai='openai_pipe'
# Tools
alias tools='cd $MYGIT_DIR/tools'
# Clear DNS mac
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder'
# Brew
alias bi='brew install'
alias bs='brew search'
alias bin='brew info'
alias bis='brew install --cask'
# Shred
alias madshred='shred -n $(($RANDOM % 79 + 21))'
# sudo
alias s='sudo -i'
# tmux
alias tm='tmux at -t 0 || tmux'
# pip
alias pip=pip3
# Functions
pc1() {
if [ -z "$1" ]; then
echo "Please enter a domain or IP address"
return 1
fi
# check if http or https is in the input
if [[ $1 == *"http"* ]]; then
ip_addr=$(echo $1 | cut -d '/' -f3)
else
ip_addr=$1
fi
ping -c1 $ip_addr
}
tel() {
# if -z $1 or $1 != *":"*
if [ -z "$1" ] || [[ $1 != *":"* ]]; then
echo "Please enter a url and port like this https://127.0.0.1:6443"
echo "Or just enter the IP address and port like this 127.0.0.1:6443"
return 1
fi
if [[ $1 == *"http"* ]]; then
ip_addr=$(echo $1 | cut -d '/' -f3 | cut -d ':' -f1)
port=$(echo $1 | cut -d '/' -f3 | cut -d ':' -f2)
else
ip_addr=$(echo $1 | cut -d ':' -f1)
port=$(echo $1 | cut -d ':' -f2)
fi
telnet $ip_addr $port
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment