<commit_before>#!/bin/sh
# Colourful manpages
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

# Set to avoid `env` output from changing console colour
export LESS_TERMEND=$'\E[0m'

# Print field by number
field() {
  ruby -ane "puts \$F[$1]"
}

# Setup paths
remove_from_path() {
  [ -d "$1" ] || return
  # Doesn't work for first item in the PATH but I don't care.
    export PATH=${PATH//:$1/}
}

add_to_path_start() {
  [ -d "$1" ] || return
  remove_from_path "$1"
  export PATH="$1:$PATH"
}

add_to_path_end() {
  [ -d "$1" ] || return
  remove_from_path "$1"
  export PATH="$PATH:$1"
}

force_add_to_path_start() {
  remove_from_path "$1"
  export PATH="$1:$PATH"
}

quiet_which() {
  which "$1" &>/dev/null
}

add_to_path_end "$HOME/Library/Python/2.7/bin"
add_to_path_end "$HOME/Library/Python/3.6/bin"
add_to_path_start "/usr/local/bin"
add_to_path_start "/usr/local/sbin"

# Brew python
add_to_path_start "/usr/local/opt/python@2/libexec/bin"
add_to_path_start "/usr/local/lib/python2.7/site-packages"

# Run rbenv if it exists
# quiet_which rbenv && add_to_path_start "$(rbenv root)/shims"
rbenv() {
  eval "$(command rbenv init -)"
  rbenv "$@"
}

# Aliases
alias mkdir="mkdir -vp"
alias df="df -H"
alias rm="rm -iv"
alias mv="mv -iv"
alias zmv="noglob zmv -vW"
alias cp="cp -irv"
alias du="du -sh"
alias make="nice make"
alias less="less --ignore-case --raw-control-chars"
alias rsync="rsync -uav --partial --progress --human-readable --compress"
alias rake="noglob rake"
alias be="noglob bundle exec"
alias gist="gist --open --copy"
alias svn="svn-git.sh"
alias sha256="shasum -a 256"
alias ack="ag"
alias z="zeus"
alias zt="zeus test"
alias git="hub"
alias k='kubectl "--context=${KUBECTL_CONTEXT:-$(kubectl config current-context)}" ${KUBECTL_NAMESPACE/[[:alnum:]-]*/--namespace=${KUBECTL_NAMESPACE}}'
alias ktmux="tmux new-session -d 'watch kubectl get nodes -L fullType,type' && tmux split-window -h 'watch kubectl get pods --all-namespaces' && tmux split-window -v -t 1 && tmux -2 attach-session -d"
alias clear_dns_cache="dscacheutil -flushcache && sudo killall -HUP mDNSResponder"

# Platform-specific stuff
if quiet_which brew
then
  export BINTRAY_USER="$(git config bintray.username)"
  export HOMEBREW_PREFIX=$(brew --prefix)
  export BREW_REPO=$(brew --repo)
  export HOMEBREW_DEVELOPER=1
  export HOMEBREW_ANALYTICS=1
  export HOMEBREW_AUTO_UPDATE=1
  export HOMEBREW_FORCE_VENDOR_RUBY=1

  export HOMEBREW_CASK_OPTS="--appdir=/Applications"
  if [ "$USER" = "brewadmin" ]
  then
    export HOMEBREW_CASK_OPTS="$HOMEBREW_CASK_OPTS --binarydir=$HOMEBREW_PREFIX/bin"
  fi<commit_msg>Update refresh time<commit_after>#!/bin/sh
# Colourful manpages
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

# Set to avoid `env` output from changing console colour
export LESS_TERMEND=$'\E[0m'

# Print field by number
field() {
  ruby -ane "puts \$F[$1]"
}

# Setup paths
remove_from_path() {
  [ -d "$1" ] || return
  # Doesn't work for first item in the PATH but I don't care.
    export PATH=${PATH//:$1/}
}

add_to_path_start() {
  [ -d "$1" ] || return
  remove_from_path "$1"
  export PATH="$1:$PATH"
}

add_to_path_end() {
  [ -d "$1" ] || return
  remove_from_path "$1"
  export PATH="$PATH:$1"
}

force_add_to_path_start() {
  remove_from_path "$1"
  export PATH="$1:$PATH"
}

quiet_which() {
  which "$1" &>/dev/null
}

add_to_path_end "$HOME/Library/Python/2.7/bin"
add_to_path_end "$HOME/Library/Python/3.6/bin"
add_to_path_start "/usr/local/bin"
add_to_path_start "/usr/local/sbin"

# Brew python
add_to_path_start "/usr/local/opt/python@2/libexec/bin"
add_to_path_start "/usr/local/lib/python2.7/site-packages"

# Run rbenv if it exists
# quiet_which rbenv && add_to_path_start "$(rbenv root)/shims"
rbenv() {
  eval "$(command rbenv init -)"
  rbenv "$@"
}

# Aliases
alias mkdir="mkdir -vp"
alias df="df -H"
alias rm="rm -iv"
alias mv="mv -iv"
alias zmv="noglob zmv -vW"
alias cp="cp -irv"
alias du="du -sh"
alias make="nice make"
alias less="less --ignore-case --raw-control-chars"
alias rsync="rsync -uav --partial --progress --human-readable --compress"
alias rake="noglob rake"
alias be="noglob bundle exec"
alias gist="gist --open --copy"
alias svn="svn-git.sh"
alias sha256="shasum -a 256"
alias ack="ag"
alias z="zeus"
alias zt="zeus test"
alias git="hub"
alias k='kubectl "--context=${KUBECTL_CONTEXT:-$(kubectl config current-context)}" ${KUBECTL_NAMESPACE/[[:alnum:]-]*/--namespace=${KUBECTL_NAMESPACE}}'
alias ktmux="tmux new-session -d 'watch -n.5 kubectl get nodes -L fullType,type' && tmux split-window -h 'watch -n.5 kubectl get pods --all-namespaces' && tmux split-window -v -t 1 && tmux -2 attach-session -d"
alias clear_dns_cache="dscacheutil -flushcache && sudo killall -HUP mDNSResponder"

# Platform-specific stuff
if quiet_which brew
then
  export BINTRAY_USER="$(git config bintray.username)"
  export HOMEBREW_PREFIX=$(brew --prefix)
  export BREW_REPO=$(brew --repo)
  export HOMEBREW_DEVELOPER=1
  export HOMEBREW_ANALYTICS=1
  export HOMEBREW_AUTO_UPDATE=1
  export HOMEBREW_FORCE_VENDOR_RUBY=1

  export HOMEBREW_CASK_OPTS="--appdir=/Applications"
  if [ "$USER" = "brewadmin" ]
  then
    export HOMEBREW_CASK_OPTS="$HOMEBREW_CASK_OPTS --binarydir=$HOMEBREW_PREFIX/bin"
  fi
{'fraction_non_alphanumeric': 0.15967283072546232, 'fraction_numerical': 0.019203413940256046, 'mean_word_length': 4.781089414182939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '428112', 'n_tokens_mistral': 2405, 'n_tokens_neox': 2270, 'n_words': 501}