This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # /// script | |
| # dependencies = [ | |
| # "scenedetect[opencv]", | |
| # ] | |
| # /// | |
| """ | |
| LoopDetector: A utility to detect looping animations within specific scene segments | |
| and process them into clips or GIFs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # ========================================== | |
| # Configuration & Helpers | |
| # ========================================== | |
| VIDEO_IN="$1" | |
| AUDIO_SRC="${2:-${VIDEO_IN%.*}.mp4}" | |
| TARGET_MB="${3:-20}" | |
| # Check dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- formatter.yue | |
| import global | |
| {:modf, :abs, :floor, :ceil, :log10, :pow} = math | |
| {:insert, :concat} = table | |
| {:format, :gsub, :sub} = string | |
| -- Constants | |
| DOT_NOTATION = "." | |
| COMMA_NOTATION = "," | |
| MINUS_SIGN = "-" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Register the GZIP loader for .lua.gz files | |
| local function load_gzip_lua(module_name) | |
| -- Convert "a.b.c" to "a/b/c.lua.gz" | |
| local path = module_name:gsub("%.", "/") .. ".lua.gz" | |
| if not love.filesystem.getInfo(path) then | |
| return "\n\tno file '" .. path .. "' (gzip loader)" | |
| end | |
| local data, read_err = love.filesystem.read("data", path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # /// script | |
| # dependencies = [ | |
| # "scenedetect[opencv]", | |
| # ] | |
| # /// | |
| """ | |
| SceneCutter: A wrapper utility to detect and extract video scenes from MP4, MKV, and WebM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Lite Loop (Dufs Auto-List)</title> | |
| <style> | |
| * { box-sizing: border-box; } | |
| body, html { | |
| margin: 0; padding: 0; height: 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <!-- | |
| ------------===--------===---====-----::::..:............................................. | |
| ---------====-----:-========--==------:::....................:............:::::::::::::::: | |
| --------------------=========--=------::::................................:::::::::::::::: | |
| -----------------=-===-==-----=+=-----::::..........................:::::::............... | |
| ----------==---==--------:::--=++=----:::.........................::--===-:............::. | |
| ==---=======--===------:::::--=+++=--:::.:......................::-=++++**=:.............. | |
| ========--------::::::::::::--=++++=-:::.......................:-====++****-:............. |
Normalizing User-Agent (UA) strings is a smart move. Raw UA strings are messy, inconsistent, and can be easily spoofed, but they provide a vital "fingerprint" layer when combined with IP and Session IDs.
For a high-traffic site like a video host, storing raw strings leads to database bloat and slow queries. Here is how to normalize them effectively for bot detection and rate limiting.
Don't just store one version of the UA. I recommend breaking it down into three distinct database columns to balance storage efficiency with query flexibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- cache definition | |
| local cached_table_identifier = {} | |
| -- weak table. THIS IS IMPORTANT! | |
| -- This allow the cache string to be fred by GC as table no longer referenced. | |
| -- Without this, you have to manually dereference the string OR memory leaking! | |
| setmetatable(cached_table_identifier, { __mode = "k" }) -- the key (table) is weak | |
| -- A counter just to see cache hits/misses | |
| local cache_misses = 0 |
NewerOlder