├── .github └── stale.yml ├── README.md ├── connectSSH.sh ├── copyFile.sh ├── install-CUDNN.sh ├── install-Conda.sh ├── install-ROS-Kinetic.sh ├── install-Software.sh ├── jpg_to_mp4.sh ├── mp4.sh ├── opencv.sh ├── ptp.sh └── record.sh /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Useful GitHub commands 2 | 3 | ### Install Git 4 | `sudo apt-get install git` 5 | 6 | ### Add existing project to Github 7 | 1. Create repository on GitHub without initializing with README file. 8 | 9 | 2. navigate to the directory and initialize: `git init` 10 | 11 | 3. Add the files in local repository and stages them for commit: `git add .` 12 | 13 | 4. commit the files: `git commit -m "First commit"` 14 | 15 | 5. add the URL: `git remote add origin https://github.com/username/myproject.git` 16 | 17 | 6. verify the new URL: `git remote -v` 18 | 19 | 7. push changes: `git push origin master` 20 | 21 | ### Push to repositoray after making changes 22 | 23 | 1. Add the files in local repository and stages them for commit: `git add .` 24 | 25 | 2. commit the files: `git commit -m "current commit"` 26 | 27 | 3. push changes: `git push origin master` 28 | 29 | ### Pull new changes from remote 30 | 31 | 1. `git pull` is a convenient shortcut for completing both `git fetch` and `git merge` in the same command 32 | 33 | If you run into a merge conflict you cannot resolve, or if you decide to quit the merge, you can use `git merge --abort` to take the branch back to where it was in before you pulled. 34 | 35 | 2. Force to overwrite local files: 36 | 37 | `git fetch --all` 38 | 39 | `git reset --hard origin/master` 40 | 41 | `git pull origin master` 42 | 43 | ### Set Username 44 | 45 | 1. set Git username for every repository on your computer: 46 | 47 | `git config --global user.name "YourUserName"` 48 | 49 | Setting your Git username for a single repository: 50 | 51 | `git config user.name "YourUserName"` 52 | 53 | check username: 54 | 55 | `git config user.name` 56 | 57 | 2. set your email address for every repository on your computer 58 | 59 | `git config --global user.email "your@email.com"` 60 | 61 | Setting your email address for a single repository: 62 | 63 | `git config user.email "your@email.com"` 64 | 65 | check email address: 66 | 67 | `git config user.email` 68 | 69 | ### Set Password 70 | 71 | Turn on the credential helper so that Git will save your password in memory for some time. By default, Git will cache your password for 15 minutes. 72 | 73 | 1. Set git to use the credential memory cache: 74 | 75 | `git config --global credential.helper cache` 76 | 77 | 2. Set the cache to timeout after 1 hour (setting is in seconds): 78 | 79 | `git config --global credential.helper 'cache --timeout=3600'` 80 | 81 | ### Delete Commits 82 | 83 | Reset the head to the number of commits back by 2 for example: 84 | 85 | `git reset --hard HEAD~2` 86 | 87 | and force pushed using: 88 | 89 | `git push -f origin master` 90 | 91 | ### Other commands 92 | 93 | 1. Delete file or folder: 94 | 95 | `git rm -r file-name.txt or folder` then `git commit -m "Remove file or folder"` 96 | 97 | 2. Check status: 98 | 99 | `git status` 100 | 101 | 3. Update combo: 102 | 103 | `git add * && git commit -m "something" && git push origin master` 104 | 105 | 3. [Many other commands](https://github.com/joshnh/Git-Commands) 106 | -------------------------------------------------------------------------------- /connectSSH.sh: -------------------------------------------------------------------------------- 1 | sshpass -p 'clearpath' ssh -o StrictHostKeyChecking=no administrator@192.168.0.100 2 | -------------------------------------------------------------------------------- /copyFile.sh: -------------------------------------------------------------------------------- 1 | red=`tput setaf 1` 2 | green=`tput setaf 2` 3 | reset=`tput sgr0` 4 | echo "${red}Beginning to copy files ...${reset}" 5 | 6 | sshpass -p "clearpath" scp -r /home/tixiao/catkin_ws/src/traversability_mapping administrator@192.168.1.189:~/catkin_ws/src 7 | echo "${green}traversability_mapping done!${reset}" 8 | 9 | sshpass -p "clearpath" scp -r /home/tixiao/catkin_ws/src/lidar_odometry administrator@192.168.1.189:~/catkin_ws/src 10 | echo "${green}lidar_odometry done!${reset}" 11 | -------------------------------------------------------------------------------- /install-CUDNN.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ######################################################### 4 | # Download 5 | # https://developer.nvidia.com/rdp/cudnn-download 6 | 7 | # Install - Section 2.3.2 8 | # https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html 9 | 10 | # ! add the following lines to your bashrc file 11 | # export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} 12 | # export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH 13 | -------------------------------------------------------------------------------- /install-Conda.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | red=`tput setaf 1` 3 | green=`tput setaf 2` 4 | reset=`tput sgr0` 5 | echo "${green}Begin to install Conda${reset}" 6 | 7 | echo "${green}Download conda${reset}" 8 | wget -O ~/Downloads/conda.sh "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" 9 | 10 | echo "${green}Intall conda${reset}" 11 | chmod +x ~/Downloads/conda.sh 12 | . ~/Downloads/conda.sh 13 | 14 | echo "${green}Configure conda${reset}" 15 | echo ". ~/miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc -------------------------------------------------------------------------------- /install-ROS-Kinetic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Install Robot Operating System (ROS) for new OS 3 | red=`tput setaf 1` 4 | green=`tput setaf 2` 5 | reset=`tput sgr0` 6 | echo "${green}Begin to install ...${reset}" 7 | 8 | ######################################################### 9 | # ROS Kinetic 10 | echo "${green}Begin to install ROS Kinetic...${reset}" 11 | sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' 12 | sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 13 | sudo apt-get update 14 | sudo apt-get install -y ros-kinetic-desktop-full 15 | # Initialize rosdep 16 | sudo rosdep init 17 | rosdep update 18 | # Environment Setup 19 | echo "\n" >> ~/.bashrc 20 | echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc 21 | echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc 22 | . ~/.bashrc 23 | # python 24 | sudo apt-get install -y python-rosinstall python-rosinstall-generator python-wstool build-essential 25 | 26 | ######################################################### 27 | # ros package 28 | echo "${green}install ROS packages${reset}" 29 | sudo apt-get install -y ros-kinetic-jackal-* 30 | sudo apt-get install -y ros-kinetic-velodyne-* 31 | sudo apt-get install -y ros-kinetic-navigation 32 | sudo apt-get install -y ros-kinetic-robot-localization 33 | sudo apt-get install -y ros-kinetic-microstrain-mips 34 | sudo apt-get install -y ros-kinetic-nmea-navsat-driver 35 | sudo apt-get install -y ros-kinetic-image-exposure-msgs 36 | sudo apt-get install -y ros-kinetic-wfov-camera-msgs 37 | sudo apt-get install -y libignition-math2-dev # for velodyne gazebo plugin 38 | 39 | ######################################################### 40 | # ros ip setup 41 | echo "${green}ROS ip setup${reset}" 42 | echo "\n" >> ~/.bashrc 43 | echo "export ROS_MASTER_URI=http://localhost:11311" >> ~/.bashrc 44 | echo "export ROS_HOSTNAME=localhost" >> ~/.bashrc 45 | echo "\n" >> ~/.bashrc 46 | 47 | ######################################################## 48 | # Edit ros kill timeout 49 | # sudo gedit /opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py 50 | -------------------------------------------------------------------------------- /install-Software.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | red=`tput setaf 1` 3 | green=`tput setaf 2` 4 | reset=`tput sgr0` 5 | echo "${green}Begin to install ...${reset}" 6 | 7 | sudo adduser $USER dialout 8 | sleep 3 9 | 10 | ######################################################### 11 | # Adjust system time 12 | sudo apt-get update 13 | sudo apt-get install -y ntp 14 | timedatectl 15 | 16 | ######################################################### 17 | # install ssh server 18 | echo "${green}install SSH server${reset}" 19 | sudo apt-get install -y openssh-server 20 | sudo apt-get install -y sshpass 21 | 22 | ######################################################### 23 | # Network Time Protocol 24 | echo "${green}Time Protocol${reset}" 25 | sudo apt-get install -y chrony 26 | sudo ntpdate ntp.ubuntu.com 27 | 28 | ######################################################### 29 | echo "${green}Intall Softwares${reset}" 30 | sudo apt-get install -y synaptic 31 | sudo apt-get install -y gdebi 32 | sudo apt-get install -y gimp 33 | sudo apt-get install -y ksnapshot 34 | sudo apt-get install -y gparted 35 | sudo apt-get install -y psensor 36 | sudo apt-get install -y lm-sensors 37 | sudo apt-get install -y exfat-fuse 38 | sudo apt-get install -y exfat-utils 39 | sudo apt-get install -y terminator 40 | sudo apt-get install -y ffmpeg 41 | sudo apt-get install -y unrar 42 | sudo apt-get install -y net-tools 43 | sudo apt-get install -y ethtool 44 | 45 | ######################################################### 46 | echo "${green}Install Softwares ${reset}" 47 | cd ~/Downloads/ 48 | wget -O ~/Downloads/dropbox.deb "https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2015.10.28_amd64.deb" 49 | sudo gdebi dropbox.deb 50 | wget -O ~/Downloads/chrome.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" 51 | sudo gdebi chrome.deb 52 | wget -O ~/Downloads/sublime.deb "https://download.sublimetext.com/sublime-text_build-3176_amd64.deb" 53 | sudo gdebi sublime.deb 54 | 55 | ######################################################### 56 | # echo "${green}Install Eigen ${reset}" 57 | # wget -O ~/Downloads/eigen.deb "http://ftp.br.debian.org/debian/pool/main/e/eigen3/libeigen3-dev_3.3.7-1_all.deb" 58 | # cd ~/Downloads && sudo gdebi eigen.deb 59 | 60 | ######################################################### 61 | echo "${green}Install gtsam ${reset}" 62 | wget -O ~/Downloads/gtsam.zip https://github.com/borglab/gtsam/archive/4.0.2.zip 63 | cd ~/Downloads/ && unzip gtsam.zip -d ~/Downloads/ 64 | cd ~/Downloads/gtsam-4.0.2/ 65 | mkdir build && cd build 66 | cmake -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF .. 67 | sudo make install -j8 68 | 69 | ######################################################### 70 | echo "${green}Install Ceres ${reset}" 71 | sudo apt-get install -y libgoogle-glog-dev 72 | sudo apt-get install -y libatlas-base-dev 73 | wget -O ~/Downloads/ceres.zip https://github.com/ceres-solver/ceres-solver/archive/1.14.0.zip 74 | cd ~/Downloads/ && unzip ceres.zip -d ~/Downloads/ 75 | cd ~/Downloads/ceres-solver-1.14.0 76 | mkdir ceres-bin && cd ceres-bin 77 | cmake .. 78 | sudo make install -j8 79 | 80 | ######################################################### 81 | echo "${green}Install Texworks and TexLive ...${reset}" 82 | sudo apt-get -y install texstudio 83 | sudo apt-get -y install texlive-full 84 | 85 | 86 | ######################################################### 87 | ######################################################### 88 | #sgbteam 89 | #Single User License 90 | #EA7E-1153259 91 | #8891CBB9 F1513E4F 1A3405C1 A865D53F 92 | #115F202E 7B91AB2D 0D2A40ED 352B269B 93 | #76E84F0B CD69BFC7 59F2DFEF E267328F 94 | #215652A3 E88F9D8F 4C38E3BA 5B2DAAE4 95 | #969624E7 DC9CD4D5 717FB40C 1B9738CF 96 | #20B3C4F1 E917B5B3 87C38D9C ACCE7DD8 97 | #5F7EF854 86B9743C FADC04AA FB0DA5C0 98 | #F913BE58 42FEA319 F954EFDD AE881E0B 99 | # https://www.cnblogs.com/xinglejun/p/10682847.html 100 | 101 | # Just go to Preferences -> Settings-User and add there: "update_check": false, 102 | 103 | ######################################################## 104 | # mount drive start up 105 | # sudo blkid 106 | # sudo gedit /etc/fstab 107 | # UUID=CA009B90009B825D /media/ntfs ntfs rw,nosuid,nodev,noatime,allow_other 0 0 108 | 109 | ######################################################### 110 | # echo "${green}Install libpointmatcher ${reset}" 111 | # cd ~/Downloads/ 112 | # git clone https://github.com/ethz-asl/libnabo.git 113 | # cd ~/Downloads/libnabo && mkdir build && cd build 114 | # cmake .. 115 | # make -j8 116 | # sudo make install 117 | # cd ~/Downloads/ 118 | # git clone https://github.com/ANYbotics/libpointmatcher.git 119 | # cd ~/Downloads/libpointmatcher && mkdir build && cd build 120 | # cmake .. 121 | # make -j8 122 | # sudo make install 123 | 124 | -------------------------------------------------------------------------------- /jpg_to_mp4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | frameRate="60" 3 | jpgName="image_%03d.jpeg" 4 | mp4Name="output.mp4" 5 | 6 | ffmpeg -r ${frameRate} \ 7 | -i ${jpgName} \ 8 | -vcodec libx264 \ 9 | -crf 20 \ 10 | -pix_fmt yuv420p \ 11 | -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" \ 12 | ${mp4Name} 13 | -------------------------------------------------------------------------------- /mp4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ffmpeg -i input.ogv \ 3 | -c:v libx264 -preset medium -crf 22 \ 4 | -c:a libmp3lame -qscale:a 2 -ac 2 -ar 44100 \ 5 | -pix_fmt yuv420p \ 6 | output.mp4 7 | 8 | # convert batch 9 | # for i in /path/to/*.ogv; 10 | # do name=`echo "$i" | cut -d'.' -f1` 11 | # echo "$name" 12 | # ffmpeg -i "$i" "${name}.mp4" \ 13 | # -c:v libx264 -pix_fmt yuv420p -preset medium -crf 22 14 | # done 15 | -------------------------------------------------------------------------------- /opencv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # script to install opencv with opencv_contrib 3 | # replace "3.2.0" with the version you want 4 | 5 | rm -rf ~/Downloads/opencv-3.2.0 6 | rm -rf ~/Downloads/opencv_contrib-3.2.0 7 | 8 | wget -O ~/Downloads/opencv.zip https://github.com/opencv/opencv/archive/3.2.0.zip 9 | wget -O ~/Downloads/opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.2.0.zip 10 | cd ~/Downloads/ && unzip opencv.zip -d ~/Downloads/ 11 | cd ~/Downloads/ && unzip opencv_contrib.zip -d ~/Downloads/ 12 | 13 | cd ~/Downloads/opencv-3.2.0 && rm -rf build 14 | mkdir build && cd build 15 | 16 | cd ~/Downloads/opencv-3.2.0/build 17 | 18 | cmake -D CMAKE_BUILD_TYPE=RELEASE \ 19 | -D CMAKE_INSTALL_PREFIX=/usr/local \ 20 | -D INSTALL_C_EXAMPLES=ON \ 21 | -D INSTALL_PYTHON_EXAMPLES=ON \ 22 | -D OPENCV_EXTRA_MODULES_PATH=~/Downloads/opencv_contrib-3.2.0/modules \ 23 | -D ENABLE_PRECOMPILED_HEADERS=OFF \ 24 | -D BUILD_EXAMPLES=ON .. \ 25 | -D OPENCV_ENABLE_NONFREE=ON .. 26 | 27 | sudo make install -j8 -------------------------------------------------------------------------------- /ptp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # https://bit.ly/3ovCNb5 3 | 4 | # run "ifconfig" to get ethernet/wan port name on your own computer 5 | ETHERNET_NAME="eno1" 6 | 7 | # install ptpd 8 | sudo apt install ptpd 9 | 10 | # enable master time (add -C to see log) 11 | sudo ptpd -M -i $ETHERNET_NAME 12 | 13 | # add startup script (ubuntu 16.04 and before) 14 | # add "ptpd -g -i eno1" to file "/etc/rc.local" 15 | 16 | # add startup script (ubuntu 18.04 and later) 17 | touch ptpd_service.sh 18 | echo "#!/bin/sh" >> ptpd_service.sh 19 | echo "ptpd -g -i $ETHERNET_NAME" >> ptpd_service.sh 20 | echo "exit 0" >> ptpd_service.sh 21 | sudo chmod 755 ptpd_service.sh 22 | sudo mv ptpd_service.sh /etc/init.d/ 23 | cd /etc/init.d/ 24 | sudo update-rc.d ptpd_service.sh defualts 90 25 | -------------------------------------------------------------------------------- /record.sh: -------------------------------------------------------------------------------- 1 | cd ~/Downloads 2 | folder=$(date +%Y%m%d_%H%M%S) 3 | mkdir $folder && cd $folder 4 | rosbag record --split --duration=1m /points_raw /imu_raw /camera/image_raw 5 | --------------------------------------------------------------------------------