Skip to content

Instantly share code, notes, and snippets.

@gmdelc66
gmdelc66 / diart_whisper.py
Created September 4, 2024 00:39 — forked from juanmc2005/diart_whisper.py
Code for my tutorial "Color Your Captions: Streamlining Live Transcriptions with Diart and OpenAI's Whisper". Available at https://medium.com/@juanmc2005/color-your-captions-streamlining-live-transcriptions-with-diart-and-openais-whisper-6203350234ef
import logging
import os
import sys
import traceback
from contextlib import contextmanager
import diart.operators as dops
import numpy as np
import rich
import rx.operators as ops
@gmdelc66
gmdelc66 / youtube_formats.md
Created January 31, 2023 06:58 — forked from AgentOak/youtube_formats.md
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
def geometric_brownian_motion(G0, mu, sigma, N, T):
"""Simulates a Geometric Brownian Motion.
:param float G0: initial value
:param float mu: drift coefficient
:param float sigma: diffusion coefficient
:param int N: number of discrete steps
:param int T: number of continuous time steps
:return list: the geometric Brownian Motion
"""
@gmdelc66
gmdelc66 / reflection_principle_bm.ipynb
Created October 20, 2022 08:03 — forked from IlievskiV/reflection_principle_bm.ipynb
Demonstration of the reflection principle of the Brownian Motion
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
def cellular_automaton(rule_number, size, steps,
init_cond='random', impulse_pos='center'):
"""Generate the state of an elementary cellular automaton after a pre-determined
number of steps starting from some random state.
Args:
rule_number (int): the number of the update rule to use
size (int): number of cells in the row
@gmdelc66
gmdelc66 / app.py
Created June 17, 2022 17:45 — forked from Satak/app.py
Python xml
import xml.etree.ElementTree as ET
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
@gmdelc66
gmdelc66 / 0_XML.py
Created June 17, 2022 17:44 — forked from yoki/0_XML.py
Python XML
# xml document
# edit.py
# encode.py
# extract.py
# namespace.py
# search.py
@gmdelc66
gmdelc66 / ValidaFacturaXML.cs
Created June 17, 2022 17:37 — forked from araban/ValidaFacturaXML.cs
Método para validar el XML de una factura en el SAT / Method to validate XML file in SAT México
// Referencia del servicio web https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc
/// <summary>
/// Estado de la factura de acuerdo a validación.
/// </summary>
enum Status
{
Valida = 1, //Válida por el SAT
NoValida = 2, //No válida por el SAT
Duplicada = 3, //Se intenta cargar más de una vez en el sistema
@gmdelc66
gmdelc66 / readcfdi.php
Created February 2, 2021 05:38 — forked from goedecke/readcfdi.php
Extraer información de CFDI XML facil con simplexml
<?php
$xml = simplexml_load_file('test.xml');
$ns = $xml->getNamespaces(true);
$xml->registerXPathNamespace('c', $ns['cfdi']);
$xml->registerXPathNamespace('t', $ns['tfd']);
//EMPIEZO A LEER LA INFORMACION DEL CFDI E IMPRIMIRLA
foreach ($xml->xpath('//cfdi:Comprobante') as $cfdiComprobante){
echo $cfdiComprobante['version'];