sergem’s Personal public notebook

Learning Rust

Resources (books, tutorials, etc.) Easy Rust — a book about rust Many companies and people now learn Rust, and they could learn faster with a book that has easy English. This textbook is for these companies and people to learn Rust with simple English. The Rust Programming Language — “Rust book”. It’s a standard choice for those who want to start with Rust. A bit difficult to read sometimes....

June 21, 2021 · SergeM

IDE for Rust

I started to learn rust, and I needed to set up some IDE to handle my exercises. It seems that VScode has pretty good support for Rust. How to set up VS code to work with rust, including debugging. Install rust-analyzer extension and vscode-lldb extension: code --install-extension matklad.rust-analyzer code --install-extension vadimcn.vscode-lldb rust-analyzer provides a nice UI for running binaries and tests: Also it gives a lot of hints: Note that rust-analyzer doesn’t work together with Rust extension (Rust for Visual Studio Code)....

May 23, 2021 · SergeM

Notes on docker

Docker ARG vs ENV https://vsupalov.com/docker-arg-vs-env/ Running GUI apps in docker ROS GUI in docker: https://tuw-cpsg.github.io/tutorials/docker-ros/ ROS GUI with NVIDIA: https://github.com/dkarunakaran/rviz_docker, https://medium.com/intro-to-artificial-intelligence/rviz-on-docker-bdf4d0fca5b rocker A tool to run docker images with customized local support injected for things like nvidia support. And user id specific files for cleaner mounting file permissions. rocker on github Build arguments example Dockerfile: FROM busybox ARG user USER $user # ... A user builds this file by calling:...

April 25, 2021 · SergeM

Graph algorithms

Shortest path problem Dijkstra’s algorithm fixes a single node as the “source” node and finds shortest paths from the source to all other nodes in the graph, producing a shortest-path tree. Wiki Dijkstra’s algorithm Complexity analysis Wiki On stack overflow: Why does Dijkstra’s algorithm use decrease-key? Actually Implementing Dijkstra’s Algorithm - complexity analysis considering three components of the main loop: time per insert, extract_min, and change_priority operation: O(nT_ins + nT_min + m*T_change)...

February 14, 2021 · SergeM

Data Structures And Algorithms in Python

Data strucures Sources: https://wiki.python.org/moin/TimeComplexity https://www.ics.uci.edu/~pattis/ICS-33/lectures/complexitypython.txt n is the number of elements in the container. k is either the value of a parameter, or the number of elements in the parameter. list It is actually an array (implemented as an array). Operation Average Case Amortized Worst Case Note Copy O(n) O(n) Append O(1) O(1) If the array grows beyond the allocated space it must be copied....

January 29, 2021 · SergeM

Rounding in Python

In school we round numbers like 0.5, 1123.5 towards the bigger number. It’s a “round half up” method. That introduces an undesired bias some cases. For example if we have a large data set, and we aggregate some column containing a lot of .5 fractions. In order to adjust for it in many cases a rounding of 0.5 towards nearest even number is applied. It’s “Rounding half to even” or “banker’s rounding”....

January 10, 2021 · SergeM

Symbolic math and python

With the help of python and SymPy module one can do pretty neat computations. For example when I took a course about Robotic Preception on Coursera I had to find a cross product of two vectors v1 x v2 represented in a generic form: v1 = (a, b, c) v2 = (d, e, 0) Normally I would write it down on a piece of paper and do the computations myself....

December 31, 2020 · SergeM

Effect of techniques from Fast.ai

fast.ai is a brilliant library and a course by Jeremy Howard an co. They use pytorch as a base and explain deep learning from the foundations to a very decent level. In his course Jeremy Howard demonstrates a lot of interesting techniques that he finds in papers and that do NN training faster/better/cheaper. Here I want to reproduce some of the techniques in order to understand what is the effect they bring....

November 15, 2020 · SergeM

Point cloud processing

ROS nodes Point Cloud IO https://github.com/ANYbotics/point_cloud_io two nodes for reading and writing PointCloud2 from/to ply, pcd formats point_cloud_assembler from laser_assembler http://wiki.ros.org/laser_assembler This node assembles a stream of sensor_msgs/PointCloud2 messages into larger point clouds. The aggregated point cloud can be accessed via a call to assemble_scans service. https://github.com/ros-perception/laser_assembler Tutorial Octomap http://octomap.github.io/ Seems like a standard solution to convert point clouds to a map in several formats pointcloud_to_laserscan http://wiki.ros.org/pointcloud_to_laserscan pcl_ros http://wiki....

November 10, 2020 · SergeM

Python - Multiprocessing

Libraries Standard multiprocessing Pebble - pretty close to the standard one, but with a bit nicer interface Dask - well maintained and (almost) drop-in replacement of numpy and pandas: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # Arrays implement the Numpy API import dask.array as da x = da.random.random(size=(10000, 10000), chunks=(1000, 1000)) x + x....

October 1, 2020 · SergeM