Skip to content

Instantly share code, notes, and snippets.

View rikka0w0's full-sized avatar

Rikka0_0小六花 rikka0w0

  • UNSW
  • Sydney
View GitHub Profile
@rikka0w0
rikka0w0 / l4d2.ps1
Last active January 19, 2026 09:41
Add-Type -TypeDefinition @"
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public static class UDPForward
{
public static void Main(string[] args)
{
@rikka0w0
rikka0w0 / dell.c
Last active January 9, 2026 15:43
Emulate Dell chargers with ESP-01 module
/*
* Example-Code that emulates a DS2502 - 1kbit EEPROM as a dell power supply
*
* Tested with
* - dell notebook https://forum.pjrc.com/threads/33640-Teensy-2-OneWire-Slave
* - DS9490R-Master, atmega328@16MHz as Slave
* - Arduino ProMini clone
* - esp8266
*
* OneWire messaging starts when AC adapter is plugged to notebook,
@rikka0w0
rikka0w0 / 4_boot_attempt.log
Last active January 7, 2026 14:19
Port OpenWrt to CG3100D, a BCM3380-based device
[ 0.000000] Linux version 6.6.50 (rikka@i9-13900ks-wsl) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r27346-c7ba5574f5) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 SMP Mon Oct 14 09:59:31 2024
[ 0.000000] CPU0 revision is: 0002a070 (Broadcom BMIPS4350)
[ 0.000000] MIPS: machine is Netgear CG3100D
[ 0.000000] 64MB of RAM installed
[ 0.000000] earlycon: bcm63xx_uart0 at MMIO 0x14e00200 (options '115200n8')
[ 0.000000] printk: bootconsole [bcm63xx_uart0] enabled
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Reserving 0KB of memory at 4194303KB for kdump
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 16 bytes.
[ 0.000000] Primary data cache 32kB, 2-way, VIPT, cache aliases, linesize 16 bytes
@rikka0w0
rikka0w0 / ft2232_to_digilent_jtag.md
Last active December 3, 2025 18:24
FT2232 to Digilent JTag for Xilinx FPGAs (ISE/Vivado)

The Digilent JTag uses FT2232, but its configuration EEPROM contains secrete data needed to be recoginzed by Xilinx ISE/Vivado. The following method only works on linux (tested on Ubuntu16.04), but the patched FT2232 doggle also works on Windows. Since WSL1 does not provide USB device access, the following method will not work for WSL1.

DONT use FT_Prog on offical Digilent cable, as it can trash the firmware! The offical eeprom contains secrete data that cannot be handled correctly by FT_Prog.

Here are steps to create a Digilent-like Jtag that can be used in Xilinx ISE and Vivado

  1. Install softwares: sudo apt-get install libftdi1 ftdi-eeprom
  2. Create a file "flash_digilent.conf" with the following content:
@rikka0w0
rikka0w0 / openwrt_ipv6_relay.md
Created August 31, 2025 14:26
OpenWrt as IPv6 Relay

In certain case, our ISP only provide us a /64 PD and we cannot further split it into subnets. If we cascade multiple routers together, the downstream routers may loose IPv6 access. IPv4 access can be easily guaranteed by NAT. But in the world of IPv6, NAT should be avoided where possible.

The following setup will be on an OpenWrt router connected behind an ISP-provided IPv6-ready router. All configurations are done on the OpenWrt router, and we don't touch the ISP-provided router. We dont need to configure any IPv4, it uses NAT and will work by default.

Here is how to configure relay for IPv6:

In /etc/config/network, our IPv6 upstream interface looks like this

@rikka0w0
rikka0w0 / ipv6_relay_pxe_coexist.md
Last active October 30, 2025 21:49
Setup IPv6 Relay and IPv6 PxE (Co-exist) on OpenWrt

Some ISP only offer you a /64 prefix. If you want to add an OpenWrt router between the ISP router and your LAN while granting IPv6 access to LAN devices, you need relay. OpenWrt's built-in odhcpd(odhcp-ipv6only) can handle DHCPv6 relay. To enable this feature, you need to enable relay mode for ra and ndp for the wan6 (The upstream-facing IPv6 interface) and lan:

image image

Reboot your router and your LAN devices should get IPv6 addresses.

@rikka0w0
rikka0w0 / pxe_tftp_openwrt.md
Last active October 21, 2025 23:12
PXE on OpenWrt with a different TFTP server

In this configuration, DHCP will run on the OpenWrt Box, while the TFTP server (the one serves the boot files) runs on a different computer.

1. Add to /etc/config/dhcp on OpenWrt Box

config boot linux
        option filename 'pxelinux.0'
        option serveraddress '192.168.?.?'
        option servername '?'

Background

Kubuntu 24.04 can boot from iPxE using the following script:

#!ipxe

# Set NFS strings
set nfs-server          ${next-server}
set nfs-mountpt         /srv/nfs
set nfs-linux-live      nfs://${nfs-server}${nfs-mountpt}
set nfs-linux-boot      ${nfs-server}:${nfs-mountpt}
@rikka0w0
rikka0w0 / unfs.md
Last active October 4, 2025 10:35
Usermode NFS Server

unfsd

Server: unfsd -t -n2050 -m2050
Debian:\

apt install nfs-common rpcbind
systemctl start rpcbind

/etc/exports\

@rikka0w0
rikka0w0 / wsl2_auto_start.md
Created September 5, 2025 16:43
Launch WSL2 on Windows startup (No login required)
  1. You need to install and configure WSL2 properly before proceed. Assume the distro name is Ubuntu.
  2. Create a task that runs on startup. Replace and with the owner of the WSL2 distro. (Note that WSL2 distro is per-user based, not system-wide.)
schtasks /create /tn "WSLKeepAlive" /tr "wsl -d Ubuntu sleep infinity" /sc ONSTART /ru <USERNAME> /rp <PASSWORD>
  1. Run this task now to start WSL2:
schtasks /run /tn "WSLKeepAlive"