Skip to content

Instantly share code, notes, and snippets.

View GavinRay97's full-sized avatar

Gavin Ray GavinRay97

View GitHub Profile
@shawwn
shawwn / What happens when you allocate a JAX tensor on a TPU.md
Last active April 15, 2023 04:11
JAX C++ stack trace walkthrough for TpuExecutor_Allocate
@ess7
ess7 / myadd.cpp
Last active November 6, 2021 20:19
Call C function from Reaper JSFX (x86/x64, no hardcoded offsets, 6.x tested)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <reaper_plugin.h>
#include <ns-eel.h>
/*
* If you actually try this, the JS effect that uses the new function should not be the first one loaded,
* otherwise you will get an "undefined 'myadd'" error.
* Workarounds: recompile/reset or add any JS effect before this
{
"problemMatcher": [
{
"owner": "hlint",
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]*\\/)([^:/]*):(\\d+)(-\\d+)?:(\\d+)(-\\d+)?: (Warning|Error): (.*)$",
"fromPath": 1,
"file": 2,
@Sintrastes
Sintrastes / EmulateMultiReceivers.kt
Created October 15, 2021 18:53
Example of how to emulate multiple recievers with bounded polymorphism in Kotlin
interface Logging {
fun log(message: String)
}
interface Prompt {
fun promptUser(): String
}
fun <Ctx> Ctx.exampleFn() where Ctx: Logging, Ctx: Prompt {
@jharmer95
jharmer95 / property.hpp
Last active May 14, 2023 17:06
Class emulating properties for C++
#include <iostream>
#include <memory>
#include <type_traits>
#include <utility>
namespace not_std
{
template<typename T>
constexpr T default_getter(const T& val) noexcept
{
@davidfowl
davidfowl / MinimalAPIs.md
Last active March 16, 2025 16:47
Minimal APIs at a glance

Understanding Comparative Benchmarks

I'm going to do something that I don't normally do, which is to say I'm going to talk about comparative benchmarks. In general, I try to confine performance discussion to absolute metrics as much as possible, or comparisons to other well-defined neutral reference points. This is precisely why Cats Effect's readme mentions a comparison to a fixed thread pool, rather doing comparisons with other asynchronous runtimes like Akka or ZIO. Comparisons in general devolve very quickly into emotional marketing.

But, just once, today we're going to talk about the emotional marketing. In particular, we're going to look at Cats Effect 3 and ZIO 2. Now, for context, as of this writing ZIO 2 has released their first milestone; they have not released a final 2.0 version. This implies straight off the bat that we're comparing apples to oranges a bit, since Cats Effect 3 has been out and in production for months. However, there has been a post going around which cites various compar

@mukel
mukel / DynamicJava.java
Created June 14, 2021 20:45
Compiling Java code dynamically and running it in Espresso.
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@GuillaumeDua
GuillaumeDua / Concept-based polymorphism in modern Cpp.md
Last active May 7, 2025 15:58
Concept-based polymorphism in modern C++

Concept-based polymorphism in modern C++

Date 05-05-2021 - 10-17-2023
Revision R3
Author Guillaume Dua
Reviewers Loïc Joly, Antoine Morrier
@mayankmkh
mayankmkh / PrettyPrint.kt
Last active June 18, 2025 12:44
Pretty Print Kotlin Data Class
fun Any.prettyPrint(): String {
var indentLevel = 0
val indentWidth = 4
fun padding() = "".padStart(indentLevel * indentWidth)
val toString = toString()
val stringBuilder = StringBuilder(toString.length)