Skip to content

Instantly share code, notes, and snippets.

View hdh7485's full-sized avatar

한동희 hdh7485

  • Seoul, Korea
View GitHub Profile
@hdh7485
hdh7485 / terminal-colors-branch.sh
Created August 18, 2021 13:54 — forked from danielalvarenga/terminal-colors-branch.sh
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
@hdh7485
hdh7485 / capture_video.py
Created August 15, 2021 16:00
Extract images from videos that saved in same directory.
import cv2
import math
import os
video_files = next(os.walk('./'), (None, None, []))[2]
for video in video_files:
print(video)
cap = cv2.VideoCapture(video)
frameRate = cap.get(5) #frame rate
@hdh7485
hdh7485 / tx2 18.04 sources.list
Created April 28, 2021 08:24
tx2 18.04 sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted
@hdh7485
hdh7485 / px4_bashrc
Created April 28, 2021 06:52
bashrc setup for px4 sitl simulation
export PX4_PATH=~/git_repo/PX4-Autopilot
export FLYING_CAR_PATH=~/flyingcar_ws/src
source $PX4_PATH/Tools/setup_gazebo.bash $PX4_PATH $PX4_PATH/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$PX4_PATH
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$PX4_PATH/Tools/sitl_gazebo
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$FLYING_CAR_PATH
@hdh7485
hdh7485 / .vimrc
Last active July 7, 2021 12:33
To install vundle: $git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim and $vim +PluginInstall +qall
" To install vundle:
" $git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" $vim +PluginInstall +qall
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@hdh7485
hdh7485 / cmd_vel_to_ackermann_drive.py
Created May 19, 2020 07:43
Convert twist message to ackermann message.
#!/usr/bin/env python
# Author: christoph.roesmann@tu-dortmund.de
# Modifier: Donghee Han, hdh7485@kaist.ac.kr
import rospy, math
from geometry_msgs.msg import Twist
from ackermann_msgs.msg import AckermannDriveStamped
from ackermann_msgs.msg import AckermannDrive
// CAN Send Example
//
#include <mcp_can.h>
#include <SPI.h>
long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
char msgString[128]; // Array to store serial string
@hdh7485
hdh7485 / load_jpeg_with_tensorflow.py
Created July 10, 2017 16:41 — forked from eerwitt/load_jpeg_with_tensorflow.py
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed