Skip to content

Instantly share code, notes, and snippets.

View MikuAuahDark's full-sized avatar

Miku AuahDark MikuAuahDark

View GitHub Profile
@MikuAuahDark
MikuAuahDark / program.cpp
Last active June 13, 2024 04:03
NPad Audio Video Decode library example.
// clang -Inav/include -Lnav/lib --std=c++17 program.cpp lodepng.cpp -lnav
// Get lodepng.cpp from https://github.com/lvandeve/lodepng
// See https://github.com/MikuAuahDark/nav for more information about NAV.
#include <algorithm>
#include <array>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <list>
@MikuAuahDark
MikuAuahDark / README.md
Last active March 10, 2024 17:59
1 Billion Row Challenge in Lua 5.1/LuaJIT

To run:

  1. Generate measurement.txt as per in the original repo instructions.
  2. Set the environment variable MEASUREMENT_FILE to the path of the measurement.txt.
  3. Run the script without arguments (luajit calculate_measurement.lua).

For Lua 5.1, you need to patch calls to ftell and fseek to use the 64-bit counterparts (e.g. _ftelli64 and _fseeki64 respectively for MSVC) as it can't handle file larger than 2GB. The exact modification for MSVC compiler are as follows:

diff --git a/src/liolib.c b/src/liolib.c
index 649f9a5..d1768cb 100644
--- a/src/liolib.c
@MikuAuahDark
MikuAuahDark / README.md
Last active October 11, 2023 04:29
Python Script to Help Embedding Source Indexing Data to PDB

This is a simple Python script to help embedding source indexing information to PDBs using HTTP source server provider.

If you're looking to source-index your PDB and you're using GitHub, then this is perfect. If you need more information on how it works, take a look at Baldur Karlsson's writings for GitHub source indexing and Bruce Dawson's blogpost about source indexing in general.

To use this script, you need to specify a source-URL mapping which can be specified with --source. For example, if your project is hosted at https://github.com/love2d/love and you're building for commit 4b825dc642cb6eb9a060e54bf8d69288fbee4904, then the URL to access the source file can be re-constructed as https://raw.githubusercontent.com/love2d/love/4b825dc642cb6eb9a060e54bf8d69288fbee4904.

@MikuAuahDark
MikuAuahDark / main.lua
Created December 10, 2022 01:40
NAniTe Demo
local love = require("love")
local nanite = require("nanite")
local FOUR_DIAG_LEN = 96
local DIST_4_LETTER = FOUR_DIAG_LEN * 2 / math.sqrt(3)
local RAD = math.pi / 180
local NPadLogoData = {
timer = nil, ralewayBlack = nil, baked = nil, fontHeight = 0,
x1 = 0, x2 = 0, r = 0, fade = 1,
@MikuAuahDark
MikuAuahDark / inspect.cpp
Created November 18, 2022 12:58
Lua Stack Inspector with Relative Indices
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
}
#include <cstdio>
#include <sstream>
static std::string luax_checkstring(lua_State *L, int i)
{
@MikuAuahDark
MikuAuahDark / README.md
Created November 16, 2022 16:35
How to Run WSL on Logon

Run WSL on Logon

  1. Compile runsilent.c in Windows
  2. Compile dummy.c in Linux
  3. Import the task with schtasks in Windows, modify the path as needed before importing.

Notes

  • When you shutdown the WSL (with wsl --shutdown), to start it again in background, run schtasks /run /tn:wslon. No administrator privileges is required.
@MikuAuahDark
MikuAuahDark / runsilent.c
Last active November 16, 2022 16:45
Run Windows Console Program Without Console
/* clang -Wl,/subsystem:windows -Wl,/entry:mainCRTStartup -D_CRT_SECURE_NO_WARNINGS runsilent.c -luser32 -o runsilent.exe */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/*
@MikuAuahDark
MikuAuahDark / pvz_kobo_names.lua
Last active May 14, 2022 04:23
Change PvZ Plant Names Without Modding
-- Cheat Engine Lua script to replace plant names in PvZ to names by Kobo Kanaeru.
-- Written by Miku AuahDark.
-- This file falls under Public Domain
-- To apply the plant names:
-- 1. Start PvZ and let it load until main menu
-- 2. Load 32-bit Cheat Engine and hook to PvZ process.
-- 3. Click Table -> Show Cheat Table Lua Script or press Ctrl+Alt+L
-- 4. Copy and paste this whole script then press "Execute Script"
-- 5. Cheat Engine may hang for a while, it's normal.
@MikuAuahDark
MikuAuahDark / STEPS.md
Last active August 27, 2024 22:04
Multiple Account Setup for Genshin Impact

Multi Account

Genshin Impact multi account in PC is bit annoying because you need to logout then login back. There are 2 ways to switch between account instantly and both requires the game not running.

Registry

Path: HKCU\SOFTWARE\miHoYo\Genshin Impact

@MikuAuahDark
MikuAuahDark / testcrypt.lua
Created June 8, 2021 01:29
LuaJIT FFI to test Crypt(Un)protectData Function to Diagnose Genshin Impact Logged Out Problem
local ffi = require("ffi")
local Crypt32 = ffi.load("Crypt32")
local TEST_TEXT = [[
struct DATA_BLOB {
uint32_t size;
void *data;
};
uint32_t GetLastError();