Skip to content

Instantly share code, notes, and snippets.

View toverux's full-sized avatar

Morgan Touverey Quilling toverux

View GitHub Profile
@toverux
toverux / inline-manifest-plugin.mjs
Last active June 16, 2025 20:36
Example of custom Webpack plugin for embedding a build manifest inside your files at build-time. Customize to you needs.
import { Compilation, sources } from 'webpack';
/**
* This is a basic Webpack plugin producing an asset map similar to what WebpackManifestPlugin does,
* except instead of emitting a manifest.json, it inlines the manifest in the source, replacing a
* variable by name in the source.
* It was written to only cover our basic use case of referencing some "internally public" chunks by
* their basic name and map that to their built name with a hash.
*
* @example With an appropriate `filter` option, replaces a variable `__BUNDLING_MANIFEST__` with:
/**
* Fetches and constructs the breadcrumb of modules, starting from the last opened on the stack (startModuleId),
* tracing back to the root module, thanks to each module's parentId.
*
* @param startModuleId The last module you want to be opened in the breadcrumb.
*/
private fetchModules(startModuleId: AuditModule['_id']): Observable<AuditModule[]> {
//=> Each time we need to fetch a new module, we emit the wanted module id on this subject
const fetchIdSubject = new BehaviorSubject(startModuleId);
import numpy as np
import argparse
import glob
import cv2
import json
def auto_canny(image, sigma=0.33):
otsu_thresh_val, ret = cv2.threshold(image, 0, 255, cv2.THRESH_BINARY|cv2.THRESH_OTSU)
lower = otsu_thresh_val * 0.3