get rotation angle between two vectors

Getting the angle between two vectors is well known. But finding the ‘rotation angle’ from one vector to another needs a bit more consideration. The following functions can handle this. This function will use cross product between two vectors to identify if the rotation direction is CW or CCW. This Read more…

visual code python debugging configuration

creating the launch.json file is explained well in official docs. However what I really wanted to know was how to configure it to make it run debugging on a file from a specific directory path. For example, I have a workspace structure like this. And t1.py file imports utils.py like Read more…

adding pip config file in virtualenv

after creating a virtualenv, one can setup pip.conf file right inside the created virtualenv directory. Here’s an example An example of pip.conf that I use commonly is shown below. The “index-url” may not be necessary since it is the default value, but in case it is overwritten by the system Read more…

apply proxy settings to python requests

you can apply proxy settings to python requests like this:

python

instlal PyYAML in python file, load file like the following the data in yaml file will be saved in data variable as a python dict.

python encode string to percent encoded(urlencode) format

reference: https://www.urlencoder.io/python/

matplotlib draw heatmap figure with colorbar

here is the sample code for drawing a single axis in a figure. The above is the result. I have tried to create several subplots and add heatmap to each one with individual colorbars on its side, but it seems this is hard to implement.

None index in python list?

while looking through some deep learning implementation code, I found some strange list indexing in python code. Here is an example. It was using None as an index when indexing a python object. First I thought is this indexing None on a python list and tested it. But it gave Read more…

various properties of cairo text_extent

when using cairo with python, the text_extent function call is powerful because it returns coordinate information of the text the user wants to print. However, the information depends on the Context which will be used when calling this function and this context may have different properties. Effected by order of Read more…

python operator precedence

https://docs.python.org/3/reference/expressions.html#operator-precedence