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 / screenshot_add_metadata.py
Created June 1, 2026 02:42
Adds useful metadata and color information to PNG screenshots. Meant to run right after it was taken.
import struct
import sys
import os
import re
import zlib
from datetime import datetime, timezone
import ctypes
import ctypes.wintypes as wintypes
# Load DLLs
@onyx-nxt
onyx-nxt / twitter-share-order-fixer.js
Created June 1, 2026 02:18
A user script fixing X's last update that made "Copy link" no longer the first item in the menu when clicking on sharing. Based on the chrome extension code from https://github.com/Blaasst/twitter-share-fixer
// ==UserScript==
// @name X share fixer
// @namespace https://github.com/Blaasst/twitter-share-fixer
// @version 2026-06-01
// @description A user script fixing X's last update that made "Copy link" no longer the first item in the menu when clicking on sharing. Based on the chrome extension code from https://github.com/Blaasst/twitter-share-fixer
// @author Blaasst
// @match https://x.com/*
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=x.com
// @grant none
@onyx-nxt
onyx-nxt / fix-scaled-pts.lua
Last active August 11, 2026 23:35
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 for example. This script requires ffprobe to be installed and added to PATH, and that you have the local-path scrip…
local utils = require 'mp.utils'
local local_path = require 'local-path'
local user_prefs = {}
user_prefs.cache = mp.get_property_bool('cache')
local cache_dump_seconds = 5
local min_cache_seconds = 1
local pid = mp.get_property_number('pid')
local audio_sample_path = (os.getenv('TEMP') or os.getenv('TMP') or '.') .. '/mpv-media-' .. pid .. '.mka'
local function fix_sync(path)
@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
}