Difference between revisions of "EON bash profile"

From Tinkla: Tinkering with Tesla
m (Source Code)
Line 42: Line 42:
  
  
  <nowiki>
+
<nowiki>
export EDITOR='vim'
+
export EDITOR='vim'
export TERM='xterm-256color'
+
export TERM='xterm-256color'
export PS1="\u@\h:\[\e[36m\]\w\[\e[0m\]\$ "
+
export PS1="\u@\h:\[\e[36m\]\w\[\e[0m\]\$ "
export PREFIX='/usr'
+
export PREFIX='/usr'
export VALGRIND_LIB='/usr/lib/valgrind'
+
export VALGRIND_LIB='/usr/lib/valgrind'
  
# add these symlinks if you want
+
# add these symlinks if you want
export PYTHONPATH="/data/pythonpath"
+
export PYTHONPATH="/data/pythonpath"
export GIT_SSH_COMMAND="ssh -i /data/gitkey"
+
export GIT_SSH_COMMAND="ssh -i /data/gitkey"
  
function gcpa() {
+
function gcpa() {
    git update-index --assume-unchanged /data/openpilot/.gitignore
+
  git update-index --assume-unchanged /data/openpilot/.gitignore
    git update-index --assume-unchanged /data/openpilot/launch_chffrplus.sh
+
  git update-index --assume-unchanged /data/openpilot/launch_chffrplus.sh
    git update-index --assume-unchanged /data/openpilot/selfdrive/visiond/visiond
+
  git update-index --assume-unchanged /data/openpilot/selfdrive/visiond/visiond
    git commit -a -m "$1"
+
  git commit -a -m "$1"
    git push
+
  git push
}
+
}
  
function gcp() {
+
function gcp() {
    git commit -m "$1"
+
  git commit -m "$1"
    git push
+
  git push
}
+
}
  
function so() {
+
function so() {
  grep -rni --include=\*.{py,h,c} /data/openpilot/ -e "$1"
+
  grep -rni --color=auto --include=\*.{py,h,c} /data/openpilot/ -e "$1"
}
+
}
  
cd /data/openpilot/selfdrive/car/tesla
+
cd /data/openpilot/selfdrive/car/tesla
export PYTHONPATH="/data/openpilot/"
+
export PYTHONPATH="/data/openpilot/"
alias vic="vi /data/openpilot/selfdrive/car/tesla/carcontroller.py"
+
alias vic="vi /data/openpilot/selfdrive/car/tesla/carcontroller.py"
alias vis="vi /data/openpilot/selfdrive/car/tesla/carstate.py"
+
alias vis="vi /data/openpilot/selfdrive/car/tesla/carstate.py"
alias vii="vi /data/openpilot/selfdrive/car/tesla/interface.py"
+
alias vii="vi /data/openpilot/selfdrive/car/tesla/interface.py"
alias vit="vi /data/openpilot/selfdrive/car/tesla/teslacan.py"
+
alias vit="vi /data/openpilot/selfdrive/car/tesla/teslacan.py"
alias vio="vi /data/bb_openpilot.cfg"
+
alias vio="vi /data/bb_openpilot.cfg"
alias killop="tmux kill-session -t comma"
+
alias killop="tmux kill-session -t comma"
alias vips="vi /data/openpilot/panda/board/safety/safety_tesla.h"
+
alias vips="vi /data/openpilot/panda/board/safety/safety_tesla.h"
alias cdo="cd /data/openpilot"
+
alias cdo="cd /data/openpilot"
alias cdp="cd /data/openpilot/panda/board"
+
alias cdp="cd /data/openpilot/panda/board"
alias cdt="cd /data/openpilot/selfdrive/car/tesla"
+
alias cdt="cd /data/openpilot/selfdrive/car/tesla"
alias cdm="cd /data/openpilot/selfdrive/car/modules"
+
alias cdm="cd /data/openpilot/selfdrive/car/modules"
alias mrw="mount -o rw,remount /system"
+
alias mrw="mount -o rw,remount /system"
alias mro="mount -o ro,remount /system"
+
alias mro="mount -o ro,remount /system"
alias runop="/data/data/com.termux/files/continue.sh"
+
alias runop="/data/data/com.termux/files/continue.sh"
</nowiki>
+
</nowiki>

Revision as of 20:27, 4 September 2019

A set of shortcuts for bash on EON

Here is a set of shortcuts I used constantly on my EON, mainly when connected from the phone. Every time you will SSH it will take you automatically to /data/openpilot/car/tesla.

Some notable ones:

Commands

  • so "text to search" - Searches all source code for the text to search
  • gcp - a sequence of commands that allows you to commit and push the code to the repo
  • gcpa "my commit comment" - a sequence of commands that allows you to commit all changes and files and push to the repo
  • killop - kills OpenPilot tmux session
  • runop - runs OpenPilot in shell session; amazing for debug purposes
  • mrw - mounts file system in read/write mode
  • mro - mounts file system in read only mode

Edit Sessions

  • vic - vi carcontroller.py
  • vis - vi carstate.py
  • vii - vi interface.py
  • vit - vi teslacan.py
  • vips - vi safety_tesla.h

Change Directory

  • cdo - change directory to /data/openpilot
  • cdp - change directory to /data/openpilot/
  • cdt - change directory to /data/openpilot/car/tesla
  • cdm - change directory to /data/openpilot/car/modules

Source Code

To save this file on your EON in your home directory first you have to SSH into your EON and

cd ~

and then make it read write via

mount -o rw,remount /system

then create and edit the .bash_profile file and paste the content below in there.

Note that this will only work starting with your next login.


export EDITOR='vim'
export TERM='xterm-256color'
export PS1="\u@\h:\[\e[36m\]\w\[\e[0m\]\$ "
export PREFIX='/usr'
export VALGRIND_LIB='/usr/lib/valgrind'

# add these symlinks if you want
export PYTHONPATH="/data/pythonpath"
export GIT_SSH_COMMAND="ssh -i /data/gitkey"

function gcpa() {
   git update-index --assume-unchanged /data/openpilot/.gitignore
   git update-index --assume-unchanged /data/openpilot/launch_chffrplus.sh
   git update-index --assume-unchanged /data/openpilot/selfdrive/visiond/visiond
   git commit -a -m "$1"
   git push
}

function gcp() {
   git commit -m "$1"
   git push
}

function so() {
  grep -rni --color=auto --include=\*.{py,h,c} /data/openpilot/ -e "$1"
}

cd /data/openpilot/selfdrive/car/tesla
export PYTHONPATH="/data/openpilot/"
alias vic="vi /data/openpilot/selfdrive/car/tesla/carcontroller.py"
alias vis="vi /data/openpilot/selfdrive/car/tesla/carstate.py"
alias vii="vi /data/openpilot/selfdrive/car/tesla/interface.py"
alias vit="vi /data/openpilot/selfdrive/car/tesla/teslacan.py"
alias vio="vi /data/bb_openpilot.cfg"
alias killop="tmux kill-session -t comma"
alias vips="vi /data/openpilot/panda/board/safety/safety_tesla.h"
alias cdo="cd /data/openpilot"
alias cdp="cd /data/openpilot/panda/board"
alias cdt="cd /data/openpilot/selfdrive/car/tesla"
alias cdm="cd /data/openpilot/selfdrive/car/modules"
alias mrw="mount -o rw,remount /system"
alias mro="mount -o ro,remount /system"
alias runop="/data/data/com.termux/files/continue.sh"