Skip to content

Instantly share code, notes, and snippets.

@sirlaurie
sirlaurie / build-ffmpeg-and-mpv.sh
Last active March 4, 2024 16:11
a script for building ffmpeg and mpv with capable playing dolby vision
#!/usr/bin/env zsh
# just for macOS
#
# The default options for installing ffmpeg and mpv via brew do not include the activation of libplacebo.
# As a result, when playing videos in Dolby Vision, the color mapping is not accurate. To resolve this issue,
# a script is used to compile ffmpeg with libplacebo activated, followed by the building of mpv.
# Extra: build mpv bundle, with jxl
if [ "$(uname -s)" != "Darwin" ]; then
@nilninull
nilninull / restart_mpv.lua
Last active November 27, 2022 12:07
Function to restart mpv by pressing the key.
-- When using the version under development, the image sometimes
-- freezes during seek. Restarting mpv cures it, but it is
-- troublesome, so I wrote a script to solve the problem.
local function restart_mpv()
mp.command("quit-watch-later")
local cmds = {"run", "mpv"}
-- local opts = mp.get_property_native("property-list")
@parterburn
parterburn / custom_warp_script.applescript
Created September 27, 2022 16:51
An easy way to use the Warp terminal (https://www.warp.dev/) with Alfred.
-- For the latest version:
-- https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82
-- Set this property to true to always open in a new window
property open_in_new_window : false
-- Set this property to false to reuse the current tab
property open_in_new_tab : true
-- Handlers
@dbrookman
dbrookman / build-mpv_silicon.sh
Last active May 23, 2024 07:13
How to build mpv & mpv.app on an Apple silicon Mac
#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon Macs.
# Run this script from the root directory of the mpv repo.
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build
@francisfeng
francisfeng / save-tabs-safari-anybox.applescript
Last active March 28, 2024 22:29
Save all tabs of Safari’s current window to Anybox
tell application "Safari"
repeat with tabItem in tabs of window 1
set link to URL of tabItem
tell application id "cc.anybox.Anybox"
save link
end tell
end repeat
end tell
@agyild
agyild / FSR.glsl
Last active May 21, 2024 04:40
AMD FidelityFX Super Resolution v1.0.2 for mpv
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@agyild
agyild / CAS-scaled.glsl
Last active April 26, 2024 18:17
AMD FidelityFX Contrast Adaptive Sharpening v1.0.2 for mpv
// LICENSE
// =======
// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
// -------
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// -------
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
@jerieljan
jerieljan / btt-screenshot.sh
Created May 22, 2021 13:32
Screenshot OCR with BetterTouchTool on MacOS
#!/usr/bin/env bash
# Usage:
# - Install `tesseract` with `brew install tesseract`
# - In BetterTouchTool, create a trigger of your choice.
# (I recommend a Keyboard Shortcut with Cmd+Shift 6)
# - Add an Execute Shell Script / Task action
# - Paste this script.
# NOTE: You'll need to authorize BTT to the Screen Recording permission in Security and Privacy at System Preferences
@bitingsock
bitingsock / ytdl-preload.lua
Last active May 17, 2024 12:31
Precache the next entry in your playlist if it is a network source by downloading it to a temp file ahead of time. Change Line 20 to temp directory. It will delete the directory on exit.
----------------------
-- #example ytdl_preload.conf
-- # make sure lines do not have trailing whitespace
-- # ytdl_opt has no sanity check and should be formatted exactly how it would appear in yt-dlp CLI, they are split into a key/value pair on whitespace
-- # at least on Windows, do not escape '\' in temp, just us a single one for each divider
-- #temp=R:\ytdltest
-- #ytdl_opt1=-r 50k
-- #ytdl_opt2=-N 5
-- #ytdl_opt#=etc
@varahash
varahash / gist:9fc02e5b88c3259796e7b740b1963202
Created November 15, 2020 15:08
Repair APFS 'warning: overallocation detected on Main device'
1. Boot into Recovery mode (by pressing CMD+R while boot macOS)
2. Unmount APFS volumes automaticaly mounted by Recovery (where /dev/disk2 is your APFS container)
$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
3. Unlock APFS volumes (in case FileVault enabled for this volume)
$ diskutil apfs unlockVolume /dev/disk2s1 -nomount