Skip to content

Instantly share code, notes, and snippets.

View vade's full-sized avatar

Anton Marini vade

View GitHub Profile
@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 October 21, 2025 05:31
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 July 23, 2025 08:22
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)
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active December 24, 2025 11:02
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@steven2358
steven2358 / ffmpeg.md
Last active December 25, 2025 16:52
FFmpeg cheat sheet