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 / Test_PIL_IIR_Filter_STM32-Mat.md
Last active May 10, 2019 20:18
How to run the Test_PIL_IIR_Filter demo of STM32-Mat Target 4.4.2

STM32-MAT Script Fixes:

  1. Comment line 256: fprintf('\n### Code Format : %s\n',buildOpts.codeFormat);
    buildOpts.codeFormat doesnt exist, the execution of this line throws an error and halt the code generation. I'm using Matlab 2019a, Windows 10 1803 x64, Stm32CubeMX 4.25 and STM32MatTarget_4.4.2_setup.exe
  2. Search for "extModeIocUsartUpdate" and add "ioc_info = ioc_parse(ioc_path);" in the next line.
    Note: this is a potential bug, the script creates a new ioc file if it cant find an existing one, but it doesnt read the new ioc file after creation.
  3. Comment below (around line 164):
            cset.set_param ('ExtMode','on');            
            cset.set_param ('ExtModeTransport',0); 
            cset.set_param('ExtModeMexFile','ext_serial_win32_comm');
@rikka0w0
rikka0w0 / CCS_FirstProject.md
Last active December 9, 2020 20:44
Create a new project in TI CCS for C2000 (TMS320F28379D)
  1. File > New > CCS Project -> Empty Project (with main.c)
  2. "Project Property" -> Resource -> Linked Resources, add a variable: INSTALLROOT_F2837XD = ${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}\device_support\f2837xd.
  3. "Project Property" -> C/C++ Build -> Settings -> Tab "Tool Settings", in "C2000 Compiler"/"Include Options", add an include path: ${INSTALLROOT_F2837XD}/headers/include, this includes all headers which contains all register definition. Add an include path: ${PROJECT_LOC}/inc, this folder will be populated with headers copied from TI's demo.
  4. "Project Property" -> C/C++ Build -> Settings -> Tab "Tool Settings", in "C2000 Compiler"/"Predefined Symbols", define a macro: CPU1
  5. "Project Property" -> C/C++ Build -> Settings -> Tab "Tool Settings", in "C2000 Linker"/"File Search Path", add a search path: ${INSTALLROOT_F2837XD}/headers/cmd, also a add a library file: F2837xD_Headers_nonBIOS_cpu1.cmd (--library, -I).
  6. Create src and inc folder i
@rikka0w0
rikka0w0 / WSL_x86.md
Last active October 22, 2020 06:51
Run x86 native Linux binary on WSL

microsoft/WSL#2468

Install qemu and binfmt

sudo apt update
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'

You will need to reactivate this every time you restart WSL and want i386 support:

@rikka0w0
rikka0w0 / dyndns.md
Last active October 21, 2019 00:25
Tweak Netgear D6200

Update dynamic DNS records on Google Domain every hour

Script

#!/bin/sh

### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
@rikka0w0
rikka0w0 / sunxi_fel.md
Last active May 10, 2022 01:29
sunxi_fel.md
@rikka0w0
rikka0w0 / licheepi_nano_squashed_rw_root.md
Last active July 20, 2023 13:47
SquashFS + JFFS2 root on LicheePi Nano

In order to save space on the SPI flash, SquashFS + JFFS2 should be used.

SPI Flash structure

Partition	Content		Offset		Size (byte)
mtd0		uboot-bin	0		0x58000 (360448)
		uboot-env	0x58000		0x8000
mtd1		dtb		0x60000		0x4000  (16kB)
mtd2		kernel		0x64000		0x400000 (4MB)
mtd3 rootfs 0x464000	0x4FC000 (4.98MB)
@rikka0w0
rikka0w0 / docker_ubuntu_image.md
Last active April 17, 2020 12:12
Setup a ubuntu cross compiling environment for arm
# Install docker and create a container
sudo apt install -y docker.io
sudo docker pull ubuntu:18.04

# create a container, bind folder ~/licheepi on the host side to /root inside the container
sudo docker start -ti -v ~/licheepi:/root ubuntu:18.04 /bin/bash

Start the container with a shell:

sudo docker start -i <container name>

@rikka0w0
rikka0w0 / l4d2_mirror.sh
Created October 17, 2019 16:05
A bash script to duplicate a newly installed l4d2 server
#!/bin/bash
# $1 - Return Variable, $2 - input relative path
function get_full_path() {
local __resultvar=$1
local myresult="$(cd "$(dirname "$2")"; pwd -P)/$(basename "$2")"
eval $__resultvar="'$myresult'"
}
# $1 src, $2 dst, $3 and so on are blacklisted filename
@rikka0w0
rikka0w0 / NoImmersiveWin10.md
Last active September 22, 2023 08:30
Get rid of the immersive menu in Win10 1809 and above
  1. Download tools: ResourceHacker and mssstyleEditor, then unpack them
  2. Download resources: Win8 theme for Win10, and then uppack it, we will need 'Windows 8 RP Themes for Windows 10\Theme\Themes For 10 Build 14393 Anniversary Update\Windows 8 RP\aero 8 RP.msstyle'.
  3. Open it with ResourceHacker, export IMAGE 1055:0 and IMERSIVE 1:0.
  4. Make a backup of the original aerolite.msstyles and make a copy of it to your working folder (arbitary)
  5. Open it with ResourceHacker, Go to 'Action -> Add an Image or Other Binary Resource' or hit Ctrl+M to open the "Add Binary Resource" Dialog. Choose the menu image resource file that is going to be used, then change the "Resource Type" to IMAGE and resource name to be what ever available, in my case, 993.
  6. Change the value of IMERSIVE 1:0, by importing the data from "aero 8 RP.msstyle"
@rikka0w0
rikka0w0 / pxe_tftp_openwrt.md
Last active January 3, 2024 13:15
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 '?'