Skip to content

Instantly share code, notes, and snippets.

@bramton
bramton / threads.cxx
Last active January 24, 2024 15:08
C++ threads with lambda expression
#include <iostream>
#include <thread>
#include <vector>
#include <unistd.h> // For sleep()
using namespace std;
void blaat(unsigned int t) {
cout << "Received param: " << t << endl;
}
@bramton
bramton / calc_metrics.py
Last active October 8, 2021 19:48
Point Transformer metrics
import pickle
import numpy as np
nClasses = 13
with open("preds.pkl", "rb") as f:
true, pred = pickle.load(f)
# Overall accuracy
oa = np.sum(np.count_nonzero(true == pred))/true.size
@bramton
bramton / butter.cxx
Last active March 1, 2021 08:59
Butterworth bandpass filter biquad coefficients
#define _USE_MATH_DEFINES
#include <cmath>
#include <complex>
#include <iostream>
#include <vector>
using namespace std;
// Based on the excellent article from Neil Robertson