Skip to content

Instantly share code, notes, and snippets.

View torque's full-sized avatar

T torque

View GitHub Profile
-- split all selected lines at \N
function argh(sub,sel)
for i = #sel,1,-1 do
local v = sel[i]
local line = sub[v]
line.text = line.text:gsub("\\[Nn]",string.char(6))
for a in line.text:reverse():gfind(("[^%s]+"):format(string.char(6))) do
line.text = a:reverse()
sub.insert(v+1,line)
#!/usr/bin/env python3
import os,sys
import vapoursynth as vs
core = vs.Core()
plugin_dir = "/usr/local/lib/"
core.std.LoadPlugin("{}libffms2.2.dylib".format(plugin_dir))
core.std.LoadPlugin("{}libscxvid.dylib".format(plugin_dir))
function HURR(sub,sel,act)
for x = 1,#sub do
local line = sub[x]
if line.class == "dialogue" then
if line.text:match("^{.-\\i1.-}") and line.text:match("{.-\\i0?.-}$") then
line.text = line.text:gsub("{\\i[01]?}","")
line.text = line.text:gsub("^({.-)\\i1(.-})","%1%2")
line.text = line.text:gsub("({.-)\\i0?(.-})$","%1%2")
line.style = line.style.." italic"
sub[x] = line
@torque
torque / gist:3495682
Created August 28, 2012 06:57
Koi Kaze batch fixes
Fonts:
- Adjust glyph spacing for Artifika
- Fix egregious overuse of Comfortaa
All:
- Make OP/ED timing consistent
01-04:
- Append Chidori's Judgement to main episode.
05:
- Actually draw scribbles over scribbled out text for typesetting.
[
{ "loc":"d-r.bots.json", "type":"botlist" },
{ "loc":"d-r.packlist.json", "type":"packlist" }
]
@torque
torque / kkmux.rb
Created June 28, 2012 05:08
Matroska mux script for Koi Kaze
#!/usr/bin/env ruby
# Usage: ./mux.rb 1 "Spring Breeze" rel
require 'zlib'
require 'fileutils'
epnum = "%02d" % ARGV[0].to_i;
epraw = File.expand_path((Dir["Koi_Kaze_-_Ep#{epnum}_10bit_Raw*.mkv"])[0]) # Get the raw for the main episode
chiraw = File.expand_path((Dir["Koi_Kaze_-_Ex#{epnum}_10bit_Raw*.mkv"])[0]) # Get the raw for Chidori
chapters = File.expand_path("Chapters/Koi Kaze #{epnum}.xml")
fonts = Dir['fonts/*.ttf','fonts/*.otf'] # j-j-j-jam all of the fonts in
gui = {
xlabel = { class = "label"; label = "x scale factor"; x = 0; y = 0; height = 1; width = 1;},
ylabel = { class = "label"; label = "y scale factor"; x = 0; y = 1; height = 1; width = 1;},
xsclf = { class = "floatedit"; name = "xsclf"; value = 1; x = 1; y = 0; height = 1; width = 1;},
ysclf = { class = "floatedit"; name = "ysclf"; value = 1; x = 1; y = 1; height = 1; width = 1;},
}
function drawgui(sub,sel)
local b,c = aegisub.dialog.display(gui)
scale(sub,sel,c)
@torque
torque / fontforge.bat
Created May 5, 2012 07:33
batch file for launching FontForge on windows
:: Slightly modified fontforge.bat from this fine fellow's (http://www.geocities.jp/meir000/fontforge/) cygwin fontforge builds
:: Mostly fixes opening fonts to work with multiple fonts, even ones with spaces in their paths.
@echo on
set PATH=%~dp0cygwin\bin;%PATH%
set CYGWIN=nodosfilewarning
set HOME=%~dp0
set DISPLAY=:9.0
set AUTOTRACE=potrace
@torque
torque / gist:2361721
Created April 11, 2012 19:28
fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Font directory list -->
<dir>C:\fonts\</dir>
<!--
Accept deprecated 'mono' alias, replacing it with 'monospace'
@torque
torque / bd batch notes
Created September 25, 2011 05:33 — forked from komori/bd batch notes
uguu~ Working BD batch notes
Episode 1:
-Matroska header title
-Add italic font
-Add all fonts to 1080p
-Episode 1 -> Item 1 at the beginning
-Title top and bottom
-Next: Item 1
-Kerning: yes
Episode 2: