Skip to content

Instantly share code, notes, and snippets.

View roman-smirnov's full-sized avatar
🚀
Inverting Singularities

Roman Smirnov roman-smirnov

🚀
Inverting Singularities
View GitHub Profile
@roman-smirnov
roman-smirnov / ec2_add_swap.md
Created June 2, 2021 10:22
add swap to an ec2 ubuntu instance

block size must be smaller than physical ram size

sudo dd if=/dev/zero of=/swapfile bs=500M count=2
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
@roman-smirnov
roman-smirnov / .zshrc
Last active April 20, 2020 00:14
Adding colors and syntax highlighting to ZSH
# brew cask install anaconda
export PATH="/usr/local/anaconda3/bin:$PATH"
# chrome terminal command
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# terminal colors
PS1="%{%F{red}%}%n%{%f%}@%{%F{blue}%}%m %{%F{yellow}%}%~ %{%f%}%% "
export CLICOLOR=1
@roman-smirnov
roman-smirnov / av_course_materials.md
Last active January 22, 2020 22:04
AV Course Materials

Amit AV Course Materials

Base Input Image

road.jpg turn.jpg

Library Imports

import numpy as np
import matplotlib.pyplot as plt
@roman-smirnov
roman-smirnov / opencv_plot.cpp
Created January 14, 2020 18:44
how to plot a graph via OpenCV
#include <vector>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/plot.hpp>
int main() {
std::vector<double> x{0,1,2,3,4,5,6,7,8,9};
std::vector<double> y{0,-1,-3,-6,-7,-6,-5,-3,-1,0};
cv::Mat1d xData(x);
@roman-smirnov
roman-smirnov / README.md
Last active December 28, 2019 02:48
3D Tracking Project Multiple Plots

3D Tracking Project Multiple Plots

Put the code snippet below at the end of your Final_Project.cpp. Here's what it gets you: Screen Shot 2019-12-28 at 3 26 31

@roman-smirnov
roman-smirnov / cellscope.py
Created December 26, 2019 08:44
Limit code scope to current cell in Jupyter Notebook
from IPython.core.magic import register_cell_magic
@register_cell_magic
def cellscope(line, cell): exec(cell)
## Example (in a code cell):
# %%cellscope
# x = 'hello' # x is local to current code cell
@roman-smirnov
roman-smirnov / video_to_gif.py
Last active December 26, 2019 06:17
Python convert video clip to GIF example
from moviepy.editor import VideoFileClip
def test_video_to_gif():
clip = VideoFileClip('test_videos/solidWhiteRight.mp4').subclip(0,1)
clip.write_gif('test.gif', fps=24)
test_video_to_gif()
@roman-smirnov
roman-smirnov / CMakeLists.txt
Last active December 20, 2019 11:43
CMakeLists.txt Release build with compiler optimizations
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(3d-tracking-fusion)
set(CMAKE_CXX_STANDARD 14)
find_package(OpenCV 4.1 REQUIRED)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast")
@roman-smirnov
roman-smirnov / eigen_ransac.cpp
Last active December 15, 2022 17:24
Usage of Eigen library with PCL PointCloud (PCL uses Eigen::Matrix as its representation for point clouds under the hood )
template<typename PointT>
std::pair<typename pcl::PointCloud<PointT>::Ptr, typename pcl::PointCloud<PointT>::Ptr>
ProcessPointClouds<PointT>::SegmentPlane( typename pcl::PointCloud<PointT>::Ptr cloud, int maxIterations, float distanceThreshold) {
// Time segmentation process
auto startTime = std::chrono::steady_clock::now();
// downsample input point cloud
auto cloud_ds = DownSample(cloud, 1.0);
@roman-smirnov
roman-smirnov / vis_bbox_match_id.cpp
Last active January 23, 2020 05:55
visualize matching bounding boxes in matchBoundingBoxes()
void matchBoundingBoxes(std::vector<cv::DMatch> &matches,
std::map<int, int> &bbBestMatches,
DataFrame &prev_frame,
DataFrame &curr_frame) {
/* TODO: for each bbox in current frame, find the best matching bbox in previous frame */
/* ... */
/* Now visualize bounding box matches */