Skip to content

Instantly share code, notes, and snippets.

View AhmedThahir's full-sized avatar

Thahir AhmedThahir

View GitHub Profile
#! /usr/bin/env ruby
# strip-silence version 1.1
#
# Usage:
# strip-silence input.mp4
#
# Description:
# Uses auto-editor to identify areas of silence in input.mp4,
# then uses ffmpeg to strip them out (without recompression).
@slinderman
slinderman / jax_minimize_wrapper.py
Last active November 8, 2024 18:53
A simple wrapper for scipy.optimize.minimize using JAX. UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
A collection of helper functions for optimization with JAX.
UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
import numpy as onp
import scipy.optimize
from jax import grad, jit
from jax.tree_util import tree_flatten, tree_unflatten
from jax.flatten_util import ravel_pytree
@mblondel
mblondel / kernel_kmeans.py
Last active March 23, 2026 16:57
Kernel K-means.
"""Kernel K-means"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils import check_random_state