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
// This file defines tests for various GGML ops and backends.
// For the forward pass it asserts that the results of multiple backends computing the same GGML ops are consistent.
// For the backward pass it asserts that the gradients from backpropagation are consistent
// with the gradients obtained via the method of finite differences ("grad" mode, this is optional).
// It is also possible to check the performance ("perf" mode).
//
// this file has three sections: Section 1 does general setup, section 2 defines the GGML ops to be tested,
// and section 3 defines which tests to run.
// Quick start for adding a new GGML op: Go to section 2 and create a struct that inherits from test_case,
// then go to section 3 and add an instantiation of your struct.
@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)