python -m pytest --co -q | grep "::" | awk -F'::' '{print $1}' | uniq -c
Make git colourful
git config --global core.pager cat
A solution to “git” not working
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
How to check “gperftools” version based on “tcmalloc” library?
strings <path>/libtcmalloc.so | grep -i "gperftools"
or
grep -ao "gperftools [0-9.]*" <path>/libtcmalloc.so
-a: forces it to read the binary as text.-o: tells it to only print the matching version string instead of dumping a massive wall of corrupted binary text into your terminal.
How to check the root cause of the difference between “pytest” and “python -m pytest”?
| Command | Uses which Python? | Risk |
|---|---|---|
pytest | Whatever executable is first in PATH | May run wrong environment |
python -m pytest | The Python you explicitly called | Much safer |
cat $(which pytest)
The shebang line can show which “python” that pytest uses.
python -c "import sys; print(sys.executable)"
or
which python
This shows the interpreter you’re explicitly invoking.
Null response caused by an extra space
<URL>/<Stage>/<Resource>
For example, <Resource> is supposed to be "find-or-create-game-session". But if "find-or-create-game-session "(an extra space in the end), "<URL>/<Stage>/find-or-create-game-session " will be invalid.
This happened in Unreal Engine (5.4.4), DA_GameSessionsAPIData->Resources, incorporated with AWS GameLift.

Use getrusage() to check memory usage
To check the memory usage of a C++ program on POSIX-compliant systems (like Linux, macOS, BSD) using getrusage, you can access the ru_maxrss field of the rusage structure. This field provides the maximum resident set size (maximum amount of physical RAM used) in KB.
#include <sys/resource.h>
#include <iostream>
struct rusage usage;
if( getrusage(RUSAGE_SELF, &usage) == 0 ) {
std::cout << usage.ru_maxrss / 1024 << " MB" << std::endl;
}
unittest setUp vs. pytest setup_class
unittest:
import unittest
class MyTest( unittest.TestCase ):
def setUp( self ):
self.variable = ...
pytest:
import pytest
class MyTest:
@classmethod
def setup_class( cls ):
cls.variable = ...
Install pytorch cpu only
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);