Skip to content

Instantly share code, notes, and snippets.

@zhangyoufu
zhangyoufu / bypass-windows-setup-compatibility-check.reg
Created February 25, 2025 11:58
setupcompat.dll ConX::Compatibility::CCompatibilityCheckerFactory::CreateCompatibilityChecker
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\Setup\MoSetup]
"MoSetupTests"=dword:00000001
"CompatCheckTestHookCategory"=dword:00000000
https://support.microsoft.com/en-US/rss-feed-picker is not actively maintained
https://support.microsoft.com/en-us/feed/atom/<UUID>
https://support.microsoft.com/en-us/feed/rss/<UUID>
0cfbf2af-24ea-3e18-17e6-02df7331b571 Windows Server 2012
02b57d93-e28e-9404-10a8-8a6b85e3eb6f Windows Server 2012 R2 ESU
c3a1be8a-50db-47b7-d5eb-259debc3abcc Windows Server 2016
eb958e25-cff9-2d06-53ca-f656481bb31f Windows Server 2019
2d67e9fb-2bd2-6742-08ee-628da707657f Windows Server 2022
e54d3179-52dc-2ffd-1cea-f5c0319a5cad Windows Server 2025, all editions
@zhangyoufu
zhangyoufu / china_mobile_province_code.txt
Created February 9, 2025 07:37
中国移动省份代码(中国大陆)
100 北京
200 广东
210 上海
220 天津
230 重庆
240 辽宁
250 江苏
270 湖北
280 四川
290 陕西
@zhangyoufu
zhangyoufu / check-hyperv-enlightenment.c
Created November 17, 2024 18:24
check enabled Hyper-V Enlightenment inside VM
#include <intrin.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
/******************************************************************************/
// include/qemu/bitops.h
#define BIT(nr) (1UL << (nr))
@zhangyoufu
zhangyoufu / gist:0b3123fe37e2906536827ace81c0ad5d
Created November 3, 2024 09:40
Windows Processor Architecture Enumeration
0: PROCESSOR_ARCHITECTURE_INTEL
1: PROCESSOR_ARCHITECTURE_MIPS
2: PROCESSOR_ARCHITECTURE_ALPHA
3: PROCESSOR_ARCHITECTURE_PPC
4: PROCESSOR_ARCHITECTURE_SHX
5: PROCESSOR_ARCHITECTURE_ARM
6: PROCESSOR_ARCHITECTURE_IA64
7: PROCESSOR_ARCHITECTURE_ALPHA64
8: PROCESSOR_ARCHITECTURE_MSIL
9: PROCESSOR_ARCHITECTURE_AMD64
@zhangyoufu
zhangyoufu / getgo.sh
Last active July 25, 2024 07:43
Download latest Go release and install to /opt
#!/bin/sh
not_available() { echo -- "$1 is not available"; exit 1; }
ensure_command_available() { which -- "$1" >/dev/null && return; not_available "$1"; }
ensure_gnu_tar() { tar --version | grep -F 'GNU tar' >/dev/null || not_available 'GNU tar'; }
ensure_command_available curl
ensure_command_available jq
ensure_gnu_tar
@zhangyoufu
zhangyoufu / tiger-vnc.rb
Created June 17, 2024 02:50
tiger-vnc Homebrew Formula with ffmpeg for PiKVM H.264 encoding
class TigerVnc < Formula
desc "High-performance, platform-neutral implementation of VNC"
homepage "https://tigervnc.org/"
url "https://github.com/TigerVNC/tigervnc/archive/refs/tags/v1.13.1.tar.gz"
sha256 "b7c5b8ed9e4e2c2f48c7b2c9f21927db345e542243b4be88e066b2daa3d1ae25"
license "GPL-2.0-or-later"
# Tags with a 90+ patch are unstable (e.g., the 1.9.90 tag is used for the
# 1.10.0 beta release) and this regex should only match the stable versions.
livecheck do
@zhangyoufu
zhangyoufu / certs.txt
Created March 7, 2024 10:47
A configuration profile needed by VirtualBox VBoxHeadless, signed by Apple, valid for 18 years, grants several entitlements
% openssl pkcs7 -print_certs -text -in embedded.provisionprofile -inform der
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 134752589830791184 (0x1debcc4396da010)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, O=Apple Inc., OU=Apple Certification Authority, CN=Apple Root CA
Validity
Not Before: Feb 7 21:48:47 2013 GMT
Not After : Feb 7 21:48:47 2023 GMT
@zhangyoufu
zhangyoufu / gdb.txt
Last active May 10, 2024 17:22
The architecture-specific signal handling code may adjust RIP/RAX to restart interrupted syscall. Address set be tracer via PTRACE_SETREGS may be decreased by 2 bytes unexpectedly on i386/x86-64. To workaround this behavior, tracer have to check whether tracee is in system call and whether the errno indicates restartable.
(gdb) set $rip=0xdeadbeef
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x00000000deadbeed in ?? ()
=> 0x00000000deadbeed:
Cannot access memory at address 0xdeadbeed
@zhangyoufu
zhangyoufu / ln.py
Created August 25, 2022 10:47
create symlink on exFAT filesystem (macOS way)
#!/usr/bin/env python3
import argparse
import hashlib
import os
SMB_SYMHDRLEN = (4+1)+(4+1)+(32+1)
MAXPATHLEN = 0x400
# see smbfs_create_windows_symlink_data
def symlink(target: str, link: str) -> None: