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 / 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 / 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 / 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).

@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 / 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 / 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