Skip to content

Instantly share code, notes, and snippets.

@irizwaririz
Last active March 28, 2022 20:05
Show Gist options
  • Save irizwaririz/ad64b4aabead1f6f66915bd8ef3d6bd2 to your computer and use it in GitHub Desktop.
Save irizwaririz/ad64b4aabead1f6f66915bd8ef3d6bd2 to your computer and use it in GitHub Desktop.
.bashrc setup for: conda, ssh-agent, Xserver, fzf
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/jcroberto/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/jcroberto/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/jcroberto/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/jcroberto/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# >>> ssh-agent initialize >>>
SSH_ENV="$HOME/.ssh/agent-environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
# <<< ssh-agent initialize <<<
# Xserver
export DISPLAY=localhost:0.0
# Better fuzzy searching with fzf
# export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'
@irizwaririz
Copy link
Author

Maybe we can use echo to append this at the end of the current system's .bashrc. Like so:

echo "...." >> ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment