Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iMac/ MacBook setup dotfiles, etc
# .bash_profile
# Load specific settings
# --------------------------------------
source $HOME/.bashrc
# .bashrc
# Source global definitions
# ---------------------------------------
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
# Set architecture flags
# ---------------------------------------
export ARCHFLAGS="-arch x86_64"
# Set Default Editor
# ---------------------------------------
export EDITOR=/usr/bin/nano
# Set default blocksize for ls, df, du
# ---------------------------------------
export BLOCKSIZE=1k
# Make terminal better
# ---------------------------------------
alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
alias ls='ls'
alias la='ls -a'
alias ll='ls -aFGlAhp'
alias qfind='find . -name'
alias cleanupDS="find . -type f -name '*.DS_Store' -ls -delete"
# Find memory hogs
# ---------------------------------------
alias memHogsTop='top -l 1 -o rsize | head -20'
alias memHogsPs='ps wwaxm -o pid,stat,vsize,rss,time,command | head -10'
# Find CPU hogs
# ---------------------------------------
alias cpuHogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10'
# Networking
# ---------------------------------------
alias netCons='lsof -i'
alias flushDNS='dscacheutil -flushcache'
alias lsock='sudo /usr/sbin/lsof -i -P'
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP'
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP'
alias ipInfo0='ipconfig getpacket en0'
alias ipInfo1='ipconfig getpacket en1'
alias openPorts='sudo lsof -i | grep LISTEN'
alias showBlocked='sudo ipfw list'
# Kill all jobs for username
# ---------------------------------------
alias killalljobs='pkill -u $USER'
# ii: display useful host related informaton
# ---------------------------------------
ii() {
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Current network location :$NC " ; scselect
echo -e "\n${RED}Public facing IP Address :$NC " ;myip
#echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns
echo
}
# Set Path for PostgresSQL
# ---------------------------------------
POSTGRESQL=/Applications/Postgres.app/Contents/Versions/latest/bin
# Manage node versions
# ---------------------------------------
export NVM_DIR="$HOME/.nvm"
source $(brew --prefix nvm)/nvm.sh
# Set Java home
# ---------------------------------------
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
# Set Scala home
# ---------------------------------------
SCALA=/usr/local/bin/scala/bin
# Virtural environments
# ---------------------------------------
PYENV=$HOME/.pyenv/bin
PYENV_WRAPPER=$HOME/.pyenv/plugins/pyenv-virtualenv/bin
PLENV=$HOME/.plenv/bin
source $(brew --prefix autoenv)/activate.sh
# Set up Python
# ---------------------------------------
eval "$(pyenv init -)"
export PIP_REQUIRE_VIRTUALENV=true
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
gpip(){
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
test -f /usr/local/bin/virtualenvwrapper.sh && source /usr/local/bin/virtualenvwrapper.sh
if which pyenv > /dev/null ; then eval "$(pyenv init -)"; fi
# Setup Perl
# ---------------------------------------
eval "$(plenv init -)"
# Manage connections
# ---------------------------------------
alias ssh_thor='ssh gonzalezma@dgdrhr-01'
alias ssh_dgd='ssh gonzalezma@dgd'
alias ssh_chop_hdfs='ssh gonzalezma@mn0204.chop.edu'
alias ssh_nexus='ssh gonzalezma@nexus.chop.edu'
alias ssh_nexus_staging='ssh gonzalezma@nexus-staging.chop.edu'
alias ssh_airflow='ssh gonzalezma@airflow.chop.edu'
alias ssh_airflow_staging='ssh gonzalezma@airflow-staging.chop.edu'
# Manage databases
# ---------------------------------------
alias mysql_start='mysql.server start'
alias mysql_stop='mysql.server stop'
alias redis_start='redis-server /usr/local/etc/redis.conf'
alias redis_stop='redis-cli -h 127.0.0.1 -p 6379 shutdown'
alias mongodb_start='brew services start mongodb'
alias mongodb_stop='brew services stop mongodb'
# Set up Apache Spark
# ---------------------------------------
export PYSPARK_PYTHON=python3
export SPARK_HOME=$HOME/Resources/spark/latest
export PYTHONPATH=$SPARK_HOME/python/:$PYTHONPATH
alias pyspark='$SPARK_HOME/bin/pyspark'
alias spark-submit='$SPARK_HOME/bin/spark-submit'
# export PATH
# ---------------------------------------
PATH=$PATH:/usr/local/sbin:$HOME/bin:$PYENV:$PLENV:$POSTGRESQL:$SCALA
export PATH

Setups

This is to replicate environments across my machines.

Resources

  • Place all downloaded resources in $HOME/Resources
  • Manage versions by placing the latest version in the latest folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment