Skip to content

Instantly share code, notes, and snippets.

View toddmath's full-sized avatar
🏋️‍♂️
getting stuff done

Todd Matheson toddmath

🏋️‍♂️
getting stuff done
View GitHub Profile
@toddmath
toddmath / index.html
Created September 13, 2025 14:44
robots.txt file for all increasingly common AI bots and crawlers. Note, if you want to also include Bing bot, you must add the included meta tag to your html. Sourced from repo https://github.com/ai-robots-txt/ai.robots.txt/tree/main
<html>
<head>
<meta name="robots" content="noarchive">
<head>
</html>
@toddmath
toddmath / SCAN_CORRUPTED_VIDEOS.md
Last active August 18, 2025 03:14 — forked from ridvanaltun/SCAN_CORRUPTED_VIDEOS.md
How to check if a video file is corrupted?

Install ffmpeg for macOS

brew install ffmpeg

Command for scanning a single file. Will generate a log file, if there's no error, the log file will be empty.

ffmpeg -v error -i \path\to\file.avi -f null - &gt;error.log 2&gt;&amp;1
@toddmath
toddmath / settings.json
Created December 9, 2024 21:40 — forked from cjkihl/settings.json
TailwindCSS Config for Autocomplete
{
// Config for VsCode Tailwind CSS IntelliSense extension for React
// Type hints for className and class attributes
"tailwindCSS.classAttributes": [
"class",
"className",
],
// Type hints for variables and properties ending with *className
"tailwindCSS.experimental.classRegex": [
@toddmath
toddmath / openelm-coreml.py
Created May 25, 2024 04:47 — forked from pcuenca/openelm-coreml.py
Convert OpenELM to Core ML (float32)
import argparse
import numpy as np
import torch
import torch.nn as nn
import coremltools as ct
from transformers import AutoTokenizer, AutoModelForCausalLM
# When using float16, all predicted logits are 0. To be debugged.
compute_precision = ct.precision.FLOAT32
compute_units = ct.ComputeUnit.CPU_ONLY
@toddmath
toddmath / video_integrity_check.sh
Created April 27, 2024 03:01
ffmpeg video integrity check
# scan a single file
ffmpeg.exe -v error -i \path\to\file.avi -f null 2>error.log
# batch scan
find \path\to -name "*.{mp4,mkv}" -exec sh -c "ffmpeg -v error -i '{}' -map 0:1 -f null 2>'{}.log'" \;
@toddmath
toddmath / image_reset.css
Created March 2, 2024 08:51
A better modern css image reset
img {
max-width: 100%;
height: auto;
vertical-align: middle;
font-style: italic;
background-repeat: no-repeat;
background-size: cover;
shape-margin: 0.75rem;
}
@toddmath
toddmath / mp4.sh
Created December 20, 2022 23:22
merge multiple videos into single with chapters named with original filenames
#! /usr/bin/env bash
####################################################
# Required Libraries
#
# library name | commands used | verified version
# ------------------------------------------------
# ffmpeg | ffmpeg/ffprobe | 3.1.4 3.2
# gpac | mp4box | 0.6.1
# mp4v2 | mp4chaps | 2.0.0
@toddmath
toddmath / syntax.lua
Created August 29, 2021 21:05
Basic valid lua syntax. This file can be run, but is mostly just for personal reference on how to do things in lua.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@toddmath
toddmath / lookahead_generator.py
Last active June 23, 2021 23:50
Python Generator that can improve performance by obtaining the next n values in a separate background thread.
from threading import Thread
from queue import Queue
from typing import Any, Literal, Optional, TypeVar, Union, Generator, Generic
T = TypeVar("T")
class BackgroundGenerator(Thread, Generic[T]):
def __init__(self, generator: Generator[T, Any, Any], lookahead: Union[int, Literal[10]] = 10):
Thread.__init__(self)
@toddmath
toddmath / prime_gen.js
Created May 30, 2021 20:15
Generator Functions for prime numbers
function* from(i) { while (true) { yield i; i++; } }
function* genFilter(gen, cond) {
for (let e of gen) { if (cond(e)) yield e; }
}
function* prime(gen) {
let head = gen.next().value;
yield head;
yield* prime(genFilter(gen, (x) => x % head !== 0));