Skip to content

Instantly share code, notes, and snippets.

@wareya
wareya / texthook.js
Last active Jul 18, 2020
subtitle text grabbing script for mpv
View texthook.js
"use strict";
function on_new_sub(name, text)
{
if(text == null || text == "")
return;
var newtext = "";
for(var i = 0; i < text.length; i += 1)
{
var c = text[i];
View gist:cefad42fdbc23afbc1666c2e71c9e6ba
textractor 4.12.3 with translation plugins removed and pointless plugins disabled:
https://mega.nz/file/IQVk2CyK#SGnxbyF3aNUh22XyLoIUZaR7aMZDKdpWIgZLh0MlIZM
You need both the x86 and x64 subfolders. The x86 version is for 32-bit games, the x64 version is for 64-bit games.
If it throws a VCRUNTIME dll error on launch, you need to install these vcredists: https://github.com/Artikash/Textractor/releases/download/v4.12.3/vcredist-x86.exe https://github.com/Artikash/Textractor/releases/download/v4.12.3/vcredist-x64.exe
has textractor updated since 4.12.3? check for yourself:
https://github.com/Artikash/Textractor/releases
if it has updated since 4.12.3, download the latest version, and DISABLE EVERY EXTENSION (with the "delete" key)
View refactoring.rs
////before
pub (crate) fn sim_BINOP(&mut self) -> StepResult
{
if self.stack_len() < 2
{
return Err(Some(format!("internal error: BINOP instruction requires 2 values on the stack but found {}", self.stack_len())));
}
let immediate = self.pull_single_from_code()?;
@wareya
wareya / ism2.cpp
Created Dec 13, 2018
Very primitive ism2 -> wavefront obj converter. Only works with a limited subset of ism2 files, e.g. fairy fencer f advent dark force's maps.
View ism2.cpp
// Very primitive ISM2 -> .obj converter.
// Only works well enough to dump FFF:ADF's map files with enough information to log where hidden treasures are located.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <vector>
#include <unordered_map>
@wareya
wareya / regression.rs
Last active Sep 24, 2018
unoptimized multiple regression in rust
View regression.rs
use std::vec::Vec;
use std::fs::File;
use std::io::Read;
use std::result::Result;
fn get_data() -> Result<Vec<Vec<f64>>, std::io::Error>
{
let mut file = File::open("info.txt")?;
let mut text = String::new();
file.read_to_string(&mut text)?;
View process_shinjirin.py
#!python
# -*- coding: utf-8 -*-
from collections import OrderedDict
import json
import sys
from io import open
import re
entries = json.load(open("zero-shinjirin.json", encoding="utf-8"), object_pairs_hook=OrderedDict)
@wareya
wareya / dump.py
Created May 30, 2018
kanjivg -> json, images (no stroke order/groups)
View dump.py
#!python
mypath = "M26.75,23.5c1.48-0.24,3.35-0.52,5.49-0.84C46.03,20.62,63,17.75,74,17.25c4-0.18,6.09,0.97,5.5,4.75C76.25,42.75,77.25,71.75,92,87.75c6.95,7.54,5.75,1,6-5.5"
commands = "MmZzLlHhVvCcSsQqTtAaBb";
rules = [
["comma", r"^(,)(.*)"],
["number", r"^([+\-]?(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+))(.*)"],
@wareya
wareya / bezier.html
Created May 30, 2018
complex canvas bezier drawing example
View bezier.html
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="436" height="436" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
// from kanjivg, see kanjivg's license
@wareya
wareya / keep me off reddit.js
Last active Jun 5, 2018
greasemonkey script that keeps me off reddit
View keep me off reddit.js
// ==UserScript==
// @name Block Reddit
// @version 1
// @grant none
// @include http://*.reddit.com/*
// @include https://*.reddit.com/*
// @run-at document-start
// ==/UserScript==
async function delete_page()
@wareya
wareya / rijndael.py
Created May 13, 2018
from the comments on https://gist.github.com/jeetsukumaran/1291836 edited to use lists instead of strings
View rijndael.py
# from the comments on https://gist.github.com/jeetsukumaran/1291836 edited to use lists instead of strings
import copy
class Rijndael(object):
@classmethod
def create(cls):
if hasattr(cls, "RIJNDAEL_CREATED"):
return
# [keysize][block_size]