Skip to content

Instantly share code, notes, and snippets.

@genomics-geek
Last active November 8, 2017 21:40
Show Gist options
  • Save genomics-geek/d3e85f67af14ba5e7bd197a60f7ddf4c to your computer and use it in GitHub Desktop.
Save genomics-geek/d3e85f67af14ba5e7bd197a60f7ddf4c to your computer and use it in GitHub Desktop.

Revisions

  1. genomics-geek renamed this gist Feb 13, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. genomics-geek revised this gist Feb 11, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions .bash_rc
    Original file line number Diff line number Diff line change
    @@ -106,6 +106,8 @@ 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
    # ---------------------------------------
  3. genomics-geek created this gist Feb 11, 2017.
    6 changes: 6 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # .bash_profile


    # Load specific settings
    # --------------------------------------
    source $HOME/.bashrc
    162 changes: 162 additions & 0 deletions .bash_rc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,162 @@
    # .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


    # 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 [email protected]'
    alias ssh_nexus='ssh [email protected]'
    alias ssh_nexus_staging='ssh [email protected]'
    alias ssh_airflow='ssh [email protected]'
    alias ssh_airflow_staging='ssh [email protected]'


    # 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
    8 changes: 8 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # 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