Skip to content

Instantly share code, notes, and snippets.

View torque's full-sized avatar

T torque

View GitHub Profile
@torque
torque / instructions.md
Last active December 6, 2020 01:32
mpv url-overlay example.

Instructions

  1. clone this gist: git clone https://gist.github.com/5af90be72b98bce36a3e.git mpv-url-overlay-example
  2. copy (or symlink) url-overlay.lua to your mpv scripts directory (~/.config/mpv/scripts or ~/.mpv/scripts)
  3. mpv --no-osc url-overlay-example.mkv
  4. Hold tab to highlight all on-screen urls. If you already use tab for something, bind some key to the command mp_url_overlay_show.
  5. Click urls to launch them. On Linux xdg-open is required. Will not work if you have MOUSE_BTN0 bound to another command.
convertClipToFP = ( clip ) ->
-- only muck around with vector clips (convert scaling factor into floating point coordinates).
unless clip\match "[%-%d%.]+, *[%-%d%.]+"
-- Convert clip with scale into floating point coordinates.
clip = clip\gsub "%((%d*),?(.-)%)", ( scaleFactor, points ) ->
if scaleFactor ~= ""
scaleFactor = tonumber scaleFactor
points = points\gsub "([%.%d%-]+) ([%.%d%-]+)", ( x, y ) ->
x = Math.round tonumber( x )/(2^(scaleFactor - 1)), 2
// clang++ BadTimer.cpp -fPIC -shared -O3 -std=c++11 -o BadTimer.dylib
#include <chrono>
class BadTimer {
private:
std::chrono::high_resolution_clock::time_point startTime;
std::chrono::high_resolution_clock::time_point endTime;
std::chrono::duration<double> timeSpan;
public:
BadTimer( void );
inspectorExample = ( sub, sel, act ) ->
dialogStart = -1
for i = 1, #sub
if 'dialogue' == sub[i].class
dialogStart = i
break
if -1 == dialogStart
log.windowError( "This script does not appear to have any dialogue lines." )
fuckWindows = ( logString ) ->
ffi.cdef [[int WideCharToMultiByte( unsigned int, unsigned int, const char*, int, char*, int, void*, void* );]]
CP_UTF8 = 65001
logLength = math.ceil #logString/2
buffSize = 1 + ffi.C.WideCharToMultiByte CP_UTF8, 0, logString, logLength, nil, 0, nil, nil
if 0 == buffSize
error "Shit's fucked i aint helping."
utf8String = ffi.new "char[?]", buffSize
status = ffi.C.WideCharToMultiByte CP_UTF8, 0, logString, logLength, utf8String, buffSize, nil, nil
#!/usr/bin/env python3
import os, sys
import vapoursynth as vs
def progress( current_frame, total_frames ):
print( "\rProgress: {0}/{1}".format( current_frame, total_frames ), file=sys.stderr, end='' )
core = vs.get_core( )
diff -r 514640c6cbd8 Makefile
--- a/Makefile Sat Apr 12 16:59:09 2014 -0700
+++ b/Makefile Mon Apr 14 23:35:03 2014 -0700
@@ -2,13 +2,19 @@
# Override the default compiler with `make CXX=g++` or so
# Build on *nix with `make EXE=`
WARNINGS := -pedantic -Wall
+CC := clang
CXX := clang++
-CXXFLAGS := $(WARNINGS) -std=c++11
diff --git a/wscript b/wscript
index 0ef4fc3..b5db61a 100644
--- a/wscript
+++ b/wscript
@@ -71,13 +71,13 @@ def configure_gcc(conf):
add_options(["CFLAGS", "CXXFLAGS"],
["-fPIC", "-Wall", "-Wextra", "-Wno-unused-parameter",
"-fvisibility=hidden", "-fvisibility-inlines-hidden",
- "-Werror", "-std=c++11"])
+ "-std=c++11"])
@torque
torque / aae-export.py
Last active August 17, 2020 15:24
Python script for exporting AAE formatted motion tracking data from Blender. Written by lachs0r.
# Copyright (c) 2013, Martin Herkt
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@torque
torque / stripiT.rb
Last active April 28, 2024 02:22
Script to strip various iTunes atoms from purchased AAC files via AtomicParsley.
#!/usr/bin/env ruby
# usage: stripiT.rb file1.m4a file2.m4a file3.m4a
# automatically outputs to file1 - stripped.m4a, file2 - stripped.m4a, and so on.
# Script to remove extraneous/unwanted atoms from iTunes purchased files by way of AtomicParsley.
# Output should be comparable to the atoms left over after reencoding the file in iTunes itself.
# I only care about songs, so I have no clue how well this applies to video files
# Some information taken from: https://code.google.com/p/mp4v2/wiki/iTunesMetadata