Skip to content

Instantly share code, notes, and snippets.

View MegaLoler's full-sized avatar

Aardbei MegaLoler

View GitHub Profile
@MegaLoler
MegaLoler / pedal_reverse.py
Last active October 22, 2021 20:28
jack midi python script 2 invert midi pedal messages !!!!! (on -> off, off -> on)
#!/usr/bin/env python3
"""JACK client that inverts pedal mapping."""
import jack
import struct
import threading
client = jack.Client("invert pedal")
port_input = client.midi_inports.register("input")
@MegaLoler
MegaLoler / mov2mid.py
Last active March 6, 2021 19:36
convert quick time music movies into midi files!
#!/usr/bin/env python3
# convert quicktime music movie into midi file
from __future__ import annotations
from collections import namedtuple
from abc import ABC
import itertools
@MegaLoler
MegaLoler / macbinary2extract.py
Created February 27, 2021 00:55
Extract the data and resource forks from a MacBinary II file
#!/usr/bin/env python3
# extract the data and resource forks from a mac binary 2 file
import sys
import struct
def unpack(stream, fmt):
size = struct.calcsize(fmt)
buf = stream.read(size)
@MegaLoler
MegaLoler / parser.py
Created September 18, 2020 12:46
assignment #2: set up node structures for parsing
#!/bin/env python3
# assignment #1: create a tokenizer that can read basic variables, operators, numbers, and parenthesis
# assignment #2: set up node structures for parsing
from dataclasses import dataclass
import io
import re
@dataclass
@MegaLoler
MegaLoler / tokenizer.py
Created September 12, 2020 14:00
assignment: create a tokenizer that can read basic variables, operators, numbers, and parenthesis
#!/bin/env python3
# create a tokenizer that can read basic variables, operators, numbers, and parenthesis
from dataclasses import dataclass
import io
import re
@dataclass
class Token:
@MegaLoler
MegaLoler / decode.c
Last active June 14, 2022 21:29
my random chocobo mystery dungeon psx romhacking scripts
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define COLOR 5
#define OFFSET (256*128)
#define WIDTH 256
@MegaLoler
MegaLoler / trumpet.py
Created May 26, 2020 03:55
trumpet physical model (???)
#!/usr/bin/env python3
import numpy as np
import math
import sys
speed_of_sound = 34300 # centimeters/second
rate = 24000 # samples/second
# seconds to render
@MegaLoler
MegaLoler / matchups.py
Created December 22, 2019 20:36
simple script to help determine rankings by comparing combinations
#!/usr/bin/env python3
# simple script to help determine rankings by comparing combinations
import sys
from itertools import combinations
with open(sys.argv[1]) as f:
items = list(line.strip() for line in f.readlines())
scores = {item: 0 for item in items}
@MegaLoler
MegaLoler / separate.py
Created November 26, 2019 21:03
script to help a bit with sending my big discord messages lol
#!/usr/bin/env python3
# read in a text file, split it into paragraphs that fit under 2000 characters, add a invisible separator to the end of each except the last, and copy each sequentially and interactively to the clipboard
import pyperclip
import sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print('plese specify tha name o th file as argument to this progrm 2 copythanxx')
@MegaLoler
MegaLoler / wild-world-hourly-music.sh
Created November 2, 2019 17:02
Play Animal Crossing Wild World hourly music continuously according to the hour like in the game
#!/usr/bin/env bash
# plays hourly animal crossing wild world music in the background!
# uses audacious to play 2sf rips
# thus it depends on the 2sf music files and audacious
# place the .mini2sf files in the following directory and name the hourly music files with this format: "%H.mini2sf", e.g. "00.mini2sf" (midnight), "04.mini2sf" (4 am), "10.mini2sf" (10 am), "12.mini2sf" (noon), "13.mini2sf" (1 pm), "23.mini2sf" (11 pm), etc.
MUSIC_DIR=~/hourly # set to the directory containing the 2sf files