Skip to content

Instantly share code, notes, and snippets.

View TheAMM's full-sized avatar

Anna-Maria Meriniemi TheAMM

View GitHub Profile
@TheAMM
TheAMM / fix_subdelay.lua
Created November 14, 2017 23:03
Simple mpv script to fix subtitle delay (ie. signs starting too soon, too late)
--[[
Simple script to fix sub-delay on offset subs
First, framestep to where the desired subtitle (sign) SHOULD start, press ALT+Z
Next, framestep to where the desired subtitle (sign) DOES start, press ALT+Z
Done.
You may press ALT+Z twice in succession to zero out sub-delay.
]]--
@TheAMM
TheAMM / README.md
Last active November 15, 2017 21:47
Quick ASS image example

Put all of these files (not this readme) into your mpv's scripts directory, then open a video and press alt+a.

@TheAMM
TheAMM / write_to_file.lua
Created March 17, 2018 16:50
Lua script for mpv to write lines to a file
local assdraw = require 'mp.assdraw'
local msg = require 'mp.msg'
local opt = require 'mp.options'
local utils = require 'mp.utils'
--[[
Simple script to expose a command to write a line to a file.
Example bind:
v script-message write-to-file "/tmp/some_file" "Now playing: ${path} at ${playback-position}"
]]--
@TheAMM
TheAMM / display_eta.lua
Last active April 29, 2022 07:57
Simple mpv Lua script for displaying the expected end time for the current file
--[[
Simple script to display the end-time for the current file.
Example input.conf bind:
E script-message display-eta
]]--
local utils = require("mp.utils")
local SCRIPT_COMMAND_NAME = 'display-eta'
function display_eta()
@TheAMM
TheAMM / mpv_geometry_freezer.lua
Created November 13, 2018 23:33
mpv_geometry_freezer.lua keeps your mpv window size unchanging
--[[
mpv_geometry_freezer.lua
Sets the geometry property when window size changes,
avoiding Windows' maximized windows detaching.
- AMM
]]--
local msg = require 'mp.msg'
local UPDATE_INTERVAL = 0.5
local screen_w, screen_h = mp.get_osd_size()
@TheAMM
TheAMM / discord_embed_grid.user.js
Last active July 1, 2024 20:06
It is 2024 and discord still displays embeds in a column, the fuck
// ==UserScript==
// @name Discord Embed grid
// @namespace https://gist.github.com/TheAMM/147be5001e43b7d8c60151716bbef703
// @version 0.5.4
// @description Adjust message embed CSS to display them as packed rows
// @author AMM
// @match https://discord.com/*
// @downloadURL https://gist.github.com/TheAMM/147be5001e43b7d8c60151716bbef703/raw/discord_embed_grid.user.js
// @grant none
// @run-at document-end
@TheAMM
TheAMM / dump_hex.py
Created December 8, 2021 10:42
Cute hex dumper in Python
def dump_hex(binary, width=16, group_width=8, address_offset=0, print_func=print):
groups_size = int(width / group_width + 0.5)
if isinstance(binary, (bytes, bytearray, memoryview)):
binary_iterator = (binary[i:i+width] for i in range(0, len(binary), width))
else:
# Assume iterator, receive arbitrary-sized byte chunks and reassemble them
def _iter_wrapper():
extra = b''
for chunk in binary:
@TheAMM
TheAMM / twitter_media_source.user.js
Last active July 8, 2024 14:26
Twitter Media Source userscript
// ==UserScript==
// @name Twitter Media Source
// @namespace https://gist.github.com/TheAMM
// @downloadURL https://gist.github.com/TheAMM/de48c152076fec4c0ba530ad09081f40/raw/twitter_media_source.user.js
// @updateURL https://gist.github.com/TheAMM/de48c152076fec4c0ba530ad09081f40/raw/twitter_media_source.user.js
// @version 2.1.5
// @description Allows copying direct full-size image/video links on Twitter (with a #tweetid source suffix), downloading media, and navigating back to a Tweet from a media URL.
// @author AMM
// @match https://twitter.com/*
// @match https://x.com/*
@TheAMM
TheAMM / dump_properties.lua
Created June 27, 2023 18:51
Script to dump mpv properties with
local utils = require 'mp.utils'
local msg = require 'mp.msg'
--[[
Simple script to dump all available properties, optionally to a file.
Open console and type:
script-message dump-properties
Append a filename to write to:
script-message dump-properties props.txt