Skip to content

Instantly share code, notes, and snippets.

View MikuAuahDark's full-sized avatar

Miku AuahDark MikuAuahDark

View GitHub Profile
@MikuAuahDark
MikuAuahDark / timerEx.lua
Created June 19, 2020 12:55
timerEx 2020 rewrite
-- timerEx 2020 by MikuAuahDark
-- A rewrite of my 7-year-old timerEx 4.0
-- The old can be found here
-- https://www.unrealsoftware.de/files_show.php?file=13759
--[[---------------------------------------------------------------------------
-- Copyright (c) 2020 Miku AuahDark
--
-- 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
@MikuAuahDark
MikuAuahDark / io_open_wide.lua
Last active August 20, 2020 01:02
LuaJIT io.open monkeypatch in Windows to load UTF-8 filenames
-- io.open patch to allow UTF-8 filenames in Windows
-- Copyright (c) 2020 Miku AuahDark
-- You can use portion of this code or as a whole without my permission.
local ffi = require("ffi")
if ffi.os ~= "Windows" then
-- Not Windows
return
end
@MikuAuahDark
MikuAuahDark / koikatu_check.cpp
Last active January 23, 2023 05:53
Rust code to check if PNG is KoiKatuChara or KoiKatuClothes
// Code to check whetever PNG image is normal PNG image or it also contain
// Koikatu data like character or clothes.
// Copyright (c) 2023 Miku AuahDark
// You can use portion of this code or as a whole without my permission.
// clang++ -std=c++17 -D_CRT_SECURE_NO_WARNINGS koikatu_check.cpp
#include <cerrno>
#include <cstdio>
@MikuAuahDark
MikuAuahDark / mapextract.php
Last active February 20, 2020 16:08
PHP Script to extract beatmap files from osu!lazer
#!/usr/bin/env php
<?php
function showUsage(string $scriptName): void
{
echo "Usage: $scriptName <[l]ist|e[x]tract|[s]ync|[h]ash> <options>", PHP_EOL;
echo 'List usage: list', PHP_EOL;
echo 'Extract usage: extract <ID from list> <zip output>', PHP_EOL;
echo 'Sync usage: sync <osustable install>', PHP_EOL;
echo 'Hash usage: hash <ID from list>', PHP_EOL;
@MikuAuahDark
MikuAuahDark / format.txt
Created August 25, 2019 02:15
HMNS ContextInfo file structure
HMNS Context info file structure.
Version 1
All datatypes specified are in little endian. Integer types is assumed to be unsigned.
header - dword ('HMNS')
version - dword, 1 as of writing.
preflen - dword, prefix length without null-terminator.
prefix - byte[n], prefix string, without null-terminator.
dummy - align 4 bytes.
@MikuAuahDark
MikuAuahDark / Xorshift.hpp
Last active June 22, 2019 14:35
C++11 <random>-compatible LOVE Xorshift* taken from Alpha Stellar
// LOVE Xorshift* implementation as of 11.3
// Reimplemented for consistency reasons.
// In any case, the license goes to LOVE Development Team which is zLib license.
// std
#include <stdint.h>
// STL
#include <random>
@MikuAuahDark
MikuAuahDark / transform_hack.lua
Created May 3, 2019 16:31
Extend functionality of LOVE 11.0 Transform object
-- Script that monkeypatch LOVE Transform
-- to add 3D support
local love = require("love")
local t = love.math.newTransform()
local t2 = love.math.newTransform()
local transformMt = getmetatable(t)
local function applyDump(ts, ...)
t2:reset()
t2:apply(ts)
@MikuAuahDark
MikuAuahDark / main.c
Last active October 13, 2019 15:46
Lazy HCA2WAV using clHCA
/* HCA2WAV */
/* This is one shot tool, error handling is lazy, */
/* memory may not be freed. Any efforts fixing this */
/* is useless */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#endif
@MikuAuahDark
MikuAuahDark / .lua
Created December 17, 2018 12:07
32-bit unsigned integer multiplication in Lua
function dwordMultiply(a, b)
a = a % 4294967296
b = b % 4294967296
local ah, al = math.floor(a / 65536), a % 65536
local bh, bl = math.floor(b / 65536), b % 65536
local high = ((ah * bl) + (al * bh)) % 65536
return ((high * 65536) + (al * bl)) % 4294967296
end
@MikuAuahDark
MikuAuahDark / Makefile
Created November 22, 2018 10:17
Simple makefile to zopflipng images from `old/` to`.`
SRC_FILES := $(wildcard old/*.png)
DST_FILES := $(patsubst old/%.png,%.png,$(SRC_FILES))
all: $(DST_FILES)
%.png: old/%.png
zopflipng $< --lossy_transparent --filters=01234mepb --iterations=10 $@