Skip to content
Snippets Groups Projects
Commit 8869f118 authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Remove dotfiles

parent 1b38cb1b
Branches
No related tags found
No related merge requests found
# Add this lines at the top of .bashrc:
#[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Path to the bash it configuration
export BASH_IT="/home/andres/.bash_it"
# Lock and Load a custom theme file.
# Leave empty to disable theming.
# location /.bash_it/themes/
export BASH_IT_THEME='bira'
# (Advanced): Change this to the name of your remote repo if you
# cloned bash-it with a remote other than origin such as `bash-it`.
# export BASH_IT_REMOTE='bash-it'
# (Advanced): Change this to the name of the main development branch if
# you renamed it or if it was changed for some reason
# export BASH_IT_DEVELOPMENT_BRANCH='master'
# Your place for hosting Git repos. I use this for private repos.
export GIT_HOSTING='git@git.domain.com'
# Don't check mail when opening terminal.
unset MAILCHECK
# Change this to your console based IRC client of choice.
export IRC_CLIENT='irssi'
# Set this to the command you use for todo.txt-cli
export TODO="t"
# Set this to false to turn off version control status checking within the prompt for all themes
export SCM_CHECK=true
# Set to actual location of gitstatus directory if installed
#export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"
# per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must
#export GITSTATUS_NUM_THREADS=8
# Set Xterm/screen/Tmux title with only a short hostname.
# Uncomment this (or set SHORT_HOSTNAME to something else),
# Will otherwise fall back on $HOSTNAME.
#export SHORT_HOSTNAME=$(hostname -s)
# Set Xterm/screen/Tmux title with only a short username.
# Uncomment this (or set SHORT_USER to something else),
# Will otherwise fall back on $USER.
#export SHORT_USER=${USER:0:8}
# If your theme use command duration, uncomment this to
# enable display of last command duration.
#export BASH_IT_COMMAND_DURATION=true
# You can choose the minimum time in seconds before
# command duration is displayed.
#export COMMAND_DURATION_MIN_SECONDS=1
# Set Xterm/screen/Tmux title with shortened command and directory.
# Uncomment this to set.
#export SHORT_TERM_LINE=true
# Set vcprompt executable path for scm advance info in prompt (demula theme)
# https://github.com/djl/vcprompt
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
# (Advanced): Uncomment this to make Bash-it reload itself automatically
# after enabling or disabling aliases, plugins, and completions.
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
# Uncomment this to make Bash-it create alias reload.
# export BASH_IT_RELOAD_LEGACY=1
# Load Bash It
source "$BASH_IT"/bash_it.sh
export PATH=~/apps/:$PATH
export PATH=~/apps/xela_server:$PATH
export PATH=~/.local/bin:$PATH
source ~/srcs/development_environment/dotfiles/ros.bash
source ~/srcs/development_environment/dotfiles/git.bash
#source ~/srcs/development_environment/dotfiles/docker.bash
#ssh-add ~/.ssh/id_rsa_shared_aws
#clear
#[[ ${BLE_VERSION-} ]] && ble-attach
eval "$(direnv hook bash)"
# Alternative to ble.sh
bind 'set show-all-if-ambiguous on'
bind 'TAB:menu-complete'
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[user]
name = Andres Montano
email = andres.montano@tecnalia.com
[credential]
helper = "!f() { /home/andres/.vscode-server/bin/5235c6bb189b60b01b1f49062f4ffa42384f8c91/node /tmp/vscode-remote-containers-78443714273f4c2fa7b1c4e372d61a2d1eaf9a0b.js $*; }; f"
This diff is collapsed.
#zmodload zsh/zprof
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/apps:$PATH
export PATH=$HOME/apps/xela_server:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
source ~/apps/antigen.zsh
antigen use oh-my-zsh
antigen theme romkatv/powerlevel10k
antigen bundle docker
antigen bundle git
antigen bundle globalias
antigen bundle last-working-dir
antigen bundle sudo
antigen bundle zsh-users/zsh-history-substring-search
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle wfxr/forgit
antigen bundle paulirish/git-open
antigen bundle popstas/zsh-command-time
antigen bundle MichaelAquilina/zsh-auto-notify
antigen bundle MichaelAquilina/zsh-you-should-use
antigen bundle zsh-users/zsh-autosuggestions
antigen apply
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0'
# *********************
# command-line fuzzy finder
# *********************
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore-vcs'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" ."
# *********************
# zsh cache compdump
# *********************
# Create a cache folder if it isn't exists
if [ ! -d "$HOME/.cache/zsh" ]; then
mkdir -p $HOME/.cache/zsh
fi
# Define a custom file for compdump
export ZSH_COMPDUMP="$HOME/.cache/zsh/zcompdump-$HOST-$ZSH_VERSION"
# *********************
# User configuration
# *********************
# Use code as default editor
export EDITOR="code -r"
source $HOME/.init_shell
# Include dotfiles
source "$HOME/.homesick/repos/dotfiles/home/system.sh"
source "$HOME/.homesick/repos/dotfiles/home/git.sh"
source "$HOME/.homesick/repos/dotfiles/home/docker.sh"
source "$HOME/.homesick/repos/dotfiles/home/ros.sh"
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
#zprof
# docker common commands
export dockerfiles_path=~/srcs/development_environment/dockerfiles;
alias dim="docker images"
alias dpsa="docker ps -a"
alias dps="docker ps"
alias drm="docker rm"
alias drmi="docker rmi"
alias dsp="docker system prune --all"
alias dimp="docker image prune"
# Auto determine shell extension
if [ -z $SHELL ]; then
echo "${RED}SHELL not set${NC}"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
# Build a docker image
function dockbuild(){
current_dir=$(pwd)
if [ $# -lt 1 ]; then
echo "${BLUE}Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "ROS_DISTRO: Ros distribution. e.g. melodic, noetic, humble, etc."
echo "build_args:"
echo " --shell: shell to use in the container. e.g. bash or zsh"
echo "Whiout build_args, default shell: ${ext}${NC}"
return 1
fi
ros_distro=$1
shell=${ext}
shell_path="/usr/bin/zsh"
cd $dockerfiles_path;
if [[ $# -gt 1 ]]; then
key=$2
if [[ $key = "--shell" ]]; then
shell=$3
if [[ "${shell}" == "zsh" ]]; then
shell_path="/usr/bin/zsh"
elif [[ "${shell}" == "bash" ]]; then
shell_path="/bin/bash"
else
echo "${RED}SHELL: ${shell} not supported${NC}"
cd $current_dir
return 1
fi
else
echo "${RED}build_args: ${key} not supported${NC}"
return 1
fi
fi
echo "${GREEN}Building image for ${ros_distro} with ${shell} as shell${NC}"
docker build -t devenv:${ros_distro} --build-arg ROS_DISTRO=${ros_distro} --build-arg EXT_SHELL=${shell} --build-arg SHELL=${shell_path} -f devenv.Dockerfile .
cd $current_dir
}
# Run container with rocker
# To share docker --volume /var/run/docker.sock:/var/run/docker.sock:ro
# To share video (usb-cam) --volume /dev/video0:/dev/video0
# To share pcan --volume /dev/pcanusb32:/dev/pcanusb32
# To share dev folder --volume /dev:/dev
function dockrun() {
current_dir=$(pwd)
if [ $# -lt 1 ]; then
echo "${BLUE}Usage: dockrun <ROS_DISTRO> [options]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "Options:"
echo " --ws: path to workspace. e.g. odin_ws"
echo " --share: resource to share with the container, e.g. video, pcan or dev"
echo " --shell: shell to use in the container. By default zsh"
echo " --parse: parse_args to use in the container, e.g. --oyr-spacenav. By default none"
echo "Examples:"
echo "dockrun humble --ws mairon_ws"
echo "dockrun noetic --ws neurondones_ws --share pcan"
echo "dockrun melodic --ws odinrobot_ws --share video --shell bash${NC}"
return 1
fi
container_name="$1"
docker_shell=${ext}
workspace="${HOME}/ros/${container_name}"
resource_to_share=""
parse_args=""
while [[ $# -gt 1 ]]; do
key="$2"
case $key in
--ws)
workspace="${HOME}/ros/${container_name}/$3"
shift
shift
;;
--shell)
docker_shell="$3"
shift
shift
;;
--share)
resource=$3
if [[ "${resource}" == "video" ]]; then
resource_to_share="--volume /dev/video0:/dev/video0"
elif [[ "${resource}" == "pcan" ]]; then
resource_to_share="--volume /dev/pcanusb32:/dev/pcanusb32"
elif [[ "${resource}" == "dev" ]]; then
resource_to_share="--volume /dev:/dev"
fi
shift
shift
;;
--parse)
parse_args="$3"
shift
shift
;;
*) # Unknown option
echo "Unknown option: $2"
return 1
;;
esac
done
export ROS_WORKSPACE=${workspace}
echo "${BLUE}Container name: ${container_name}"
echo "Workspace: ${workspace}"
echo "Shell: ${docker_shell}"
echo "Resource to share: ${resource_to_share}"
echo "Parse args: ${parse_args}${NC}"
# Check if the image exist
if [[ "$(docker images -q devenv:$container_name 2> /dev/null)" == "" ]]; then
# build the image
echo "${GREEN}Docker image for ${container_name} does not exist. Building...${NC}"
echo "${YELLOW}dockbuild ${container_name} ${docker_shell}${NC}"
if dockbuild ${container_name} --shell ${docker_shell}; then
echo "${GREEN}Docker image for ${container_name} successfully built.${NC}"
else
echo "${RED}Docker image for ${container_name} failed to build.${NC}"
return 1
fi
fi
cd $workspace
# Check if the container exist
if [[ $(docker ps -aq -f name=$container_name) ]]; then
echo "${YELLOW}Container ${container_name} already running. Attach console to container.${NC}"
# Attach to container
docker exec -it ${container_name} bash -c "cd ${workspace} && ${docker_shell}"
else
echo "${GREEN}Container ${container_name} not running. Launching...${NC}"
# Launch container
rocker_command="rocker --home --ssh --git --user --privileged --nvidia ${resource_to_share} ${parse_args} --x11 --network host --name ${container_name} devenv:${container_name} ${docker_shell}"
echo "${YELLOW}${rocker_command}${NC}"
$(echo "$rocker_command")
fi
cd $current_dir
}
function dockexec() {
current_dir=$(pwd)
if [ $# -lt 1 ]; then
echo "${BLUE}Usage: dockexec <ROS_DISTRO> [options]"
echo "ROS_DISTRO: Ros distribution. e.g. melodic, noetic, humble, etc."
echo "options: "
echo " --ws: path to workspace. e.g. odin_ws"
echo " --shell: shell to use in the container. e.g. bash or zsh"
echo "Example:"
echo "dockexec noetic --ws neurondones_ws --shell bash${NC}"
return 1
fi
container_name="$1"
workspace="${HOME}/ros/${container_name}"
docker_shell=${ext}
while [[ $# -gt 1 ]]; do
key="$2"
case $key in
--ws)
workspace="${HOME}/ros/${container_name}/$3"
shift
shift
;;
--shell)
docker_shell="$3"
shift
shift
;;
*) # Unknown option
echo "Unknown option: $2"
return 1
;;
esac
done
cd ${workspace}
# Check if the container exist
if [[ $(docker ps -aq -f name=${container_name}) ]]; then
echo "${YELLOW}Container ${container_name} already running. Attach console to container.${NC}"
echo "${BLUE}workspace: ${workspace}"
echo "shell: ${docker_shell}${NC}"
# Attach to container
echo "${GREEN}docker exec -it ${container_name} ${docker_shell}${NC}"
docker exec -it ${container_name} ${docker_shell} -c "sc"
else
# Launch container
echo "${RED}Container ${1} does not exist${NC}"
cd $current_dir
return 1
fi
cd $current_dir
}
# Remove all stoped containers
function drma() {
drm $(docker ps -a -f status=exited -q)
}
# Remove all unused or dangling immages
function drmui(){
drmi $(dim --filter "dangling=true" -q --no-trunc)
}
# Stop and remove
function dsr() {
docker stop $1;
docker rm $1
}
# function runpythonsyntax(){
# rocker --home --name python_syntax tecnalia-docker-dev.artifact.tecnalia.com/docker:git
# }
# git aliases
alias gg="git log --oneline --decorate --graph --all"
[/]
cursor-shape='ibeam'
font='Hack Nerd Font Mono 12'
scrollback-unlimited=true
use-system-font=false
visible-name='default'
###################################################################
# ROS aliases and functions
###################################################################
if [[ "${ROS_DISTRO}" == "noetic" || "${ROS_DISTRO}" == "melodic" ]]; then
export ROS_VERSION=1
else
export ROS_VERSION=2
fi
# Enable colcon tools
if [[ "${ROS_VERSION}" -eq 2 ]]; then
# Quick directory change
if [[ -f "/usr/share/colcon_cd/function/colcon_cd.sh" ]]; then
source /usr/share/colcon_cd/function/colcon_cd.sh
fi
# Completion
if [[ -f "/usr/share/colcon_argcomplete/hook/colcon-argcomplete.${ext}" ]]; then
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.${ext}
fi
fi
# Source rosmon
function sourcerosmon(){
if [[ "${ROS_VERSION}" -eq 1 ]]; then
if [[ -f "/opt/ros/${ROS_DISTRO}/etc/catkin/profile.d/50-rosmon.${ext}" ]]; then
source /opt/ros/${ROS_DISTRO}/etc/catkin/profile.d/50-rosmon.${ext}
else
echo "rosmon not found."
fi
fi
}
# cd to the root of the workspace
function roshome(){
cd ${ROS_HOME}
}
# Source the current workspace
function sourcews(){
current_dir=$(pwd)
cropped=${PWD#${HOME}/ros/${ROS_DISTRO}/}
ws_name=${cropped%%/*}
ws_path=${HOME}/ros/${ROS_DISTRO}/${ws_name}
if [[ "${ROS_VERSION}" -eq 1 ]]
then
FILE=${ws_path}/devel/setup.${ext}
else
FILE=${ws_path}/install/setup.${ext}
fi
# if PWD belongs to ROS workspace then source it
if [[ -f $FILE ]]; then
cd ${ws_path}
echo "${GREEN}Sourcing workspace: ${FILE}${NC}"
source $FILE && sourcerosmon
cd ${current_dir}
export ROS_HOME=${ws_path}
else
echo "${RED}Workspace not found: ${FILE}${NC}"
export ROS_HOME=/opt/ros/${ROS_DISTRO}
fi
}
# Source the current workspace
function sourceros(){
source /opt/ros/${ROS_DISTRO}/setup.${ext}
# In ROS 1 source rosmon
if [[ "${ROS_VERSION}" -eq 1 ]]
then
sourcerosmon
fi
}
# Automatic catkin build
function cb() {
pwd_cb=$(pwd)
if [[ "${ROS_VERSION}" -eq 1 ]]
then
roshome
catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@"
else
colcon build --parallel-workers 6 "$@"
fi
sourcews
cd ${pwd_cb}
}
# Clean workspace (delete the generated folders, then catkin build)
function cbclean(){
if [[ "${ROS_VERSION}" -eq 1 ]]
then
roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
else
rm -rf build log install && cb "$@"
fi
}
# Initialize catkin workspace, configure and build it
function cib(){
catkin init && catkin config --extend /opt/ros/${ROS_DISTRO} && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
}
# Run ci locally
function runci(){
# check if exist .rosinstall file
if [ -f ./.rosinstall ]; then
echo ".rosinstall in package"
find ../ -name run_ci -exec bash {} ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" UPSTREAM_WORKSPACE=.rosinstall \;
else
echo "No .rosinstall in package"
find ../ -name run_ci -exec bash {} ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" \;
fi
}
alias sc=sourcews
# Check if ROS_DISTRO is set.
if [[ -z "${ROS_DISTRO}" ]]; then
ROS_DIR=/opt/ros
if [ -d "${ROS_DIR}" ];
then
export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1))
#echo "ROS_DISTRO set to ${ROS_DISTRO}"
else
unset ROS_DISTRO
#echo "${YELLOW}ROS is not installed.${NC}"
fi
else
sourcews
fi
\ No newline at end of file
# Define color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Override globalalias config
# space expands all aliases, including global
bindkey -M emacs "^ " globalias
bindkey -M viins "^ " globalias
# control-space to make a normal space
bindkey -M emacs " " magic-space
bindkey -M viins " " magic-space
# normal space during searches
bindkey -M isearch " " magic-space
# Determine shell extension
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
# lsd
if command -v lsd &> /dev/null
then
# Directories
alias ll='lsd -lh --group-dirs=first'
alias la='lsd -a --group-dirs=first'
alias l='lsd --group-dirs=first'
alias lla='lsd -lha --group-dirs=first'
alias ls='lsd --group-dirs=first'
else
alias ll='ls -lh'
alias la='ls -a'
alias l='ls'
alias lla='ls -lha'
alias ls='ls'
fi
# bat ==> cat
if command -v bat &> /dev/null
then
# Files
alias cat='bat'
fi
# Python
if command -v ipython &> /dev/null
then
alias ipy='ipython'
fi
# Tecnalia T
alias mountT='sudo mount -t cifs //tri.lan/tri /mnt/T --verbose -o vers=3.0,username=110343,password=Bageera\#1983,workgroup=TRI.LAN'
# Remove all stoped containers
function pagegui() {
project_name="$1"
python3 ~/apps/page/page.py $project_name
}
\ No newline at end of file
[global_config]
window_state = maximise
borderless = True
tab_position = hidden
title_hide_sizetext = True
title_use_system_font = False
title_font = Hack NF Bold 12
[keybindings]
[profiles]
[[default]]
cursor_shape = ibeam
cursor_color = "#aaaaaa"
font = Hack Nerd Font Mono 12
show_titlebar = False
scrollbar_position = hidden
scrollback_infinite = True
custom_command = byobu
use_system_font = False
copy_on_selection = True
[layouts]
[[default]]
[[[window0]]]
type = Window
parent = ""
[[[child1]]]
type = Terminal
parent = window0
[plugins]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment