Skip to content

Instantly share code, notes, and snippets.

@vmedea
vmedea / draculamod.vim
Created March 2, 2019 10:26
vim theme
" Based on Dracula Theme v1.2.7
"
" https://github.com/zenorocha/dracula-theme
"
" Copyright 2016, All rights reserved
"
" Code licensed under the MIT license
" http://zenorocha.mit-license.org
"
" @author Trevor Heins <@heinst>
/*
* Copyright (c) 2012 Kevin P. Willard
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
@vmedea
vmedea / heartrate.py
Created October 20, 2020 15:07
Bluetooth LE heartrate sensor communication for ULX3S ESP32
# Bluetooth LE heartrate sensor communication
#
# Connect to the first available Bluetooth LE heartrate sensor, subscribes to
# notifications, then sends the values to the FPGA through the UART in single-byte packets.
#
# Mara "vmedea" 2020
# SPDX-License-Identifier: MIT
from binascii import hexlify
from micropython import const
from machine import UART
@vmedea
vmedea / dragonrise_hid.txt
Created November 15, 2020 09:04
USB hid descriptor for DragonRise Inc. GameCube Controller Adapter
Bus 001 Device 006: ID 0079:1846 DragonRise Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0079 DragonRise Inc.
@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 / 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 / iConsole.py
Last active June 2, 2021 12:25
Communicate with an iConsole exercise bike using BLE and pygatt
# This was moved to https://github.com/vmedea/iconsole
@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 / 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 / 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.