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.
My G14 is GA402RJ(6800HS + 6700s) with MT7922 WiFi/BT card.
At this time, BIOS version is 309.
import logging | |
import os | |
import json | |
import datetime | |
from typing import Iterable, Optional, TypedDict, Union | |
import urllib.parse | |
import hashlib | |
import hmac | |
import secrets |
// aarch64-linux-gnu-gcc fuckexposure.c -nostdinc -nostdlib -nostartfiles -e _start -g -o fuckexposure -Wall -static -ffreestanding -fno-stack-protector | |
#define NULL ((void *)0) | |
#define O_RDONLY 0 | |
#define O_WRONLY 1 | |
#define O_RDWR 2 | |
#define AT_FDCWD -100 |
#!/usr/bin/env python3 | |
''' | |
Usage: ./fuckcache.py \ | |
--mount=type=secret,id=npmrc,target=/root/.npmrc \ | |
--mount=type=cache,target=/root/.npm \ | |
--mount=type=cache,id=somecache,target=/var/cache/somecache | |
like docker RUN instruction | |
it will product dockerfile and build it |
<?php | |
// x86_64 sysv abi only | |
// simple hello | |
$code = "" . | |
"\x48\xc7\xc0\x01\x00\x00\x00" . // mov $0x1 (SYS_write for x86_64), %rax | |
"\x48\xc7\xc7\x01\x00\x00\x00" . // mov $0x1 (stdout), %rdi | |
"\x48\x8d\x35\x0b\x00\x00\x00" . // lea 0xb(%rip), %rsi PIE! | |
"\x48\xc7\xc2\x0d\x00\x00\x00" . // mov $0xd (sizeof("hello world!\n") - 1), %rdx |
// SPDX-License-Identifier: GPL-2.0-or-later | |
/dts-v1/; | |
#include <dt-bindings/gpio/gpio.h> | |
#include <dt-bindings/input/input.h> | |
#include "armada-372x.dtsi" | |
/ { | |
model = "Not Aliyun SAG-100wm"; | |
compatible = "notaliyun,sag100wm", |
<?php | |
/** | |
* Win32 api utitlities class | |
* needs to be initialized with W32api::init() | |
*/ | |
final class W32api | |
{ | |
private const BASIC_CDEFS = <<<'CDEF' | |
typedef uint16_t WORD, *PWORD, *LPWORD; |
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 |
#!/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* |
/* | |
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; |