Skip to content

Instantly share code, notes, and snippets.

View MikuAuahDark's full-sized avatar

Miku AuahDark MikuAuahDark

View GitHub Profile
@MikuAuahDark
MikuAuahDark / uds_client.c
Last active July 10, 2022 06:22
UDS Test
/* clang uds_client.c -lws2_32 -Wno-deprecated-declarations */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <winsock2.h>
#include <windows.h>
struct sockaddr_un
{
@MikuAuahDark
MikuAuahDark / timerhack.lua
Last active October 11, 2020 13:59
timeBeginPeriod inject
-- This code injects call to "timeBeginPeriod" to specified PID
-- Note that it's inadvisable to set the timer resolution
-- as it can affect battery life and your electricity bills.
-- Attribution to MikuAuahDark (me) is appreciated, but you can
-- use part or all of this code without my permission.
local ffi = require("ffi")
ffi.cdef[[
int __stdcall timeBeginPeriod(uint32_t);
void* __stdcall CreateRemoteThread(void*, void*, size_t, void*, void*, uint32_t, uint32_t*);
@MikuAuahDark
MikuAuahDark / httptunnel.py
Last active November 4, 2020 01:39
Lazy HTTP Tunnel/CONNECT Proxy in Python 3.7+ using Cloudflare as DNS Resolver
# HTTP tunneling with DoH resolver
#
# The motivation to write this is because youtube-dl lack DoH or cURL
# "--resolve" equivalent which prevents me from downloading reddit videos
# because all reddit (sub)domains are blocked in my country.
#
# To use this proxy, you need 2 terminals.
# * 1 terminal is to run this proxy server:
# $ python3 httptunnel.py
# * then the other terminal to download the videos with youtube-dl
@MikuAuahDark
MikuAuahDark / main.c
Created November 19, 2020 09:26
OpenAL-soft test program used in https://www.youtube.com/watch?v=bAkJcaMlc1E
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <AL/al.h>
#include <AL/alc.h>
#include "sleep.h"
@MikuAuahDark
MikuAuahDark / conf.lua
Created December 19, 2020 14:15
Force GL2 in LOVE
-- ...
-- Add before love.conf function, typically at top of the file
local function forceGL2()
local ffi = require("ffi")
if not pcall(function() return ffi.C._putenv end) then
ffi.cdef("int _putenv(const char *);")
end
return ffi.C._putenv("LOVE_GRAPHICS_USE_GL2=1") == 0
end
@MikuAuahDark
MikuAuahDark / capture.cpp
Created January 6, 2021 16:34
Simple peak meter with ANSI escape codes written in C++ using WASAPI audio loopback as audio measurement.
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <atomic>
#include <chrono>
#include <thread>
#include <type_traits>
#include <windows.h>
#include <combaseapi.h>
@MikuAuahDark
MikuAuahDark / Edge.java
Last active March 2, 2021 01:02
Uniform Cost Search in Java 8
// Sisi
public class Edge {
public Edge(Vertex a, Vertex b, int cost) {
this.a = a;
this.b = b;
this.cost = cost;
}
public Vertex getA() {
return a;
@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();
@MikuAuahDark
MikuAuahDark / STEPS.md
Last active July 30, 2023 13:09
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 / 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.