Skip to content

Instantly share code, notes, and snippets.

View zeitiger's full-sized avatar

David Steinkopff zeitiger

  • DB Systel
  • remote, Germany
View GitHub Profile
@zeitiger
zeitiger / split_speaker_zoom_recording_per_speaker.py
Created November 23, 2023 21:36
Python script for splitting a video based on detected speakers: This script utilizes frame analysis to identify speakers in a video, comparing frames against known speaker images and creating separate video clips for each speaker found. The code employs similarity calculations and MoviePy for video processing, offering a starting point for speak…
import cv2
import numpy as np
from moviepy.editor import VideoFileClip
from moviepy.video.io.ffmpeg_writer import FFMPEG_VideoWriter as VideoFileClipWriter
lastest_speaker_frames = [None for _ in range(6)]
# TODO find a better way to calculate ssim
def calculate_ssim(x, y):
# Convert images to grayscale
@zeitiger
zeitiger / registerCustomElements.js
Created July 13, 2016 07:28
Register low level custom elements dynamic on the fly for v0 and v1
const noop = () => undefined;
/**
*
* @param {string} elementName
* @param {string} sourceTagName
* @param {object} sourcePrototype
* @param {function} setup
* @param {function} destroy
* @see https://developers.google.com/web/fundamentals/primers/customelements/
*/
@zeitiger
zeitiger / replace-css-loader.js
Created April 12, 2016 13:39
In test scenario it could be helpful to simple disable css-plugin of SystemJS
System.set(System.normalizeSync('css'), System.newModule({
fetch() {
console.info('disable css loading in test suite');
return Promise.resolve('');
}
}));
@zeitiger
zeitiger / gist:a57ead8904ee9a6ec4c3
Created March 9, 2016 08:21
How to convert shp to geojson under Mac OS X
#install gdal
brew install gdal
#convert 1:1
ogr2ogr -f "GeoJSON" file.geojson file.shp
#convert loose, higher tolerance in simplify reduce files size and lost data precision
ogr2ogr -simplify 0.000001 -f "GeoJSON" file.geojson file.shp
@zeitiger
zeitiger / gist:1387f7d996f64b493608
Last active March 30, 2022 08:11
JSExportAs Workaround in Swift (simplified code example)
public typealias myFunctionDefAlias = (@objc_block (String, String, NSNumber) -> Void)
@objc
public protocol MyJSExportProtocol: JSExport {
// JSExportAs alternative in Swift via closure
var myFunction:myFunctionDefAlias? {get}
}
@objc
public class MyJSExportClass: NSObject, MyJSExportProtocol {