Skip to content

📝 Programming Guide and Learning Notes, web scraping, frontend development, handheld gaming | 爬虫,网页前端,游戏机配置. Built with Jekyll

Notifications You must be signed in to change notification settings

dev-chenxing/learning-notes

Repository files navigation

📝 Programming Guides and Learning Notes

Create React Project with Vite

Requirements: Node.js

To get started with Vite, open the terminal and navigate up one directory from the target directory. For example, if you would like the project scaffolded in D:\react-with-vite, run the below command in D:\.

npm create vite@latest

Then, run:

cd $PROJECT_NAME
npm install
npm run dev

Install Node.js

Download Node.js (LTS) on nodejs.org.

Miyoo Mini Plus Starter Guide

Backup BIOS and Roms

The BIOS files from the stock operating system are located in \RetroArch\.retroarch\system. The Rom files are located in \Roms.

Install OnionOS

Download Onion Desktop Tools and run the _Onion Desktop Tools - Launcher.bat to format SD card in FAT32 and install Onion.

Once it's done, eject the SD card from our computer. Plug it into the Miyoo Mini Plus and power it on. The installation process will begin automatically.

Package Manager

After the installation is complete, install emulators and apps in the package manager:

  • NEC - TurboGrafx-16
  • Nintendo - DS
  • Nintendo - GBA
  • Nintendo - Game Boy Color
  • Nintendo - NES
  • Nintendo - SNES
  • Sega - Genesis
  • Sega - Master System
  • Sega - CD
  • Sega - Game Gear

Press START to install. Then shut down the device, eject the SD card, and put it back into the computer.

Install BIOS

Move the following BIOS files to the \BIOS folder:

  • SEGA CD: bios_CD_E.bin, bios_CD_J.bin, bios_CD_U.bin
  • Sega Game Gear: bios.gg
  • Game Boy: gb_bios.bin
  • Game Boy Advance: gba_bios.bin
  • Game Boy Color: gbc_bios.bin
  • Neo Geo: neogeo.zip (Keep it in both the /BIOS folder and the /Roms/NEOGEO folder to ensure best compatibility)
  • PlayStation: scph5501.bin
  • PC Engine: syscard1.pce, syscard2.pce, syscard3.pce

Install Roms

Move the ROM files to the subfolders within the \Roms folder:

  • Arcade: ARCADE
  • NES: FC
  • Game Boy: GB
  • Game Boy Advance: GBA
  • Game Boy Color: GBC
  • Sega Game Gear: GG
  • Sega Genesis: MD
  • Sega - Master System: MS
  • NDS: NDS
  • Neo Geo: NEOGEO
  • TurboGrafx-16: PCE
  • PlayStation: PS
  • Sega CD: SEGACD
  • SNES: SFC

More information please check the Onion Docs!

Install Themes and Icons

Themes and icon packs can be downloaded from here.

Unzip the downloaded theme to the /Themes folder and apply it with the ThemeSwitcher app.

Unzip the downloaded icon pack to the /Icons folder. To install the icon pack, use the Tweaks app, 'Apperance' -> 'Icons packs...' -> 'Apply icon pack...'.

Beautiful Python Terminal Styling with Rich

Install Rich

pip install rich

Import the alternative print function which does basic syntax highlighting for the printed text.

from rich import print

It is also requried for printing Rich renderables, such as Panel.

from rich.panel import Panel

print(
    Panel(
        "Lorem ipsum dolor sit amet",
        style="bold red",               # set the font color and style
        border_style="bright_white",    # set the border color
        width=48,                       # set the panel width
    )
)

Scrapy - Python Web Scraping

Install Scrapy

First, create a new virtual environment.

python -m pip install --upgrade pip # upgrade pip
python -m venv venv
venv\Scripts\activate               # or source venv/bin/activate if you are on Linux

Then, install the Scrapy package.

pip install scrapy

You should also install IPython, which makes the Python console more user-friendly, since you will be using the Scrapy shell a lot during the development of Scrapy spiders.

pip install ipython

Start Scrapy Project

Start a Scrapy project in the current directory. Note that the project name should be the same with the folder name.

scrapy startproject <project_name> .
scrapy genspider example example.com

Here, example would be the name of the spider, and example.com would be the allowed domain.

Run the Scrapy Spider

scrapy crawl example

Create Word Documents with Python: python-docx

Install the python-docx package

pip install python-docx

Here is an example of what python-docx can do:

![](py/Lorem Ipsum.png)

from docx import Document
from docx.shared import Pt, Cm, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH

file_name = "Lorem Ipsum"
directory = ""

# create the document
doc = Document()                                            

# set margin to 2 cm
section = doc.sections[0]
section.left_margin, section.right_margin = Cm(2), Cm(2)    

normal_style = doc.styles["Normal"]
normal_font = normal_style.font
normal_font.name = "Helvetica"                  # set font family
normal_font.size = Pt(12)                       # set font size to 12pt
normal_paragraph_format = normal_style.paragraph_format   
normal_paragraph_format.line_spacing = Pt(14)   # set line spacing to 14pt

# add a centered paragraph
center_paragraph = doc.add_paragraph("Lorem ipsum")
center_paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER      

# add a plain paragraph
doc.add_paragraph("Lorem ipsum dolor sit amet, ")           

# add a paragraph with color red
red_paragraph = doc.add_paragraph("consectetur adipiscing elit, ")
red_paragraph.runs[0].font.color.rgb = RGBColor(0xFF, 0x00, 0x00)  

# add a paragraph with color blue
blue_paragraph = doc.add_paragraph(
    "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ")
blue_paragraph.runs[0].font.color.rgb = RGBColor(0x00, 0x00, 0xFF) 

# save the document to the output path
output_path = f"{directory}{file_name}.docx"
doc.save(output_path)

⬆️ Back to the Top

About

📝 Programming Guide and Learning Notes, web scraping, frontend development, handheld gaming | 爬虫,网页前端,游戏机配置. Built with Jekyll

Topics

Resources

Stars

Watchers

Forks