Skip to content

Instantly share code, notes, and snippets.

View PeterCxy's full-sized avatar

Peter Cai PeterCxy

View GitHub Profile
@PeterCxy
PeterCxy / boot.txt
Last active March 30, 2023 14:46
U-BOOT boot.txt for booting RaspberryPi kernel on ArchLinxuARM aarch64
# After modifying, run ./mkscr
# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid
setenv bootargs console=tty1 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"
load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image
load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdtcontroladdr};
@PeterCxy
PeterCxy / README.md
Last active November 27, 2023 14:20
Device Tree Overlay for GamePi43 (Raspberry Pi Retro Game Console Case)

This device tree overlay removes the need for the userspace daemon retrogame to process button press on GamePi43, reducing input latency and removes a point of failure (I don't really trust that daemon from Adafruit to be error-free).

To compile the dts, install dtc and then run

dtc -I dts -O dtb -o gamepi43.dtbo gamepi43.dts

To install the overlay, copy the resulting gamepi43.dtbo to /boot/overlays/, and then add

@PeterCxy
PeterCxy / README.md
Last active May 14, 2022 10:32
Evdev long click to right click emulation

A Python script to implement long-click-to-right-click emulation on Linux. Root permission needed (or you need udev rules to allow your user to write / read from evdev)

Usage:

python rce.py <name_of_your_tuchscreen>

Use xinput output to determine the name of your touchscreen

@PeterCxy
PeterCxy / main.rs
Created March 6, 2018 09:59
Brute force solution to the viral logic test
const A: usize = 0;
const B: usize = 1;
const C: usize = 2;
const D: usize = 3;
const Q2_SELECTIONS: [usize; 4] = [C, D, A, B];
const Q3_SELECTIONS: [usize; 4] = [3, 6, 2, 4];
const Q4_SELECTIONS: [(usize, usize); 4] = [
(1, 5), (2, 7), (1, 9), (6, 10)
];
const Q5_SELECTIONS: [usize; 4] = [8, 4, 9, 7];
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/netfilter_ipv4.h>
#include <unistd.h>
#define BUFFER_SIZE 1024
#define on_error(...) { fprintf(stderr, __VA_ARGS__); fflush(stderr); exit(1); }
@PeterCxy
PeterCxy / zeronet.conf
Created October 28, 2017 05:24
ZeroNet trackers
[global]
trackers_file = /path/to/zeronet_trackers.txt

Keybase proof

I hereby claim:

  • I am PeterCxy on github.
  • I am petercxy (https://keybase.io/petercxy) on keybase.
  • I have a public key whose fingerprint is 708D FB13 CBED 9AB3 9449 DBFB 41C0 4120 C297 B594

To claim this, I am signing this object:

此API KEY为 Weico.Android 的API。复制后粘贴到BL的自定义API对话框的任意一个框框内即可(开头结尾不要带空格之类的,如果没反应,尝试将光标移到最后删除最后的不可见字符)
SSMjExMTYwNjc5OjoxZTZlMzNkYjA4ZjkxOTIzMDZjNGFmYTBhNjFhZDU2Yzo6aHR0cDovL29hdXRoLndlaWNvLmNjOjplbWFpbCxkaXJlY3RfbWVzc2FnZXNfcmVhZCxkaXJlY3RfbWVzc2FnZXNfd3JpdGUsZnJpZW5kc2hpcHNfZ3JvdXBzX3JlYWQsZnJpZW5kc2hpcHNfZ3JvdXBzX3dyaXRlLHN0YXR1c2VzX3RvX21lX3JlYWQsZm9sbG93X2FwcF9vZmZpY2lhbF9taWNyb2Jsb2csaW52aXRhdGlvbl93cml0ZTo6Y29tLmVpY28ud2VpY286OkVFEE