pip install torch --index-url https://download.pytorch.org/whl/cpu
GTest TYPED Test
#include <gtest/gtest.h>
template< typename Type >
class MyTestFixture : public ::testing::Test
{};
TYPED_TEST_SUITE_P( MyTestFixture );
TYPED_TEST_P( MyTestFixture, Case1 )
{
TypeParam ...;
...
}
TYPED_TEST_P( MyTestFixture, Case2 )
{
TypeParam ...;
...
}
REGISTER_TYPED_TEST_SUITE_P( MyTestFixture, Case1, Case2 );
typedef ::testing::Types< ClassA, ClassB > TestTypes;
INSTANTIATE_TYPED_TEST_SUITE_P( MyTest, MyTestFixture, TestTypes);
Use boost r-tree to find the nearest point
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/index/rtree.hpp>
using PointType = boost::geometry::model::point<float,3,boost::geometry::cs::cartesian>;
// Build the r-tree
boost::geometry::index::rtree< PointType,boost::geometry::index::quadratic<16> > rtree;
for(...) {
rtree.insert( PointType( x, y, z ) );
}
// Find the nearest point
PointType roiPoint( x, y, z );
std::vector< PointType > nearestPoints;
rtree.query( boost::geometry::index::nearest( roiPoint, 1 ), std::back_inserter( nearestPoints ) );
const auto nearest = nearestPoints[0];
std::cout << nearest.get<0>() << ", "<< nearest.get<1>() << ", " << nearest.get<2>() << std::endl;
Check installation path of a package using rpm
rpm -ql <package>
Check package version using rpm
rpm -qa *intel*
rpm -qa | sort | grep intel
Batch process all files in a folder
#!/bin/bash
for file in <path>/*; do
dcm2pnm "$file" "$file".png --write-png
done
Count the number of files in a directory
ls -l | wc -l
wc: word count
Check Linux OS version
cat /etc/os-release
Search installed packages using rpm
rpm -qa --last | grep <something>
Check where python packages are installed in a docker
Usually here:
/usr/local/lib/<python version>/site-packages
Or
pip show request <package name>