Skip to content

Instantly share code, notes, and snippets.

View xqm32's full-sized avatar
🎯
Focusing

Qiming Xu xqm32

🎯
Focusing
View GitHub Profile
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Micro Drift (Osmos-like)</title>
<style>
html, body {
margin: 0;
height: 100%;
{
"$defs": {
"GroupConfig": {
"properties": {
"name": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"default": null,
"title": "Name"
},
"schedule": {
#!/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 May 30, 2025 12:39
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.