Skip to content

Instantly share code, notes, and snippets.

View tom-huntington's full-sized avatar

tom-huntington

View GitHub Profile
@tom-huntington
tom-huntington / clip-youtube-dl.sh
Last active January 22, 2024 05:17
Download a portion of a youtube live stream
#!/bin/bash
#Arguments: URL, Starting Timestamp -5 seconds, Ending Timestamp, video file name
set -x;
readarray -t urls <<< "$(yt-dlp -f bestvideo[ext=mp4][vcodec^=avc1]+140 --youtube-skip-dash-manifest -g "$1")"
ffmpeg -ss $2 -to $3 -i "${urls[0]}" -ss $2 -to $3 -i "${urls[1]}" -ss 10 -map 0:v -map 1:a -c:v copy -c:a copy "${4}.mp4"

Let $p,v,t$ be the position, velocity and time unknowns such that for all $i$ we have a collision

$$p-p_i - t\times(v-v_i)=0.$$

To eliminate $t$ we wedge (exterior) product with $v-v_i$ to get

$$0=(p-p_i)\wedge (v-v_i)= p\wedge v - p \wedge v_i - p_i \wedge v + p_i \wedge v_i.$$

The nonlinear term $p\wedge v$ is constant for all $i$, so we subtract equations to get a linear equation

@tom-huntington
tom-huntington / script.py
Created August 29, 2023 10:04
files by chapter concatenated to chapterized file
import subprocess
import os
import re
def make_chapters_metadata(list_mp4: list):
print(f"Making metadata source file")
chapters = {}
for single_mp4 in list_mp4:
number = single_mp4.removesuffix(".m4a")
@tom-huntington
tom-huntington / Create-o7-app.md
Last active March 13, 2023 22:36
Just noob questions
@tom-huntington
tom-huntington / haskell_state_monad.md
Last active December 30, 2022 23:11
Notes on state monad
@tom-huntington
tom-huntington / python_notes.md
Last active December 25, 2023 01:54
Notes on 4HbQ's aoc solutions

complex for 2 vectors

Arithmatic operations broadcast unlike tuples

>>> complex(1,1) + complex(2,-2)
(3-1j)

Associative array :: T -> int

Use index/find on list or string

Knowing when you don't need correctness is very expensive for developer productivity.

Skipping corners, not verifying correctness is necessary for productivity. There are multiple levels of correctness. Rubbish > Does Something > Reasonable > Justified > Correct > Omniscient optimal. The level of correctness needs to be observable.

Only Program what is minimally sufficient

Most of the time you programme more specific results than you actually need. Don't do this

Programming is an empirical discipline

Writing correct code the first time is economically unviable.

@tom-huntington
tom-huntington / ScaleAction.ipynb
Created October 29, 2022 02:36
minimal reproducible example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tom-huntington
tom-huntington / buffer_until.md
Last active July 21, 2022 21:24
RxCpp-v3 adaptor

Concepts

struct observable {
    void bind(observer);
};

struct observer {
    template<class T>
    void next(T);
};