Skip to content

Instantly share code, notes, and snippets.

@vmedea
vmedea / stream.py
Created March 23, 2024 09:33
Print and colorize "dream stream" from dreams-of-an-electric-mind.webflow.io into the active terminal.
#!/usr/bin/env python3
# Mara Huldra 2024
# SPDX-License-Identifier: MIT
'''
Print and colorize "dream stream" from dreams-of-an-electric-mind.webflow.io into the active terminal.
'''
import argparse
import datetime
from html.parser import HTMLParser
import os
@vmedea
vmedea / FoxNav.gd
Created May 30, 2023 17:08
AStar2D+physics based navigation for Godot 4
# Physics-collision-based navigation grid, a quick and simple alternative for navigation polygons.
# Part of "Xenomusa" (C) Mara Huldra 2022
# SPDX-License-Identifier: MIT
extends Node2D
@export var tilemap: TileMap
@export var excludes: Array[CollisionObject2D]
@export_flags_2d_physics var nav_physics_layers: int = 1
var update_nav_grid: bool = false
@vmedea
vmedea / ScreenshotHandler.gd
Last active May 22, 2023 15:35
Godot 4 screenshot handler
# Godot screenshot handler.
# Part of "Xenomusa" (C) Mara Huldra 2022-2023
# SPDX-License-Identifier: MIT
#
# To configure in project settings:
# - Add script as autoload.
# - Assign a key (say, F12) to action "screenshot".
extends Node
# Screenshot target setup.
@vmedea
vmedea / RexPaint.gd
Last active January 21, 2023 12:25
Rexpaint .xp loader, updated for Godot 4
# Rexpaint .xp loader, updated for Godot 4.
# Part of "Xenomusa" (C) Mara Huldra 2022
# Based on rex-is-godot by RisingThumb.
# SPDX-License-Identifier: MIT
extends Object # DO NOT INSTANTIATE
class_name RexPaint
## Offset into image pixel for glyph.
const OFS_GLYPH := 0
## Offset into image pixel for foreground color.
@vmedea
vmedea / tileset_templater.gd
Last active December 5, 2022 23:23
Godot tile data instancing plugin for consistent tile configurations
# Tile data instancing plugin for consistent tile configurations.
# Part of "Xenomusa" (C) Mara Huldra 2022
# SPDX-License-Identifier: MIT
@tool
extends EditorPlugin
# Avaiable tileset templates
enum TemplateType {
TERRAIN = 0, # 7x7 terrain template
WALL = 1, # 4x4 wall template
@vmedea
vmedea / parse_xbin.py
Last active December 15, 2022 09:19
Command line tarot
#!/usr/bin/env python3
# (C) Mara Huldra 2022
# SPDX-License-Identifier: MIT
'''
Parser for XBin file (ANSI/ASCII/PETSCII art grid).
Convert to unicode and print it out.
'''
import itertools
import struct
import sys
@vmedea
vmedea / install-fallow.sh
Last active September 3, 2021 22:54
Build and install script for Fallow under Linux using mkxp
#!/bin/bash
# Install and build dependencies for mkxp for running the game Fallow by Ada Rook.
# Script by Mara Huldra 2021.
# SPDX-License-Identifier: MIT
# Tested on Ubuntu 20.04 and Debian.
set -e
PREFIX="${PWD}/fallow-install"
BUILDDIR="${PWD}/fallow-build"
FALLOWHOME="${HOME}/.steam/debian-installation/steamapps/common/Fallow"
PAR=1
@vmedea
vmedea / riscv-assembler.py
Last active April 23, 2021 07:18
Minimalistic RISC-V assembler Python class
'''
RISC-V assembler.
'''
# Mara Huldra 2021, based on riscv-assembler by Kaya Celebi
# SPDX-License-Identifier: MIT
from collections import namedtuple
__all__ = ['Assembler']
class UnknownInstruction(Exception):
@vmedea
vmedea / fontconv.py
Last active March 29, 2021 19:53
Font conversion utility (rexpaint)
'''
Font conversion utility (rexpaint).
'''
# Mara Huldra 2021 :: SPDX-License-Identifier: MIT
from collections import namedtuple
from PIL import Image, ImageFont, ImageDraw
# Hardcoded text and background color RGBA, this matches rexpaint's existing fonts
FG_COLOR = (255, 255, 255, 255)
@vmedea
vmedea / nanlite-protocol.md
Last active April 13, 2024 18:32
Nanlite RF and BLE protocol

(this document can be found here: https://gist.github.com/vmedea/434694c11092261fcac401b7a4b9a741)

Contents:

  • Nanlite RF protocol (V1.0)
  • Nanlite RF protocol (V2.0) -- TODO
  • Bluetooth LE ("app protocol")

Nanlite RF protocol (V1.0)

This document describes the RF remote control protocol used by at least the Nanlite PavoTubeII6C RGBWW photography lights, and probably more lighting equipment by the same vendor (I do not have access to any other so cannot verify this).