Skip to content

Instantly share code, notes, and snippets.

View virtuosonic's full-sized avatar
🎯
Focusing

virtuosonic

🎯
Focusing
View GitHub Profile
connect(discoveryAgent,
static_cast<void(QBluetoothDeviceDiscoveryAgent::*)(QBluetoothDeviceDiscoveryAgent::Error)>(&QBluetoothDeviceDiscoveryAgent::error),
this, &BlufiDeviceScanner::handleError);
connect(source, &Source::Mysignal,destination,&Destination::slot);
@virtuosonic
virtuosonic / CMakelists.txt
Created April 1, 2025 17:25
enable Qt MOC
cmake_minimum_required(VERSION 3.30)
project(bleservice)
set(CMAKE_AUTOMOC ON)
@virtuosonic
virtuosonic / win11local.bat
Created March 31, 2025 20:04
install windows 11 with local account
REM open cmd with SHIFT+F10
start ms-cxh:localonly
@virtuosonic
virtuosonic / chkaddrinfo.cpp
Last active February 19, 2025 00:08
chkaddrinfo.cpp
#include "ws2tcpip.h"
int main() {
addrinfo hints = {}, *res;
hints.ai_family = AF_INET;
int status = getaddrinfo("test.mosquitto.org", nullptr, &hints, &res);
if (status != 0) {
std::cerr << "getaddrinfo failed: " << gai_strerror(status) << std::endl;
} else {
#!/bin/sh
#Author: Gabriel Espinoza<virtuosonic at github>
#Desc: execute comand until it runs successfully(returning 0)
#Date: 23-Oct-2024
usage()
{
echo "usage: retryfailed <command> [arg1 [arg2...]]"
}
@virtuosonic
virtuosonic / mutex_test.cpp
Last active July 24, 2024 06:04
how slow is a mutex lock
/***************************************
Author: Gabriel Espinoza
Desc: They say lock-based concurrency is slow
let's test how slow is slow
***************************************/
#include <iostream>
#include <mutex>
#include <functional>
#include <chrono>
#include <iostream>
using namespace std;
struct S {
S() {cout << "S::S() " << id << "\n";}
S(const S&) {cout << "S::S(const S&) " << id << "\n";}
S(S&&) {cout << "S::S(const S&&) " << id << "\n";}
S& operator=(const S& other) { cout << "S::operator=(const S& other) " << id << "\n";return *this;}
@virtuosonic
virtuosonic / links_to.sh
Last active December 26, 2023 19:55
prints what libraries are linked to executables on $testdir
#include <iostream>
#include <algorithm>
#include <array>
class User {
protected:
static int* data;
static int* auxData1;
static int* auxData2;
int tamannoAD1;