Skip to content

Instantly share code, notes, and snippets.

View Konamiman's full-sized avatar

Néstor Soriano Konamiman

View GitHub Profile
@Konamiman
Konamiman / create-github-release.sh
Created January 20, 2026 22:03
GitHub draft release creator
#!/usr/bin/env bash
#
# Create a draft GitHub release from pull requests targeting a milestone.
#
# Usage: create-github-release <repo> <milestone> [options]
#
# Arguments:
# repo Repository URL or user/repo format
# milestone Milestone name to collect PRs from
#
@Konamiman
Konamiman / chgcount.sh
Created November 7, 2025 12:00
Count git changed and deleted lines in the working tree or in the staged files
#!/bin/bash
# chgcount.sh - Count lines added/modified and deleted in git diff
#
# Usage: chgcount.sh [OPTIONS]
#
# Options:
# -p, --pattern PATTERN File pattern to check (default: all files)
# Use **/ prefix for recursive matching in subdirectories
# -f, --files FILES Explicit space-separated list of files to check
@Konamiman
Konamiman / object-cache.php
Created October 28, 2025 14:27
Simple file-based persistent object cache for WordPress. For testing scenarios only.
<?php
/**
* Simple file-based WordPress object cache implementation.
*
* Drop this file in wp-content/ to enable persistent object caching.
* Each cache group stores its data in a separate file using PHP serialization.
* Files will go in WP_CONTENT_DIR . '/cache/object-cache', or if
* no WP_CONTENT_DIR constant is defined, in '/tmp/wp-object-cache'.
*
* This file is provided as-is without warranty of any kind.
@Konamiman
Konamiman / woo-worktrees.sh
Last active December 2, 2025 10:43
A script to easily handle multiple WooCommerce branches using git worktrees
#!/bin/bash
# WooCommerce Worktree Management Script
# By Konamiman (and Claude)
set -e
WOO_REPO="$HOME/woocommerce"
WOO_CORE="$WOO_REPO/plugins/woocommerce"
WOO_WORKTREES="$HOME/worktrees"
@Konamiman
Konamiman / apply_diff.php
Last active May 29, 2025 13:57
PHP function to apply a diff
<?php
/**
* Apply a diff to a text composed of multiple lines.
*
* The diff is expected to be in unified format (https://www.gnu.org/software/diffutils/manual/html_node/Unified-Format.html)
* but for a single file (so there are no file names and the first line starts with "@@" already).
*
* The approach followed is probably not the most efficient possible, but the code is small and gets the job done.
*
@Konamiman
Konamiman / Example.cs
Last active August 3, 2024 14:19
TLS 1.3 key derivation in C#
using System;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
class Example
{
public static void Main()
{
@Konamiman
Konamiman / .Z80 relocatable file parser.md
Last active January 26, 2023 16:18
Parser for Z80 relocatable files (generated by M80.COM, processed by L80.COM)

This program will parse and print the structure of a relocatable (.REL) Z80 code file generated with the Macro80 assembler (M80.COM) and processable with Link80 (L80.COM). See ParseRel.cs for build instructions.

More information on Macro80/Link80 and the .REL format: http://www.msxarchive.nl/pub/msx/programming/asm/m80l80.txt

@Konamiman
Konamiman / CH376 connected to Z80.md
Created August 21, 2021 16:35
"Recipe" to connect a CH376 to a Z80 via I/O port

How to connect a CH376 to a Z80 via I/O ports 20h and 21h (compatible with Rookie Drive):

Z80 74HC688 CH376
5V 5V 5V
GND GND GND
D7...D0 D7...D0
RD RD
WR WR
A0 A0
/**
* Skeleton for a USB device implementation with a CH372/375/376.
*
* No real device functionality is implemented,
* only the standard USB requests over the control endpoint.
*/
#include "constants.h"
@Konamiman
Konamiman / Nextor-v3-driver-migration-guide.md
Last active August 5, 2020 20:49
Nextor v3 driver structure proposal

Nextor v3 driver migration guide

This guide explains how to migrate a Nextor driver from v2 to v3. The reader is expected to have experience with Nextor v2 driver development.

Only the changes relative to the structure of the driver for v2 are mentioned here. You can see the skeleton for a full v3 driver in the Nextor-v3-driver.asm in this same gist, and the skeleton for a full v2 driver in the Nextor repository.

1. Change the hardcoded flags (DRV_FLAGS, 410Eh)

The driver flags byte needs to be changed to the fixed value 83h. Bit 7 indicates that the driver is a v3 driver, bits 0 and 1 need to be set for consistency with the meaning they had in Nextor v2.