Skip to content

Instantly share code, notes, and snippets.

View vade's full-sized avatar

Anton Marini vade

View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
# patch-claude-code.sh — Rebalance Claude Code prompts to fix corner-cutting behavior
#
# What this does:
# Patches the npm-installed @anthropic-ai/claude-code cli.js to rebalance
# system prompt instructions that cause the model to cut corners, simplify
# excessively, and defer complicated work.
#
@Qirias
Qirias / depth_pyramid.cpp
Created February 12, 2026 21:07
Depth Pyramid - Single Pass Downsampler in Metal
void depth_pyramid(MTL::CommandBuffer *commandBuffer) {
uint32_t zero = 0;
memcpy(_spdAtomicBuffer->contents(), &zero, sizeof(uint32_t));
MTL::ComputeCommandEncoder* encoder = commandBuffer->computeCommandEncoder();
encoder->setLabel(NS::String::string("Depth Pyramid SPD", NS::ASCIIStringEncoding));
encoder->setComputePipelineState(_depthPyramidPSO);
encoder->setTexture(depthTexture, 0);
encoder->setTexture(_depthPyramidTexture, 1);
@dicknetherlands
dicknetherlands / streamlined_graphene.py
Last active February 3, 2025 17:38
Graphene speedup
# This gist shows how to speed up graphene_django by short-cutting the field and type resolution of the returned JSON and
# using a bit of caching to avoid having to repeat our discovery/decision process across multiple fields of the same
# type. It relies on trusting the developer to always return the correct types and respect non-nullability.
# Assumes that:
# 1. You're not using async code
# 2. You're using graphql_sync_dataloader to solve the N+1 problem
# 3. You're not using any graphene middleware other than for authentication
# 4. Your resolvers will all respect the schema
# 5. See code comments for further limitations
@fbarretto
fbarretto / streamdiffusion-mac.md
Last active January 28, 2026 03:05
StreamDiffusion on a Mac

This is a gist on how to get StreamDiffusion running on a Mac (mps)

  1. Clone the repo

git clone https://github.com/cumulo-autumn/StreamDiffusion.git
  1. Setup the environment

cd StreamDiffusion
@RobertRiachi
RobertRiachi / Whisper_ANE_export.py
Last active February 3, 2024 01:42
Export an optimized version of Whisper for ANE using coreml
import torch
import torch.nn.functional as F
import coremltools as ct
from torch import Tensor
from torch import nn
from typing import Dict
from typing import Optional
from ane_transformers.reference.layer_norm import LayerNormANE as LayerNormANEBase
from coremltools.models.neural_network.quantization_utils import quantize_weights
@Martini024
Martini024 / VideoHelper.swift
Last active June 14, 2026 21:33
SwiftUI: Rewrite iOS Photos Video Scrubber
import AVKit
import Foundation
class VideoHelper {
static func getThumbnail(from player: AVPlayer, at time: CMTime, maximumSize: CGSize? = nil) -> CGImage? {
guard let currentItem = player.currentItem else { return nil }
return getThumbnail(from: currentItem.asset, at: time, maximumSize: maximumSize)
}
@moutend
moutend / README.md
Created March 27, 2021 01:10
[Swift] Equalizing Audio Signal with vDSP.Biquad

[Swift] Equalizing Audio Signal with vDSP.Biquad

This script reads /tmp/input.wav, applies the low-pass filter, and writes the modified signal as /tmp/output.wav.

To run, open Terminal.app and hit the following command:

$ swift main.swift
@madelinegannon
madelinegannon / jetson-nano_openFrameworks_setup_tutorial.md
Last active December 20, 2024 01:56
How to Set Up the NVIDIA Jetson Nano for openFrameworks
@kylemcdonald
kylemcdonald / dtw_mse.py
Last active April 28, 2021 16:28
DTW MSE numba function for use with UMAP.
# based on https://github.com/kylerbrown/ezdtw
# with modifications to be fully njit-able
import numpy as np
from numba import njit
@njit
def sqeuclidean(a, b):
return np.sum((a - b)**2)