Skip to content

Instantly share code, notes, and snippets.

View dixyes's full-sized avatar
🧧
<-- this is a 红包

Yun Dou dixyes

🧧
<-- this is a 红包
View GitHub Profile
@dixyes
dixyes / sms4.patch
Created January 9, 2020 10:34
SMS4 in mbedtls
diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h
index 96efd937f..bd0027b7e 100644
--- a/include/mbedtls/cipher.h
+++ b/include/mbedtls/cipher.h
@@ -92,6 +92,7 @@ typedef enum {
MBEDTLS_CIPHER_ID_ARC4, /**< The RC4 cipher. */
MBEDTLS_CIPHER_ID_ARIA, /**< The Aria cipher. */
MBEDTLS_CIPHER_ID_CHACHA20, /**< The ChaCha20 cipher. */
+ MBEDTLS_CIPHER_ID_SMS4,
} mbedtls_cipher_id_t;
@dixyes
dixyes / config.list.example
Last active September 5, 2020 14:21
my mc mod updater
AbyssalCraft-1.12.2-1.10.2.jar:AbyssalCraft*
astralsorcery-1.12.2-1.10.26.jar:astralsorcery*
BuildingGadgets-2.8.4.jar:BuildingGadgets*
gregtech-1.12.2-1.10.0.546.jar:gregtech*
industrialcraft-2-2.8.220-ex112.jar:industrialcraft*
Jade-0.1.0.jar:Jade*
jei_1.12.2-4.16.1.301.jar:jei_1.12.2*
just-enough-harvestcraft-1.12.2-1.7.2.jar:just-enough-harvestcraft-*
levelup2-1.5.6.jar:levelup2*
LittleMaidAppendPack-1.0.3.jar:LittleMaidAppendPack*
@dixyes
dixyes / dllinspect.c
Last active May 23, 2021 06:32
show dll load and unload
#include <wchar.h>
#include <windows.h>
#include <detours.h>
/* common */
LONG (NTAPI* LdrRegisterDllNotification)(ULONG Flags, PVOID cb, PVOID Context, PVOID *Cookie);
LONG (NTAPI* ZwQueryInformationProcess)(HANDLE ProcessHandle, int ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength);
void getkernelfuncs(void){
static int fucked = 0;
if(fucked){

Naming scheme

hyperf php base images

hyperf/php:<php version>[-<distro kind>[-<distro version>]]

which:

@dixyes
dixyes / some.php
Created September 1, 2021 07:38
php -x
<?php
$file = explode("\n", file_get_contents(__FILE__));
\Swow\Debug\registerExtendedStatementHandler(function () use ($file) {
$bt = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1)[0];
if ($bt['file'] === __FILE__) {
echo $bt['line'] . ':' . $file[$bt['line'] - 1] . PHP_LF;
}
});
@dixyes
dixyes / action.php
Created September 15, 2021 03:10
action.php
<?php
declare(strict_types=1);
include_once __DIR__ . "/../vendor/autoload.php";
use PHPbc\PHPbc;
use PHPbc\Util;
use PHPbc\Config;
use PHPbc\Log;
/*
this is undocumented, to be confirmed
read id_aa64isar0_el1 from registry HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\x\CP 4030
*/
uint64_t getaa64isar0() {
const WCHAR cpus_key[] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\";
HKEY cpus_handle;
if (ERROR_SUCCESS != RegOpenKeyExW(HKEY_LOCAL_MACHINE, cpus_key, 0, KEY_ENUMERATE_SUB_KEYS, &cpus_handle)) {
printf("failed open reg\n");
return 0;
#!/bin/sh
mirror_host='mirrors.ustc.edu.cn'
sed -i 's|^#baseurl=|baseurl=|g' /etc/yum.repos.d/fedora*
sed -i 's|^metalink=|#metalink=|g' /etc/yum.repos.d/fedora*
sed -i 's|^download.example/pub/fedora/linux|'"${mirror_host}"'/fedora|g' /etc/yum.repos.d/fedora*
@dixyes
dixyes / Readme.md
Last active May 6, 2024 14:22
ASUS ROG Zephyrus G14 2022 GA402RJ pci passthrough

ASUS ROG Zephyrus G14 2022 GA402RJ pci passthrough

This is a record for my own passthrough setup, I can finally use a single laptop for windows gaming and linux programming at the same time.

The device

My G14 is GA402RJ(6800HS + 6700s) with MT7922 WiFi/BT card.

At this time, BIOS version is 309.

@dixyes
dixyes / conv.py
Last active November 7, 2023 13:35
GA402R anime matrix with python
from PIL import Image, ImageDraw, ImageOps, ImageStat
"""
convert picture to matrix data uint8 array
this script is too slow...
maybe we should rewrite it in np things