Skip to content

Instantly share code, notes, and snippets.

@pncnmnp
Created June 28, 2023 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pncnmnp/9afb554a52bf8b108a7a9caf06d22910 to your computer and use it in GitHub Desktop.
Save pncnmnp/9afb554a52bf8b108a7a9caf06d22910 to your computer and use it in GitHub Desktop.
# Auto-suggestion
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# Aliases
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias py="python3.10"
alias ptpy="python3.10 -m ptpython"
alias dfh="df -h"
alias parth="cd ~/parth/"
alias lectures="cd /Users/mitesh/parth/lectures"
alias stopwatch='time read' # Stopwatch, press ctrl^D to stop
alias pyf="cd /Users/mitesh/parth/code/py"
alias rustf="cd /Users/mitesh/parth/code/rust"
alias cdc="cd /Users/mitesh/parth/code/c"
alias texf="cd /Users/mitesh/parth/code/tex"
alias jsf="cd /Users/mitesh/parth/code/js"
alias codef="cd /Users/mitesh/parth/code/"
alias music="cd /Users/mitesh/parth/music"
alias p4='ping 8.8.8.8 -c 4' # Internet connection check
alias tex_exec='pdflatex main.tex && bibtex main.aux && pdflatex main.tex && pdflatex main.tex'
alias _tex_exec='pdflatex main.tex'
alias python='python3'
alias findme='grep -rni'
alias texf='cd /Users/mitesh/parth/code/tex/'
alias chrome='open -a "Google Chrome"'
alias weather='curl wttr.in'
alias gr='grammatical'
alias gr_markdown='grammatical -i "markdown" -o "markdown"'
alias spaceG='du -sh * | grep -E "\dG" | sort -snr -k 1,1'
alias spaceM='du -sh * | grep -E "\dM" | sort -snr -k 1,1'
alias zshrc='vim ~/.zshrc'
# Aliases for ls
alias ls='ls -Gp'
alias ll='ls -la'
# Aliases for grep
alias grep='grep --color=auto'
alias g='grep -rni $1 $2'
# Colors for ls
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
# weather
alias wttr="curl wttr.in?format=3\&m"
alias wordle="sh ~/wordle.sh"
# https://github.com/chubin/cheat.sh
# Cheat sheet for cmd line
function cheat() {
curl cht.sh/$1
}
# If you have a directory selected in Finder, this will tell you the path
function cdf () {
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'`
if [ "$target" != "" ]
then
cd "$target"
pwd
else
echo 'No Finder window found' >&2
fi
}
# The legendary auto extract function - based on the file extension
function extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvfJ $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "Unrecognized archive $1" ;;
esac
else
echo "$1 is not an extractable file"
fi
}
# Time with seconds and current working dir
PROMPT='[%*][%1d] '
# History
export HISTFILESIZE=20000
export HISTSIZE=10000
export SAVEHIST=10000
# Rust settings
. "$HOME/.cargo/env"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment