Skip to content

Instantly share code, notes, and snippets.

View Krazete's full-sized avatar
💭
Perpetually behind on every project.

Ted Michael Celis Krazete

💭
Perpetually behind on every project.
View GitHub Profile
@Krazete
Krazete / autolutopiano.js
Last active September 7, 2021 00:05
Load a song to automatically play in https://luto-piano.web.app/.
function keypress(key, press, t) {
document.dispatchEvent(new KeyboardEvent(press ? "keydown" : "keyup", {key: key}));
}
function keyplay(key, time, duration) {
setTimeout(e => keypress(key, 1, time), time);
setTimeout(e => keypress(key, 0, time), time + duration);
}
var keylist = [
@Krazete
Krazete / guraquestcontroller.js
Last active August 11, 2021 03:52
Enable game controllers for GuraQuest.
// Instructions
// 1. Go to https://www.newgrounds.com/portal/view/809045 or https://lee-pic.itch.io/guraquest.
// 2. Click "Play Game" or "Run Game".
// 3. Open your browser's console.
// 4. Change JS context from "top" to "uploads.ungrounded.net" or "index.html" (Chrome)
// or from "Auto" to "game_drop" (Safari).
// 5. Copy and paste the code below into the console and press Enter.
var gamepadListener;
@Krazete
Krazete / create_sprite.py
Last active February 26, 2024 02:06
SGM Palettized Image Creator
import argparse
from PIL import Image, ImageChops, ImageMath
def create_sprite(name, width=-1, differentiator='RGB', fallback=False):
'''
Generates a palettized image from input images in the same folder.
The inputs can be: raw image, base colors, color map, and detail layer
or: shadows, highlights, color map, and detail layer.
Parameters:
- name
@Krazete
Krazete / genBash.js
Created April 25, 2021 22:34
Download an MP4 file from a master.json's list of M4S files.
function genBash(masterURL) {
var xhr = new XMLHttpRequest();
xhr.open("GET", masterURL, true);
xhr.addEventListener("load", function () {
var master = JSON.parse(this.responseText);
var baseURL = new URL(master.base_url, masterURL);
function genBashLines(mp4, type) {
var mp4BaseURL = new URL(mp4.base_url, baseURL);
var segmentURLs = mp4.segments.map(segment => segment.url);
@Krazete
Krazete / autosandy.js
Created February 12, 2021 22:09
Automate the github.com/krazete/sandy web app.
function nextGame() {
setTimeout(changeMode, 1000);
setTimeout(startGame, 2000);
setTimeout(pair, 6250);
}
function pair() {
var currentMatches = matches;
for (var i = 0; i < currentBoard.size; i++) {
@Krazete
Krazete / vrank.py
Last active October 23, 2020 06:09
Webscrape the VTuber Rankings List
import bs4 as bs
import urllib.request
import json
vrank = {}
def processRankingPage(i, redos=1): # 1 page ~ 1.5 minutes
url = 'https://virtual-youtuber.userlocal.jp/document/ranking?page={}'.format(i + 1)
try:
html = urllib.request.urlopen(url).read()
@Krazete
Krazete / jsscrub.js
Last active February 20, 2021 04:25
Add Scrubbing Functionality to all Number Inputs
function convertToScrubber(input) {
var i0 = 0;
var x0 = 0;
var style = document.createElement("style");
function nonNaN(n) {
var m = Number(n);
if (isNaN(m)) {
m = 0;
}
@Krazete
Krazete / com.autumn.skullgirls.cfg
Last active September 28, 2023 01:05
Bluestacks Keymapping for Skullgirls Mobile
{
"MetaData" : {
"KeyboardLayout" : "United States",
"ParserVersion" : "13"
},
"Primitives" : [
{
"$type" : "Dpad, Bluestacks",
"ActivationSpeed" : 0,
"ActivationTime" : 0,
@Krazete
Krazete / force_controls.js
Created April 9, 2019 07:34
Force-Enable Video Controls
function forceControls () {
Array.from(document.getElementsByTagName("video")).forEach(video => {
video.setAttribute("controls", "true");
video.style.zIndex = "9999";
});
requestAnimationFrame(forceControls);
}
forceControls();
@Krazete
Krazete / pixiv_download.js
Last active November 17, 2018 21:46
Download Pixiv Canvas-Based Animated Images and Generate its Sprite Sheet
var xhr = new XMLHttpRequest();
xhr.open("GET", pixiv.context.ugokuIllustData.src, true);
xhr.responseType = "blob";
xhr.onload = function() {
var blob = this.response;
var a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.setAttribute("download", "compressed.zip");
a.click();
console.log(blob);