Skip to content

Instantly share code, notes, and snippets.

@Ruin0x11
Ruin0x11 / mpv-seq.sh
Last active March 22, 2019 19:48
play videos/episodes in sequential order
#!/bin/bash
# mpv-seq - Play files in a directory in order, starting from given file
# caveat: needs the filename as first argument, then arguments to pass to mpv
playlist=/var/tmp/.playlist
thisfile="$0"
qa="$1"
q=$(printf '%s\n' "$qa" | sed 's/[[\.*^$/]/\\&/g')
ext="${q##*.}"
@Ruin0x11
Ruin0x11 / niconico_dl.rb
Created May 12, 2016 03:16
download niconico video + comments
#!/usr/bin/env ruby
require 'niconico'
require 'streamio-ffmpeg'
require 'optparse'
require 'yaml'
# also requires danmaku2ass
VIDEO_URL = /https?:\/\/(?:www\.|secure\.)?nicovideo\.jp\/watch\/((?:[a-z])+?[0-9]+)/
count = 1000
@Ruin0x11
Ruin0x11 / vocalyric.rb
Created May 28, 2016 21:21
search 初音ミク@Wiki for lyrics
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'mechanize'
require 'nokogiri'
require 'logger'
class Vocalyric
def initialize
@agent = Mechanize.new
@agent.log = Logger.new "mech.log"
@Ruin0x11
Ruin0x11 / asound.conf.alsa
Created October 31, 2016 21:04
asound.conf
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
@Ruin0x11
Ruin0x11 / mpv-gif.lua
Last active March 26, 2024 01:01
Create animated GIFs using mpv
-- Create animated GIFs with mpv
-- Requires ffmpeg.
-- Adapted from http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
-- Usage: "g" to set start frame, "G" to set end frame, "Ctrl+g" to create.
local msg = require 'mp.msg'
-- Set this to the filters to pass into ffmpeg's -vf option.
-- filters="fps=24,scale=320:-1:flags=lanczos"
filters="fps=15,scale=540:-1:flags=lanczos"
@Ruin0x11
Ruin0x11 / mpv-jisho.lua
Created December 12, 2016 01:56
Lookup current subtitle text in Jisho.org
function lookup_jisho()
local text = mp.get_property("sub-text")
if text == "" then
return
end
mp.set_property("pause", "yes")
os.execute("open \"http://jisho.org/search/" .. text .. "\"")
end
mp.add_key_binding("Ctrl+j", "lookup_jisho", lookup_jisho)
@Ruin0x11
Ruin0x11 / .config
Created March 9, 2017 03:41
crux config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.9.6 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@Ruin0x11
Ruin0x11 / hlua_userdata.rs
Last active September 6, 2017 10:06
Reading back lua userdata by copy with hlua
#[macro_use] extern crate hlua;
mod point;
use std::fmt::{self, Display};
use hlua::Lua;
use point::Point;
@Ruin0x11
Ruin0x11 / organize_samples.rb
Created October 1, 2017 18:10
Organize sound samples quickly
# Requires mpv.
require "optparse"
require "find"
require "pathname"
require "ostruct"
require "fileutils"
require "io/console"
def is_num?(str)
local Event = Elona.require("Event")
local Enums = Elona.require("Enums")
local Item = Elona.require("Item")
local Chara = Elona.require("Chara")
local GUI = Elona.require("GUI")
local table = Elona.require("table")
local potions = {736, 711, 706, 626, 577, 566, 559, 519, 433, 432,
429, 382, 379, 376, 375, 372, 370, 368, 364, 287, 286, 285, 262, 76,
75, 74, 72, 71, 70, 69, 68, 30, 29, 28, 27}