Skip to content

Instantly share code, notes, and snippets.

@mes51
mes51 / unmult.anm
Last active January 10, 2021 14:59
UnMult的なスクリプト
obj.pixeloption("type", "rgb")
local w, h = obj.getpixel()
local inf = 1 / 0
for y = 0, h - 1 do
for x = 0, w - 1 do
local r, g, b, a = obj.getpixel(x, y)
if a < 255 then
@mes51
mes51 / fillPoly.lua
Last active September 25, 2020 15:31
Stormworksでアンチエイリアス付きの多角形を描画する関数
-- 交差判定は以下のコードを利用
-- https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule
-- 通常ver (x2 SS)
function fillPoly(ps, w, h, r, g, b, a)
a = a and a or 255
local left, top, right, bottom = w, h, 0, 0
for i = 1, #ps do
local v = ps[i]
left = math.min(math.max(math.floor(v.x), 0), left)
@mes51
mes51 / exportAEMarker.lua
Last active July 31, 2020 13:48
現在選択中のトラックのノートから、After Effects用のマーカー生成用jsxを作成する
TEXT_DIALOG_MESSAGE = "Please select target track"
TEXT_DIALOG_SELECT_TRACK = "Target track"
TEXT_DIALOG_TRACK_ALL = "All"
TEXT_DIALOG_TRACK_CURRENT = "Current editing track"
function split(inputstr, sep)
local t = {}
for field, s in string.gmatch(inputstr, "([^"..sep.."]*)("..sep.."?)") do
table.insert(t, field)
if s == "" then
@mes51
mes51 / ExportSample.cs
Last active September 27, 2018 16:56
Intervallo JsonLoader Format
class ExportSample
{
public static void Export(string filePath, double framePeriod, ScaleInterpolationType interpolationType, double[] scales)
{
var data = new ScaleData
{
FramePeriod = framePeriod,
InterpolationType = interpolationType,
Scales = scales
};
@mes51
mes51 / Main.java
Created January 4, 2017 09:41
FizzBuzz
class Main
{
public static void main (String[] args) throws java.lang.Throwable
{
if (new Main(100, "") == null) { }
}
Main(int n, String p) throws java.lang.Throwable {
if (n > 0 && new Main(n - 1, (n % 3 == 0 && n % 5 == 0 ? "FizzBuzz" : (n % 3 == 0 ? "Fizz" : (n % 5 == 0 ? "Buzz" : n))) + "\n" + p) != null) { }
else if (java.io.PrintStream.class.getMethod("println", String.class).invoke(System.out, p) == null) { }
@mes51
mes51 / TurtleCommandHelper.lua
Last active August 29, 2015 14:07
決まった処理をコマンドとして登録、それをRLEした文字列で書けるようにした何か
--[[
何:
決まった処理をコマンドとして登録、それをRLEした文字列で書けるようにした何か
Sample:
TurtleCommandHelper.registerCommand("p", function() print("command") end)
TurtleCommandHelper.registerSuffix("d", function(func, table)
for i = 1, rawget(table, "loop") do
print(rawget(table, "value"))
func()
end
eval ( o="o= 'e v al (o= % p. split*%p)'%[o,''];b=' a g
4a99 fh c5egi 1c 9 b9 804 1 53d ecc515ebeag9342gbd7e6 i6 4
15ad e8 afbbh1 dc4 a 70 a9e 8 67 3 02b5a0784318558gi8g69 1 2
1127 9 3f1957 46 0 2f3 ib1 0 h9 ad 3hf681b3bb6aad1d76bh g4 8
a7527 b6 chb8 3 79 9 a36 c32 f7g 3h 2g21de26986dh3693hg0 d f
a7ea 60 535g h b28 e 3f9 2hh c e73 ch h6ag3b0dfd12giec6b7 0 e
4953 e da44 b i5 gb 8c5f hi3 6 18 ih4 067047aa07
@mes51
mes51 / Program.cs
Created April 29, 2013 17:39
最長共通部分列問題
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ProgrammingContestChallenge.LongestCommonSubsequence
{
class CharInfo
@mes51
mes51 / Program.cs
Created April 29, 2013 08:43
区間スケジューリング問題
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProgrammingContestChallenge.IntervalScheduling
{
class Program
{
private const string S = "1 2 4 6 8";
@mes51
mes51 / Program.cs
Created April 29, 2013 06:33
最短経路探索
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProgrammingContestChallenge.Maze
{
class FootPrint
{
public FootPrint(int x, int y, FootPrint prev)