Skip to content

Instantly share code, notes, and snippets.

View marty1885's full-sized avatar
πŸ‘¨β€πŸ’»
Writing code

Martin Chang marty1885

πŸ‘¨β€πŸ’»
Writing code
View GitHub Profile
@marty1885
marty1885 / patch.patch
Created August 31, 2025 00:39
patches to get Tenstorren's Tracy forck running on Arch Linux as of 2025-Aug-31
diff --git a/dtl/Diff.hpp b/dtl/Diff.hpp
index 8c9c774f..57067f9f 100644
--- a/dtl/Diff.hpp
+++ b/dtl/Diff.hpp
@@ -164,7 +164,7 @@ namespace dtl {
return trivial;
}
- void enableTrivial () const {
+ void enableTrivial () {
@marty1885
marty1885 / chunking-regex.ts
Created August 15, 2024 03:32
Use regex to do chunking by using all semantic cues
// Used in https://jina.ai/tokenizer (Aug. 14th version)
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 6;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100;
const MAX_LIST_ITEM_LENGTH = 200;
const MAX_NESTED_LIST_ITEMS = 5;
const MAX_LIST_INDENT_SPACES = 7;
const MAX_BLOCKQUOTE_LINE_LENGTH = 200;
#include <chrono>
#include <iostream>
#include <vector>
#include <random>
#include <cstring>
#include <array>
#include <cblas.h>
#include <rknn_matmul_api.h>
#include <string>
#include <vector>
#include <functional>
#include <iostream>
#include <optional>
#include <cassert>
#include <unordered_set>
#include <cppcoro/generator.hpp>
#include <cppcoro/task.hpp>
#include <cppcoro/sync_wait.hpp>
#include <cxxabi.h>
#include <iostream>
void demangle_name(const std::string& mangled_name)
{
std::size_t len = 0;
int status = 0;
auto name = __cxxabiv1::__cxa_demangle(mangled_name.c_str(), nullptr, &len, &status);
if (status == 0)
{
#include <cstddef>
#include <functional>
#include <memory>
#include <utility>
#include <stdexcept>
#include <iostream>
template <typename>
struct shared_function{};
import gym
from etaler import et
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def running_mean(x, N):
cumsum = np.cumsum(np.insert(x, 0, 0))
return (cumsum[N:] - cumsum[:-N]) / float(N)
@marty1885
marty1885 / crypto.cpp
Created March 15, 2021 00:07
Cryptographic (password hashing) library for Drogon
#include "crypto.hpp"
#include <regex>
#include <bsd/stdlib.h>
#include <botan/argon2.h>
#include <botan/system_rng.h>
static Botan::System_RNG rng;
uint32_t secureRandom(uint32_t lower, uint32_t upper)
#include <drogon/drogon.h>
#include <exception>
#include <coroutine>
#include <stdexcept>
using namespace drogon;
int main()
{
app().createDbClient("postgresql", "localhost", 5432, "test", "test", "some legit password 191561", 16)
==> Making package: root 6.22.06-1 (Mon 07 Dec 2020 02:32:35 PM CST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found ROOFIT_LICENSE
-> Found root.xml
-> Found root.pc.tpl
-> Found settings.cmake
-> Found jupyter_notebook_config.py
-> Found nbman-for-arch.patch