Skip to content

Instantly share code, notes, and snippets.

View Bentroen's full-sized avatar

Bernardo Costa Bentroen

View GitHub Profile
@Bentroen
Bentroen / convert.py
Created September 10, 2023 06:44
ENA Refactor | Object variations register
import json
rotations = [0, 180, 90, 270]
rotations_goals = [0, 270, 90, 180]
rotations_player = [0, 180, 90, 270]
with open("tiles.json", "r", encoding="utf-8") as f:
tiles = json.load(f)["data"]
@Bentroen
Bentroen / megacollab_merger.py
Last active October 7, 2022 09:36
Script used to merge two very large .nbs files for the first Note Block Megacollab, totaling over 250,000 notes.
import copy
import pynbs
import shutil
import os
file1 = "megacollab parts 1-28.nbs"
file2 = "megacollab parts 29-50.nbs"
output_file = "megacollab_merged.nbs"
@Bentroen
Bentroen / pydub_mixer.py
Last active September 2, 2021 20:55 — forked from jiaaro/pydub_mixer.py
from pydub import AudioSegment
import numpy as np
class Mixer:
def __init__(self):
self.parts = []
def __len__(self):
parts = self._sync()
seg = parts[0][1]
@Bentroen
Bentroen / async.py
Created February 10, 2021 20:33 — forked from phizaz/async.py
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
'''
turns a sync function to async function using threads
'''
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()
@Bentroen
Bentroen / pca_model_deanimator.py
Last active August 9, 2018 07:23
#PokeCA Model De-animator | Extract frames from animated Pokémon
########################################################################################
# #PokeCA Model De-animator by Bentroen #
########################################################################################
# #
# Usage instrucions: point 'input_path' to a folder containing the 'models' and #
# 'textures' folders from the original map's resource pack. The script will #
# fetch the correct model according to 'model_list', and export the following #
# to 'output_path': every frame to 'models/all_frames/', every first frame to #
# 'models/' and first frame of textures to 'textures/'. If the texture itself #
# is animated (changes from frame to frame, e.g. Ternion's blue fire), only #
import json
import os
import shutil
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# Change this to the version you want to extract the assets from
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
version = "1.12-af"
minecraft_path = os.getenv('APPDATA') + r"\.minecraft\assets"
@Bentroen
Bentroen / mc_sounds_generator.py
Last active February 19, 2018 04:11
Minecraft sounds.json generator
import os
import re
import sys
print("=================================")
print("sounds.json generator by Bentroen")
print("=================================\n")