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 / play.php
Last active May 6, 2022 02:40
php FFI registry utilities
<?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;
// 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",
@dixyes
dixyes / hello.php
Created February 23, 2023 14:06
How to write hello world in PHP
<?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
@dixyes
dixyes / fuckcache.py
Created February 18, 2024 02:48
Fuck buildx cache
#!/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
@dixyes
dixyes / fuckexposure.c
Created February 29, 2024 12:42
fuck uvc auto exposure
// 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
@dixyes
dixyes / api.py
Last active August 27, 2024 08:14
api.py
import logging
import os
import json
import datetime
from typing import Iterable, Optional, TypedDict, Union
import urllib.parse
import hashlib
import hmac
import secrets