Skip to content

Instantly share code, notes, and snippets.

@abraithwaite
abraithwaite / chill-zoom.sh
Last active March 18, 2024 17:03
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
@richardpl
richardpl / drcbox.lua
Last active April 28, 2024 00:04
dynaudnorm filter with visual feedback
--[[
mpv dynaudnorm filter with visual feedback.
Copyright 2016 Avi Halachmi ( https://github.com/avih )
Copyright 2020 Paul B Mahol
License: public domain
Needs mpv with very recent FFmpeg build.
Default config:
@Earnestly
Earnestly / !README: opentype-bitmap.pe and opentype-bitmap.py
Last active March 4, 2023 07:25
Convert PCF and BDF files to bitmap only OpenType (.otb) using fontforge
Convert PCF and BDF files to bitmap only OpenType (.otb) using fontforge
If you have a new enough fontforge, the python version of this script can
optionally read filenames from standard input, generating multiple .otb
font files as it finds new families. It also handles gzipped PCF and BDF
files.
@bitingsock
bitingsock / channel mixer.lua
Created June 12, 2019 09:12
remix surround channel levels
cmCenter = 1
local defCenter = 1
cmFront = 0.707
local defFront = 0.707
cmSide = 0.707
local defSide = 0.707
cmBack = 0.707
local defBack = 0.707
cmLFE = 0
local defLFE = 0
@emoon
emoon / extract_ixa_music.c
Created June 8, 2019 20:19
Extract music from iXalance files (only seems to work for Astral blur right now)
// Code mostly extracted from https://www.libsdl.org/projects/ixalance/ but fixed a bunch of 64-bit issues with the code
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define INDEX_BIT_COUNT 10 // This is a total window of 4Kb
#define LENGTH_BIT_COUNT 4
#define WINDOW_SIZE ( 1 << INDEX_BIT_COUNT )
@bitingsock
bitingsock / ytdl prefetch resolver.lua
Last active August 19, 2023 18:35
resolves ytdl for urls in playlist when the demuxer reaches near the end of the file
local utils = require 'mp.utils'
local ytdlPath = mp.find_config_file("youtube-dl.exe")
local fileDuration = 0
local function check_position()
if fileDuration==0 then
mp.unobserve_property(check_position)
return
end
local demuxEndPosition = mp.get_property("demuxer-cache-time")
if demuxEndPosition and
@garoto
garoto / mpvhistory.lua
Last active April 6, 2024 11:53
Simple media logger Lua script for mpv
-- Not my code: originally from https://redd.it/3t6s7k (author deleted; failed to ask for permission).
-- Only tested on Windows. Date is set to dd/mmm/yy and time to machine-wide format.
-- Save as "mpvhistory.lua" in your mpv scripts dir. Log will be saved to mpv default config directory.
-- Make sure to leave a comment if you make any improvements/changes to the script!
local HISTFILE = (os.getenv('APPDATA') or os.getenv('HOME')..'/.config')..'/mpv/mpvhistory.log';
mp.register_event('file-loaded', function()
local title, logfile;
@myfreeer
myfreeer / cycle-denoise.lua
Last active May 2, 2024 06:49
mpv user-script to cycle between lavfi's denoise filters, tested over mpv 0.25.0-58-g99cef59fc
-- settings
-- key_binding: press the key specified below
-- to cycle between denoise filters below,
-- set it to nil to disable the binding
local key_binding = "n"
-- key_binding_reverse cycle between denoise filters below
-- in reverse order, set it to nil to disable the binding,
-- set it to a single-char string to enable
local key_binding_reverse = nil
@bossen
bossen / skiptofade.lua
Last active May 8, 2022 01:29
mpv lua script. Seeks forward until a black screen appears. Built to skip openings. Uses the lavfi blackdetect filter.
-- betterchapters.lua
-- seeks forward until a black screen appears.
-- default keybinding: b
-- Keybind names: skip_scene
script_name = mp.get_script_name()
detect_label = string.format("%s-detect", script_name)
detecting = false
threshold = 0.9
detection_span = 0.05
negation = false
@glittershark
glittershark / shrug.sh
Created August 27, 2015 15:52
Xdotool script to type the shrug emoji
#!/bin/bash
echo -en "¯\\_(\xe3\x83\x84)_/¯" | xsel
xdotool key Shift+Insert