Skip to content

Instantly share code, notes, and snippets.

View xqm32's full-sized avatar
🎯
Focusing

Qiming Xu xqm32

🎯
Focusing
View GitHub Profile
@xqm32
xqm32 / wsc.py
Last active March 23, 2025 11:10
#!/usr/bin/env -S uv run --script --quiet
# /// script
# requires-python = ">=3.13"
# dependencies = []
# ///
import json
from pathlib import Path
import shutil
@xqm32
xqm32 / gacha.go
Created February 21, 2025 16:09
Gacha
package gacha
import "math/rand/v2"
var (
Char5Prob = []int{
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 660, 1260, 1860, 2460, 3060, 3660, 4260, 4860, 5460, 6060, 6660, 7260, 7860, 8460, 9060,
package style
import (
"os"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
"github.com/samber/lo"
"golang.org/x/term"
)
@xqm32
xqm32 / minesweeper.go
Created August 21, 2024 07:10
Minesweeper Game in Go
package main
import (
"math/rand/v2"
"strconv"
)
// The game config
type Config struct {
Width int
#!/usr/bin/env python
# 修改所有论坛链接,需要 Python>=3.12
# 使用方法:
# uv venv
# uv pip install dotenv mwclient
# export USERNAME=你的维基账号
# export PASSWORD=你的维基密码
# .venv/bin/python edit.py
@xqm32
xqm32 / alacritty.md
Last active March 25, 2025 15:52
Automatically switch color theme for Alacritty on macOS

Original issue comment: alacritty/alacritty#5999 (comment)

Run the following command to clone themes:

mkdir -p ~/.config/alacritty/themes
git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes

Add the following content to ~/.config/alacritty/alacritty.toml:

import { $ } from 'bun'
async function compile(code: string) {
const hasher = new Bun.CryptoHasher("sha256").update(code)
const destination = hasher.digest("hex").substring(0, 6) + ".c"
Bun.write(destination, code)
await $`gcc ${destination} -o ${destination}.out`
const output = await $`./${destination}.out`.text()
console.log(output)
}

Windows Subsystem for Linux Setup

APT

Install zsh and change the login shell to zsh.

Homebrew

Install necessary zsh plugins and activate them in .zshrc.

@xqm32
xqm32 / fish.md
Last active January 22, 2024 06:11
Fish Shell Setup
install fish and setup fish shell
install homebrew and config homebrew
use homebrew install starship and set preset to plaintext
use homebrew install pyenv and pipx
install nvm and sdkman via script
install fisher for fish shell plugin
use fisher install nvm.fish and sdkman-for-fish
@xqm32
xqm32 / GLFH.md
Created December 19, 2023 14:40
Graceful Launch for HMCL