Skip to content

Instantly share code, notes, and snippets.

@selsta
selsta / irc_to_markdown.js
Last active June 7, 2018 22:16 — forked from WebReflection/irc.js
Transform IRC logs into Markdown (for Monero)
#!/usr/bin/env node
// Usage: ./irc_to_markdown.js log.txt > log.md
// Still needs manuell edits afterwards.
require('fs').readFile(process.argv[2], (err, data) => {
if (err) return;
const content = data.toString().trim();
const re = /^\[(.+?)\]\s+<(.+?)>\s(.*)$/gm;
const chat = [];
let current = {};
@selsta
selsta / vo_battery.lua
Last active October 7, 2018 13:12
Choose the VO based on if the laptop is plugged in or not. (OS X)
-- If the laptop is on battery, the VO set in the config will be choosen,
-- else the one defined with „hqvo“ is used.
local hqvo = "opengl-hq:gamma-auto"
local utils = require 'mp.utils'
if mp.get_property_bool("option-info/vo/set-from-commandline") == true then
return
end
t = {}
t.args = {"/usr/bin/pmset", "-g", "ac"}
res = utils.subprocess(t)
@selsta
selsta / ls_hook.lua
Last active August 29, 2015 14:20 — forked from chrippa/ls_hook.lua
Livestreamer hook for mpv. Made by ChrisK3 and chrippa.
local utils = require 'mp.utils'
local msg = require 'mp.msg'
local ls = {
path = "livestreamer",
}
mp.add_hook("on_load", 11, function()
if mp.get_property_bool("options/ytdl") then
@selsta
selsta / autosub.lua
Last active October 8, 2023 11:28
Automatically download subtitles in mpv using subliminal.
-- requires subliminal, version 1.0 or newer
-- default keybinding: b
-- add the following to your input.conf to change the default keybinding:
-- keyname script_binding auto_load_subs
local utils = require 'mp.utils'
function load_sub_fn()
subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path
mp.msg.info("Searching subtitle")
mp.osd_message("Searching subtitle")
t = {}