Skip to content

Instantly share code, notes, and snippets.

@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")
@nilninull
nilninull / run-help-pw-jack
Created April 3, 2022 11:49
run-help assistant for pw-jack
if [ $# -eq 0 ]; then
man pw-jack
else
man $1
fi
@nilninull
nilninull / _pw-jack
Created April 3, 2022 11:46
pw-jack completion definition for Zsh
#compdef pw-jack
setopt localoptions extended_glob
local environ e cmd
local -a args
local -a _comp_priv_prefix
zstyle -a ":completion:${curcontext}:" environ environ
@nilninull
nilninull / switch-gpu-context.lua
Last active March 13, 2019 17:32
Automatically switch gpu-context on wayland.
-- Save this file in ~/.config/mpv/scripts/
if os.getenv('WAYLAND_DISPLAY') then
mp.set_property('gpu-context', 'wayland')
end
@nilninull
nilninull / turn-off-dpms.lua
Last active March 6, 2023 13:35
A mpv script for turn off dpms while playing video automatically
-- save this file to $XDG_CONFIG_HOME/mpv/scripts/
local dpms_mod = nil
-- local function dpms_mod_start(event)
-- print("RUN dpms mod start", dpms_mod)
-- if dpms_mod == nil then
-- -- This code was checked on xset 1.2.3
-- if os.execute("[ `xset q | sed -n '/^DPMS/,${/^ DPMS/s/^ DPMS is //p}'` == Enabled ]") == 0 then
-- dpms_mod = true
@nilninull
nilninull / multi-click-keys.scm
Last active June 18, 2023 23:36
A function for add a multi-click feature to xbindkeys
(use-modules (srfi srfi-19))
;; 100000000 nano seconds -> 0.1s
;; 200000000 nano seconds -> 0.2s
;; 300000000 nano seconds -> 0.3s
;; 400000000 nano seconds -> 0.4s
;; 500000000 nano seconds -> 0.5s
;; 1000000000 nano seconds -> 1s
;; This value is used for judge `clicking are continuously or not'
diff -u -ru ladspa-bs2b-0.9.1.orig/src/plugin.c ladspa-bs2b-0.9.1/src/plugin.c
--- ladspa-bs2b-0.9.1.orig/src/plugin.c 2009-06-05 03:44:25.000000000 +0900
+++ ladspa-bs2b-0.9.1/src/plugin.c 2016-04-01 15:28:18.282931019 +0900
@@ -89,13 +89,13 @@
LADSPA_Handle
instantiateBs2bLine(const LADSPA_Descriptor * Descriptor,
unsigned long SampleRate) {
- Bs2bLine * psBs2bLine = (Bs2bLine *)malloc(sizeof(Bs2bLine));
- if (psBs2bLine == NULL) {
+ /* Sample rate supported? */