Skip to content

Instantly share code, notes, and snippets.

View onyx-nxt's full-sized avatar
💭
Probably Coding something... What else?

Onyx onyx-nxt

💭
Probably Coding something... What else?
View GitHub Profile
@onyx-nxt
onyx-nxt / fix-sync.lua
Last active January 21, 2026 09:46
MPV script that fixes video sync on some broken videos where both the audio and video PTS are incorrect by a constant factor. This is apparent in some videos uploaded to internet platforms to exploit and bypass max framerate checks. This works by monitoring the demuxer cache or audio PTS and measuring how much it increases over 1 second. In a vi…
function fix_sync()
-- Capture the first snapshot
local pts_prev = math.floor(mp.get_property_native('demuxer-cache-state')['reader-pts'] or mp.get_property_number('audio-pts'))
local sample_time = 1
local pts_prev_diff = 0
local sample_timer
sample_timer = mp.add_periodic_timer(sample_time, function()
local pts_cur = math.floor(mp.get_property_native('demuxer-cache-state')['reader-pts'] or mp.get_property_number('audio-pts'))
local pts_diff = pts_cur - pts_prev
pts_prev = pts_cur
@onyx-nxt
onyx-nxt / ConvertAndroidScreenshotToWinScreenshotFormat.ps1
Created October 4, 2025 03:11
Converts Android's screenshot filename format (Screenshot_YYYYMMDD_HHMMSS_AppName) to match the Windows Snipping Tool format (Screenshot YYYY-MM-DD HHMMSS) while preserving file timestamps.
$folderPath = "C:\Path\To\Directory"
# Process matching screenshot files
Get-ChildItem -Path $folderPath -Filter "Screenshot_*.png" | ForEach-Object {
$fileName = $_.BaseName
# Match Screenshot_YYYYMMDD_HHMMSS and extract timestamp
if ($fileName -match '^Screenshot_(\d{8})_(\d{6})') {
$date = $matches[1]
$time = $matches[2]
@onyx-nxt
onyx-nxt / getAllDllFilesInDirectoryAndThenReturnAllOfTheirPathsUsingForwardSlashesAndDirectoriesTwoLevelsUpAreReplacedByAPeriodInOneStringByJoiningThemTogetherByAnAsterisk.ps1
Created July 22, 2023 02:16
Get all dll files in a directory and then return all of their paths using forward slashes and directories two levels up are replaced by a period in one string by joining them together by an asterisk
# Get all DLL files in the specified directory and its subdirectories
$directory = "C:\your\directory\path"
$dllFiles = Get-ChildItem -Path $directory -Filter "*.dll" -File -Recurse
# Convert the paths to forward slashes and replace directories two levels up with a period
$paths = $dllFiles | ForEach-Object {
$relativePath = $_.FullName -replace '^(.*)\\(\w+)\\(\w+)\\(.+)$', '.\$3\$4'
$relativePath = $relativePath -replace "\\","/"
$relativePath
}