Skip to content

Instantly share code, notes, and snippets.

@heethesh
Last active September 15, 2020 07:59
Bash RC Extensions
# Terminal logs
test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f $HOME/.terminal_logs/$(date +"%d-%b-%y_%H-%M-%S")_terminal.log)
# Same pwd new terminal tab
# Save current working dir
PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
# Change to saved working dir
[[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"
# CUDA
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda-10.1
export PATH="/usr/local/cuda-10.1/bin:$PATH"
export CUDA_INC_DIR=/usr/local/cuda-10.1/include
export C_INCLUDE_PATH=${CUDA_HOME}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${CUDA_HOME}/lib64:$LIBRARY_PATH
export CPATH=$CPATH:/usr/local/cuda-10.1/include
# Custom aliases (use bash aliases)
# alias python=python3
# alias pip=pip3
# Bazel
export PATH="$PATH:$HOME/bin"
source /home/heethesh/.bazel/bin/bazel-complete.bash
# Clang formatter
alias cfmt='clang-format -i -style="{BasedOnStyle: WebKit, TabWidth: 4, Standard: Cpp11}"'
# ROS
source /opt/ros/kinetic/setup.bash
# Read Markdown using Lynx
rmd ()
{
pandoc $1 | lynx -stdin
}
# Python HTTP server at IP:8000/
pyserver ()
{
ip=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
echo "Server ready at http://$ip:8000/"
python -m http.server 8000
}
# DEB install
debinstall ()
{
sudo dpkg -i $1
sudo apt-get -f install
}
# WSL only
# Default permissions
umask 002
# LS colors
export LS_COLORS="$LS_COLORS:ow=01;30;42:tw=01;30;42:"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment