Skip to content

Instantly share code, notes, and snippets.

View GavinRay97's full-sized avatar

Gavin Ray GavinRay97

View GitHub Profile
@velzie
velzie / manifest-v2-chrome.md
Last active December 20, 2024 12:58
How to keep using adblockers on chrome and chromium

How to keep using adblockers on chrome and chromium

  1. google's manifest v3 has no analouge to the webRequestBlocking API, which is neccesary for (effective) adblockers to work
  2. starting in chrome version 127, the transition to mv3 will start cutting off the use of mv2 extensions alltogether
  3. this will inevitably piss of enterprises when their extensions don't work, so the ExtensionManifestV2Availability key was added and will presumably stay forever after enterprises complain enough

You can use this as a regular user, which will let you keep your mv2 extensions even after they're supposed to stop working

Linux

In a terminal, run:

@thomasdarimont
thomasdarimont / Continuation.java
Last active April 30, 2024 19:55
Java21 Continuations Demo
package demo.cont;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.function.Consumer;
public final class Continuation {
private final Object delegate;
@bowbahdoe
bowbahdoe / Continuation.java
Created July 17, 2023 15:46
Continuation Proxy Classes
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public final class Continuation {
final Object impl;
static final Class<?> IMPL_CLASS;
static final MethodHandle NEW;
static final MethodHandle YIELD;
@andrewrk
andrewrk / build.zig
Created February 20, 2023 16:20
sprinkling a little zig into a C project to help with debugging
const std = @import("std");
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
@belm0
belm0 / mcas.cpp
Last active December 17, 2022 11:33
C++ MCAS (multi-word compare and swap)
// C++ MCAS implementation, based on "Efficient Multi-word Compare and Swap"
// (https://arxiv.org/pdf/2008.02527.pdf)
//
// TODO: API header
// TODO: reclamation. Currently the implementation leaks descriptor records
// and leaves them in place indefinitely. Short list of options:
// 1) reuse thread-local descriptors (https://arxiv.org/pdf/1708.01797.pdf)
// 2) use "record manager" abstraction and plugins (DEBRA, etc.)
// (https://bitbucket.org/trbot86/implementations/src/master/cpp/debra)
// TODO: generalization: 32-bit support, user-defined word size and
@belm0
belm0 / article_sc_and_lua_1.md
Last active October 23, 2024 18:04
Structured concurrency and Lua (part 1)

Structured concurrency and Lua (part 1)

John Belmonte, 2022-Sep

I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:

  • use it as a simple introduction to structured concurrency from the perspective of Lua (this article)
  • learn the fundamental properties of structured concurrency and how to implement them
  • share code that could become the starting point for a real Lua library and framework

So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if, and while weren't introduced to languages until long after the first compu

@eatonphil
eatonphil / psql-srv.py
Last active December 17, 2024 07:25 — forked from matteobertozzi/psql-srv.py
postgres "server" wire protocol example (ported python3)
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@s5bug
s5bug / worksheet.scala
Last active March 8, 2024 19:40
Monads are Monoids in the category of Endofunctors: Scala 3
// Author: Aly Cerruti
// Please follow along in Scastie, so you can see the output of statements:
// https://scastie.scala-lang.org/CLmK5tLuRd6rxXuEnba0rQ
// A Category
trait Category[
// A collection of objects
Obj <: AnyKind,
// A constraint on those objects (Scala lacks dependent typing, so i.e. `Val = [A] =>> Monoid[A]` makes the category of Monoids)
Val[_ <: Obj],
@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