Skip to content

Instantly share code, notes, and snippets.

View epanji's full-sized avatar

Panji Kusuma epanji

View GitHub Profile
[Script Info]
; Script generated by CLARAOKE v0.1.13 ( https://github.com/epanji/claraoke )
Title: Test
ScriptType: v4.00+
Collisions: Normal
PlayResX: 1280
PlayResY: 720
PlayDepth: 0
Timer: 100.0000
WrapStyle: 0
@epanji
epanji / clarafx-ext-diff-shell.txt
Created November 15, 2023 04:19
Shell to show different between clarafx without and with external effects
$ pwd
/tmp
$ cat clarafx.lisp
(define-effect (my-own-effect var)
(modifier 'fad :arg1 250 :arg2 0)
(modifier 'move
:arg1 (- (width var)) :arg2 (base-y1 var)
:arg3 (base-x1 var) :arg4 (base-y1 var)
:arg5 0 :arg6 300))
@epanji
epanji / experiment-continuation.lisp
Last active November 12, 2023 13:03
Experiment continuation with CL-CONT
(in-package :cl-user)
(asdf:load-system :cl-cont :silent t)
(use-package :cl-cont)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Continuation
;;;
(defun make-generator (input)
@epanji
epanji / experiment-continuation.scm
Last active November 9, 2023 16:20
Experiment continuation
(import (scheme base) (scheme write))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Continuation
;;;
(define-syntax let/cc
(syntax-rules ()
((_ name body ...)
(call/cc
@epanji
epanji / shell.txt
Last active August 4, 2023 04:32
Test time and corrections for SANVERTER. ( ptime is alias for /usr/bin/time -p )
~ » ptime sanverter -c -f vtt /tmp/bad-source.vtt ~
Success converting /tmp/bad-source.vtt to /tmp/bad-source-rev.vtt.
real 0.26
user 0.29
sys 0.01
~ » diff /tmp/bad-source.vtt /tmp/bad-source-rev.vtt ~
1a2,3
> Kind: captions
@epanji
epanji / sanverter-240p
Created July 27, 2023 08:31
Subtitle converter fo 240p videos.
#!/bin/sh
sanverter -prx 426 -pry 240 \
-fn 'DejaVu Sans' -fs 12 \
-ml 100 -mr 100 -mv 36 \
-b -1 -i -1 \
-f ass -e supersede $@
@epanji
epanji / backlight.sh
Last active July 21, 2023 09:12
Intel Backlight CLI
#!/bin/sh
#
# Author: Panji Kusuma <epanji at gmail dot com>
#
# Assume user already in video group
# Place these 3 lines in /etc/rc.d/rc.local and uncomment the lines
#
# echo 100 > /sys/class/backlight/intel_backlight/brightness
# chmod 664 /sys/class/backlight/intel_backlight/brightness
# chown root:video /sys/class/backlight/intel_backlight/brightness
@epanji
epanji / my-favorite-subtitle
Last active June 11, 2023 04:55
CLI to convert SRT/VTT file to ASS
#!/usr/bin/env -S sbcl --script
;;;;
;;;; Save this file to /usr/local/bin/my-favorite-subtitle
;;;;
;;;; Usage:
;;;; my-favorite-subtitle <file.srt|file.vtt>
;;;;
;;;; Debug:
;;;; DEBUG=1 my-favorite-subtitle <file.srt|file.vtt>
;;;;
@epanji
epanji / url2md
Created November 14, 2022 04:03
Convert html page with javascript content to markdown
#!/usr/bin/sbcl --script
;;;;
;;;; finalize-html-from-url
;;;; ======================
;;;;
;;;; #!/usr/bin/python3
;;;;
;;;; from selenium import webdriver
;;;; import time, sys
;;;;
@epanji
epanji / combine.lisp
Last active January 11, 2022 08:47
Combining events from subtitle
(load (merge-pathnames "Examples/mysub.lisp" (asdf:system-source-directory "claraoke")))
(in-package :claraoke-user)
(defparameter *mysub* (parse-script #p"/tmp/mysub.ass"))
(defparameter *fx1* (parse-script #p"/tmp/mysub.ass"))
(defparameter *fx2* (parse-script #p"/tmp/mysub.ass"))
(insert-style *mysub* (style "FX1" :fontname "DejaVu San" :alignment 5 :primary-colour (random-color) :back-colour "gray" :shadow 0 :outline 2 :italic -1))
(insert-style *mysub* (style "FX2" :fontname "DejaVu San" :alignment 2 :primary-colour "white" :fontsize 24))