Skip to content

Instantly share code, notes, and snippets.

@ochebotar
Last active July 26, 2020 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ochebotar/636e04d57aa8b9fccd0c954efb7c845d to your computer and use it in GitHub Desktop.
Save ochebotar/636e04d57aa8b9fccd0c954efb7c845d to your computer and use it in GitHub Desktop.
.zshrc configuration file
# Path to your oh-my-zsh installation.
export ZSH="/Users/[USER-NAME]/.oh-my-zsh"
# Global path
PATH="$PATH:$M2_HOME/bin"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="ys"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
HIST_STAMPS="dd/mm/yyyy"
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# Visual Code integration
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
# Python Server
alias pserver='python2 -m SimpleHTTPServer 8000'
# Chrome Development Environment (no web security)
alias chromedev='open -a Brave\ Browser --args --disable-web-security --user-data-dir=""'
alias wget='/usr/local/Cellar/wget/1.19.1_1/bin/wget'
export PATH=$PATH:$M2_HOME/bin
# Flutter
export PATH="$PATH:`pwd`/flutter/bin"
# MySql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqldump='/usr/local/mysql/bin/mysqldump'
# Tomcat Aliases
alias tomstart='/Library/Tomcat/bin/startup.sh'
alias tomstop='/Library/Tomcat/bin/shutdown.sh'
export M2_HOME=/Users/[USER-NAME]/maven
# Maintenance
alias htop='/usr/local/Cellar/htop/2.0.2/bin/htop'
alias disk='/usr/local/Cellar/ncdu/1.14.1/bin/ncdu'
# Git Aliases
alias g="git"
alias gs="git status"
alias gl="git log"
alias grh="git reset --hard"
alias gcmm="git checkout --"
alias gsm="git stash && git co master && git stash pop"
alias gsd="git stash && git co development"
alias gmd="git merge development"
alias gmm="git merge master"
alias gupdate="git co development && git pull"
alias glatest="git co development && git pull"
alias gmupdate="git co master && git pull"
alias gcm="gmupdate"
alias gphm="git push heroku master"
# Tree
export "PATH=/usr/local/opt/tree/bin:$PATH"
# -------------------------------------------------------------------
# Functions ported directly from .bashrc
# -------------------------------------------------------------------
# OpenConnect VPN
function oconnect() {
sudo /usr/local/opt/openconnect/bin/openconnect [OPENCONNECT-SERVER] -u [USER-NAME]
}
# turn hidden files on/off in Finder
function hiddenOn() { defaults write com.apple.Finder AppleShowAllFiles YES ; }
function hiddenOff() { defaults write com.apple.Finder AppleShowAllFiles NO ; }
# postgres functions
function psqlstart() { /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start ; }
function psqlstop() { /usr/local/pgsql/bin/pg_ctl stop ; }
# view man pages in Preview
function pman() { ps=`mktemp -t manpageXXXX`.ps ; man -t $@ > "$ps" ; open "$ps" ; }
# apache tomcat functions
# function tomcatup() { /usr/local/tomcat/bin/startup.sh ; }
# function tomcatdown() { /usr/local/tomcat/bin/shutdown.sh ; }
# nice mount (http://catonmat.net/blog/another-ten-one-liners-from-commandlingfu-explained)
# displays mounted drive information in a nicely formatted manner
function nicemount() { (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2="";1') | column -t ; }
# check the PID on spesific PORT
function portpid() {
lsof -i tcp:$1
}
# myIP address
function myip() {
ifconfig en9 | grep 'inet ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}'
}
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
# Java Home
export JAVA_HOME=$(/usr/libexec/java_home)
# Apache Maven
alias mvn='/Users/[USER-NAME]/maven/bin/mvn'
# Metasploit
PATH=$PATH:/opt/metasploit-framework/bin
export PATH=$PATH:/opt/metasploit-framework/bin
alias msf='/opt/metasploit-framework/bin/msfconsole'
# Node Version Manager
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment