Skip to content

Instantly share code, notes, and snippets.

-------------------- DMS Header --------------------
magic - always "PortalSequenceData"
int_u32 - size of uncompressed data
raw - Compressed data (zlib)
-------------------- DMP Header --------------------
magic - always "PortalPartData"
int_u32 - size of uncompressed data
class mc_song:
def __init__(self):
self.general = None
self.section = None
self.track = None
self.instrument = None
self.drum_kit = None
self.sound_font = None
self.section_order = None
@SatyrDiamond
SatyrDiamond / gist:6bd7102ee5c4b258827eb120437c35bf
Last active May 15, 2024 16:15
using libOpenMPT from python
import ctypes
openmpt_log_func = ctypes.CFUNCTYPE(
None, ctypes.c_void_p, ctypes.c_int, ctypes.c_char_p
)
openmpt_error_func = ctypes.CFUNCTYPE(
None, ctypes.c_void_p, ctypes.c_int, ctypes.c_char_p
)
@SatyrDiamond
SatyrDiamond / gist:1722e7fc2e036ff351cae04d7182148f
Last active February 26, 2024 00:36
Python: Slotted Dict
class slotted_dict:
__slots__ = ['names', 'data']
def __init__(self, names):
self.names = names
self.data = [0]+[None for _ in names]
def __setitem__(self, k, v):
if k in self.names:
i = self.names.index(k)
@SatyrDiamond
SatyrDiamond / .bashrc
Last active December 15, 2022 00:04
bash cmd
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=0
HISTFILESIZE=0
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;33:note=01;32:caret=01;34:locus=01:quote=01'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
@SatyrDiamond
SatyrDiamond / plugin_architecture.md
Created August 28, 2022 23:39 — forked from dorneanu/plugin_architecture.md
Python: Implement basic plugin architecture with Python and importlib

Implementing a basic plugin architecture shouldn't be a complicated task. The solution described here is working but you still have to import every plugin (inheriting from the base class).

This is my solution:

Basic project structure

$ tree