Skip to content

Instantly share code, notes, and snippets.

View GavinRay97's full-sized avatar

Gavin Ray GavinRay97

View GitHub Profile
@GavinRay97
GavinRay97 / extract-hunt-weapons.js
Last active November 20, 2023 20:56
Hunt Weapon extraction script
// Script to run on https://huntshowdown.rocks/en/weapons to extract weapon info
const meleeVariantNames = [
"Precision",
"Deadeye",
"Marksman",
"Sniper",
"Bayonet",
"Riposte",
"Trauma",
"Striker",
@GavinRay97
GavinRay97 / README.md
Last active August 10, 2023 18:44
Kotlin wishlist
@GavinRay97
GavinRay97 / MX Tuner.lua
Created August 6, 2023 22:34
MX Tuner infobox mod
--[[
@author Ilias-Timon Poulakis (FeedTheCat)
@license MIT
@version 1.8.0
@provides [main=main,mediaexplorer] .
@about Simple tuner utility for the reaper media explorer
@changelog
- Alt-click on a key now adds 'key' metadata (not automatic on MacOS)
- Alt-click on the metadata icon now removes 'key' metadata
- Improved FFT pitch detection algorithm (better harmonics detection)
@GavinRay97
GavinRay97 / Makefile
Last active July 26, 2023 22:00
WASM copy structs to memory from host -> module
WASI_VERSION_FULL = 20.0
WASMTIME_DIR = ../third-party/wasmtime-dev-x86_64-linux-c-api
WASI_SDK_PATH = ./wasi-sdk-$(WASI_VERSION_FULL)
CC = clang++
WASM_CC = $(WASI_SDK_PATH)/bin/clang++ --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot
CFLAGS = -std=c++20 -I$(WASMTIME_DIR)/include -L$(WASMTIME_DIR)/lib
LIBS = -lwasmtime
@GavinRay97
GavinRay97 / doc.md
Last active September 26, 2023 16:58
JDK Valhalla: Design document on nullability and value types (fixed formatting)
@GavinRay97
GavinRay97 / write-ahead-log.cpp
Created February 8, 2023 15:28
C++ Database Write-Ahead-Log simple proof of concept
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <optional>
#include <span>
#include <string>
// A write-ahead log is a log of all the operations that have been performed on the database.
struct LogEntryHeader
@GavinRay97
GavinRay97 / mutexes.ts
Created January 29, 2023 16:30
TypeScript Node.js/Browser Mutex + Read-Write Mutex using Atomics
class AsyncLock {
private _lock = new Int32Array(new SharedArrayBuffer(4)) // SharedArrayBuffer for multi-threading, 4 bytes for 32-bit integer
static INDEX = 0
static UNLOCKED = 0
static LOCKED = 1
lock() {
while (true) {
console.log("lock")
@GavinRay97
GavinRay97 / build.gradle.kts
Created January 23, 2023 14:46
Kotlin Gradle - How to use preview JDK's
val JDK_21_PATH = "/home/user/.sdkman/candidates/java/21.ea.6-open"
tasks.withType<org.jetbrains.kotlin.gradle.tasks.UsesKotlinJavaToolchain>().configureEach {
kotlinJavaToolchain.jdk.use(JDK_21_PATH, JavaVersion.VERSION_21)
}
@GavinRay97
GavinRay97 / example-module.cxx
Created January 21, 2023 17:43
C++ Modules Example
// Compile with:
// $ /opt/gcc-latest/bin/g++ --std=c++2b -fmodules-ts other-module.cxx example-module.cxx -o example
// Global module fragment where #includes can happen
module;
#include <iostream>
// first thing after the Global module fragment must be a module command
export module example;
import other_module;