Skip to content

Instantly share code, notes, and snippets.

@hectorcorrea
Last active January 17, 2025 16:59
Show Gist options
  • Save hectorcorrea/fd56edea3333bec47829 to your computer and use it in GitHub Desktop.
Save hectorcorrea/fd56edea3333bec47829 to your computer and use it in GitHub Desktop.
My .bash_profile configuration
PS1="\w \$ "
alias ls='ls -G -la'
# Git aliases
alias st='git status'
alias br='git branch'
alias co='git checkout'
alias lg='git log'
alias df='git diff'
alias grlast='git reset HEAD~1'
alias be='bundle exec'
alias rr='bundle exec rails server'
alias notes='code ~/src/notes/notes.md'
alias pg='echo "Use: psql -h 127.0.0.1 -U postgres -d development_db -p 54509"'
alias aterm='java -jar ~/src/mediaflux/aterm.jar'
# Don't save duplicate entries in history
export HISTCONTROL=ignoreboth
# PostgreSQL May/2024
# The FLAGS variables are needed for gem install to find the PG libraries
export PATH="$PATH:/usr/local/opt/postgresql@15/bin"
export LDFLAGS="-L/usr/local/opt/postgresql@15/lib"
export CPPFLAGS="-I/usr/local/opt/postgresql@15/include"
export PKG_CONFIG_PATH="/usr/local/opt/postgresql@15/lib/pkgconfig"
# Created by `pipx` on 2022-03-22 19:21:09
export PATH="$PATH:/Users/correah/.local/bin"
# Version 12 was installed with Homebrew and it's the version that I use normally.
# Version 14 was installed by downloading the binaries from Node.js and I am using it for the Invenio workshop (6/6/2022)
# Version 16 is what I am using since 8/10/2022
#
# export PATH=$PATH:/usr/local/opt/node@12/bin
# export PATH=$PATH:/usr/local/opt/node@14/bin
export PATH=$PATH:/usr/local/opt/node@16/bin
# Give preference the Go I installed over the one installed
# by homebrew under /usr/local/bin/go
export PATH=/usr/local/go/bin:$PATH
# Stop Apple from telling me that zhs is the new hotness
# Source: https://www.saintlad.com/hide-default-interactive-shell-is-now-zsh-in-terminal-on-macos/
export BASH_SILENCE_DEPRECATION_WARNING=1
# To support CTRL+X + CTRL+E when editing long commands
# https://twitter.com/nixcraft/status/1387475672914747393
export EDITOR=vi
# ======================================================================================
source ~/.bash_profile_secrets
# ======================================================================================
# Ruby Version
source /usr/local/opt/chruby/share/chruby/chruby.sh
# chruby 2.6.6 - for Cicognara
# chruby 2.7.5
# chruby 3.0.3 # for PDC-Describe
# chruby 3.1.0 # for PDC-Describe
# chruby 3.1.3 # for Tiger Data
chruby 3.2.3 # for Tiger Data
# Changes the display of tab (and window) in the Terminal'
# http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/
# https://gist.github.com/hotwatermorning/711e37777d246f16762d
function tn {
printf "\e]1;${1:-bash}\a" # tab
printf "\e]2;${1:-bash}\a" # window
}
# bundle grep
function bgrep {
if [ -z "$1" ]; then
echo "usage: bgrep text-to-search"
return 1
fi
echo "Searching for $1"
grep -r $1 $(bundle list --paths) .
}
# Checks out a remote branch
function co-remote {
if [ -z "$1" ]; then
echo "usage: co-remote branch-name"
return 1
fi
echo "Checking out remote branch $1"
git checkout --track origin/$1
}
# Switches to the ruby version indicated in .tool-versions
function rv {
chruby `grep ruby .tool-versions | awk '{print $2}'`
ruby --version
}
# I thought I needed this to prevent GitHub from asking for my passphrase
# (https://stackoverflow.com/a/10032655/446681) but turns out editing the
# ssh/config file takes care of it https://stackoverflow.com/a/41576222/446681
#
# eval $(ssh-agent)
#
# This did not quite work so I removed the passphrase from my key.
# ---
# This was on my .bashrc and I moved here, but I don't think I
# really need it so I am commenting it out.
# # `pyenv` will switch automatically the version needed by Princeton Ansible
# # and offer to install a new version when it cannot find it locally.
# eval "$(pyenv virtualenv-init -)"
# The call to ssh-add is to prevent getting error with Capistrano:
# ```
# net-ssh requires the following gems for ed25519 support:
# * rbnacl (>= 3.2, < 5.0)
# * rbnacl-libsodium, if your system doesn't have libsodium installed.
# * bcrypt_pbkdf (>= 1.0, < 2.0)
# ```
ssh-add -q ~/.ssh/id_rsa
# Ta-da!
cd ~/src
" https://linuxhint.com/vimrc_tutorial/
syntax on
" If Nerdtree is installed
" https://github.com/preservim/nerdtree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment