This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://gist.github.com/TheCherno/31f135eea6ee729ab5f26a6908eb3a5e | |
// Usage: | |
// 1. Call init before doing anything else with this file/snippet. | |
// 2. Put `let _timer = Timer::new()` at the begining of any scope you want to measure (DO NOT name the variable `_`. Because it will be dropped instantly after creation.) | |
// 3. Drag result.json into chrome://tracing (If you have a chromium-based browser) or https://ui.perfetto.dev for visualization | |
static mut TIMER: Option<std::time::Instant> = None; | |
static mut OUT_STREAM: String = String::new(); | |
static mut NOT_FIRST: bool = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Best KNN algorithm implementation world has ever seen | |
''' | |
import math | |
def EuclideanDistance(a, b): # N dimention Euclidean distance implementation | |
s = 0 | |
for i in range(len(a)): | |
s += (a[i] - b[i]) ** 2 | |
# return math.sqrt(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <filesystem> | |
#include <imgui.h> | |
#define BIT(x) (1 << x) | |
std::pair<bool, uint32_t> DirectoryTreeViewRecursive(const std::filesystem::path& path, uint32_t* count, int* selection_mask) | |
{ | |
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth; | |
bool any_node_clicked = false; |