Skip to content

Instantly share code, notes, and snippets.

View StefanoLusardi's full-sized avatar
👋
doing some things

Stefano Lusardi StefanoLusardi

👋
doing some things
View GitHub Profile
@StefanoLusardi
StefanoLusardi / rabbitmq_client.cpp
Created January 21, 2025 23:36
RabbitMQ Client
#include "rabbitmq_client.hpp"
#include <uvw.hpp>
#include <iostream>
RabbitMQClient::RabbitMQClient(const std::string& host, int port, const std::string& user, const std::string& password)
: _host(host), _port(port), _user(user), _password(password), _loop(uvw::Loop::getDefault()) {
_tcp = _loop->resource<uvw::TCPHandle>();
}
RabbitMQClient::~RabbitMQClient() {
git submodule add https://github.com/TeiaCare/venvpp.git scripts &&
git submodule init &&
git submodule update &&
git add .gitmodules scripts &&
git commit -m "Added venvpp scripts as git submodule"
@StefanoLusardi
StefanoLusardi / onnx_resnet.cpp
Last active December 31, 2024 08:39
ONNX Classifier (Resnet18 / Squeezenet)
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb_image_resize2.h"
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <iostream>
#include <vector>
@StefanoLusardi
StefanoLusardi / create_yolo.py
Last active December 31, 2024 08:38
ONNX Yolo v8
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.export(format="onnx", opset=12, simplify=True, dynamic=False, imgsz=640)
@StefanoLusardi
StefanoLusardi / build_valgrind.sh
Created August 4, 2024 15:55
Script to build and install Valgrind 3.20 from source, with example of suppressions file.
#!/bin/bash
cd ~/Downloads
sudo apt remove --purge valgrind -y
wget https://sourceware.org/pub/valgrind/valgrind-3.20.0.tar.bz2
tar xvf valgrind-3.20.0.tar.bz2
export CC=gcc-12
@StefanoLusardi
StefanoLusardi / cmake.bat
Created November 1, 2023 21:02
Windows C++ / CMake build
:: Execute only one of the following scripts:
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\vsdevcmd.bat" -arch amd64 -host_arch amd64
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
set CC=clang
set CXX=clang++
cmake -D CMAKE_BUILD_TYPE=Debug -G Ninja -B build/clang -S .
cmake --build build/clang
set CC=clang-cl
@StefanoLusardi
StefanoLusardi / print_docker_images_by_size.sh
Created October 20, 2023 06:50
Print Docker images sorted by size
docker image ls --format "{{.Size}} {{.ID}} {{.Repository}}:{{.Tag}}" | LANG=en_US sort -h | column -t
@StefanoLusardi
StefanoLusardi / git_config.sh
Created April 10, 2023 19:27
git config username / mail
# For global git settings:
git config --global user.name "YOUR_NAME"
git config --global user.email "YOUR_EMAIL"
# For a single repo only:
git config --local user.name "YOUR_NAME"
git config --local user.email "YOUR_EMAIL"
@StefanoLusardi
StefanoLusardi / Dockerfile.conan
Last active April 13, 2022 20:05
Dockerfile example for setup C++/CMake/Conan toolchain
FROM ubuntu:20.04
# Setup Build tools
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends \
make cmake ninja-build gcc-10 g++-10 \
python3 python3-pip
ENV CC=gcc-10
ENV CXX=gcc-10