This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------- | |
--- main.lua v0.2 | |
------------------------------------------------------------------------------- | |
local main = { | |
_VERSION = '0.2', | |
} | |
local arg, os, package, love, jit = arg, os, package, love, jit | |
local assert, pcall, require, tonumber, setmetatable, print = | |
assert, pcall, require, tonumber, setmetatable, print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Small and simple bash script that reencode video into 720p (any orientation). | |
# Required ffmpeg binary on OS's $PATH (on Windows %PATH%) or current working directory. | |
# | |
# You can run this on Windows under a POSIX subsystem (MSYS2, CygWin, Bash from Git for Windows) | |
# | |
# Usage: | |
# 720pify.sh ../video1.mp4 somedir/video2.mp4 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---@alias entity {} # also known as character/object/thing (unique) | |
---@aliss component.area { width: number, height: number } # a 2d object component, also known as size | |
---The component constructor/giver/assembler, I don't know, I don't really know. | |
---@type table<entity, component.area>|fun(width?: number, height?: number): c: component | |
return setmetatable({}, { | |
-- stored as weak reference | |
__mode = 'kv', | |
---@param list table<entity, component.size> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---Replaces %1, %2 and so on in the passed string of the passed arguments. | |
---@param str string # The string pattern contains %1 to %9. | |
---@param ... any # Any types will be passed to tostring. | |
---@return string str # New formated replaced string. | |
---@return integer count # Number of operations. | |
local stringformat = function(str, ...) | |
local tostring, select, gsub, t = tostring, select, string.gsub, {} | |
for i = 1, select('#', ...) do | |
t[tostring(i)] = tostring(select(i, ...)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcall(require,"socket") | |
Scheduler = setmetatable({}, { | |
__call = function(class) | |
return setmetatable({ | |
threads = {}, | |
}, class) | |
end | |
}) | |
Scheduler.__index = Scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:8080 | |
# Points root onto remote's current working directory (as `caddy run` executed) | |
root * {os.Getwd} | |
# WebDAV access, requires custom Caddy build. | |
#@notget not method GET | |
#route @notget { | |
# webdav | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO off | |
@SET PATH=%~dp0vendor\love-11.4-win32;%PATH% | |
@SET PATH=%~dp0vendor\love-11.4-win64;%PATH% | |
@love %~dp0game.love %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Taken from http://zulko.github.io/blog/2015/02/01/extracting-perfectly-looping-gifs-from-videos-with-python-and-moviepy/ | |
import os | |
import sys | |
import moviepy.editor as mp | |
from moviepy.video.tools.cuts import FramesMatches | |
# Extends FramesMatches, the code is copied from source file then modified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to convert MP4 video to GIF with generation of custom color palette. | |
# | |
#=== Do not touch code below | |
# Inner variables | |
input_file="" | |
input_fps="" | |
input_height="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Based on this: http://lua-users.org/wiki/LuaModulesLoader | |
module(..., package.seeall) | |
local function loader(modulename) | |
local errmsg = "" | |
local modulepath = string.gsub(modulename, "%.", "/") | |
local dirname = modulepath:match("(.*[/\\])") | |
local basename = modulepath:match("^.+/(.+)$") | |
for path in string.gmatch(package.path, "([^;]+)") do | |
local filename = string.gsub(path, "%?", table.concat({dirname, basename, "/", basename})) |
NewerOlder