Skip to content

Instantly share code, notes, and snippets.


Yuxiang Zhang z4yx

View GitHub Profile
z4yx / W25Q128-ID.c
Created Mar 8, 2020
kernel driver code snippet to read unique ID of W25Q128
View W25Q128-ID.c
#include <linux/random.h>
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) {
// ...
// after mutex_init(&nor->lock);
if(memcmp(info->id, "\xef\x40\x18", 3) == 0) {
int ret;
u8 buf[4+8]; // 4 dummy + 64-bit ID
dev_warn(dev, "reading unique ID\n");
ret = nor->read_reg(nor, 0x4B, buf, sizeof(buf)); // Read Unique ID number
View pypi-clean.go
package main
// bash -c 'CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o clean clean.go'
// Usage:
// bandersnatch -c /tmp/b.conf verify --delete --dry-run &>verify-dry-run.log
// ./clean <verify-dry-run.log >clean.log
import ( "fmt";"log"; "os"; "time";"bufio";"strings" )
func main() {
View mipsel-none-elf-binutils.rb
class MipselNoneElfBinutils < Formula
desc "FSF Binutils for mipsel cross development"
homepage ""
url ""
sha256 "9b0d97b3d30df184d302bced12f976aa1e5fbf4b0be696cdebc6cca30411a46e"
def install
system "./configure", "--target=mipsel-none-elf",
View pn532-14443a.c
/**************** from pn53x-internal.h **********/
// Register addresses
#define PN53X_REG_Control_switch_rng 0x6106
#define PN53X_REG_CIU_Mode 0x6301
#define PN53X_REG_CIU_TxMode 0x6302
#define PN53X_REG_CIU_RxMode 0x6303
#define PN53X_REG_CIU_TxControl 0x6304
#define PN53X_REG_CIU_TxAuto 0x6305
#define PN53X_REG_CIU_TxSel 0x6306
#define PN53X_REG_CIU_RxSel 0x6307
z4yx / Info.plist
Created Nov 21, 2019
macOS 10.14.6 (18G1012) /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist
View Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View extra-instr.s
.set noreorder
.set noat
.globl __start
li $s0, 0x80100000
li $s1, 0
li $s2, 1
lw $a1, 4($s0) # selection
lw $a2, 8($s0) # random
z4yx / u2f_fido2_dissector.lua
Last active Nov 5, 2020
Wireshark protocol decoder for FIDO(U2F) and FIDO2(WebAuthn) over USB HID
View u2f_fido2_dissector.lua
cbor = Dissector.get("cbor")
iso7816 = Dissector.get("iso7816")
ctap_proto = Proto("ctaphid","ctap hid")
-- Field Extractor
direction_fe ="usb.endpoint_address.direction")
udp_srcport_fe ="udp.srcport")
View k210-mem-test.c
uint64_t mask = 0;
for(int i=0; i<2; i++){
volatile uint64_t *ptr = (volatile uint64_t*)0x80100000;
uint64_t rnd = 12345;
for(; (uint64_t)ptr < 0x80800000; ptr+=1)
*ptr = rnd^mask; // Write MEM
// if((uint64_t)ptr == 0x802a0d90){
// printHex(rnd^mask);
View sfpi-bootargs.txt
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw rootwait;ext4load mmc 0:1 0x41000000 boot/zImage;ext4load mmc 0:1 0x41800000 boot/sun8i-v3s-saltedfishpi.dtb;bootz 0x41000000 - 0x41800000
z4yx /
Last active Mar 12, 2020
如何为rhel编译nginx module (how to compile dynamic nginx modules on rhel)


wget ''
rpm -i nginx-1.14.2-1.el7_4.ngx.src.rpm
tar -xf rpmbuild/SOURCES/nginx-1.14.2.tar.gz