Skip to content

Instantly share code, notes, and snippets.

View tiye's full-sized avatar
💭
Make Cirru great again!

题叶 tiye

💭
Make Cirru great again!
View GitHub Profile
@tiye
tiye / rust-compile.log
Created March 5, 2025 07:14
some logs compiling Rust locally
Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.98s
WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 127866` at the top of `config.toml`
Building stage0 library artifacts (aarch64-apple-darwin)
Compiling cc v1.0.99
Compiling core v0.0.0 (/Users/jon.chen/work/container/rust/library/core)
Compiling libc v0.2.155
Compiling memchr v2.5.0
Compiling std v0.0.0 (/Users/jon.chen/work/container/rust/library/std)
@tiye
tiye / AttractorView.swift
Last active February 6, 2025 10:14
outdated demo of attractor rendering in visionOS
import Metal
import RealityKit
import SwiftUI
struct AttractorView: View {
let rootEntity: Entity = Entity()
let allSize: Int = 200000
var vertexCapacity: Int {
return allSize * 4
}
@tiye
tiye / cp.sh
Created January 17, 2025 17:59
Calcit command for copy oneliner
caps download calcit-lang/calcit-clipboard@main
cr eval --dep calcit-clipboard/ 'thread-first (range 100) (map inc) (.join-str "|,") clipboard.core/copy!'
@tiye
tiye / ga4-multiply.txt
Last active December 1, 2024 05:00
expanding 4D geometric algebra multiplication
/// struct holding 4D geometric algebra(contains faults....)
struct GometricAlgebra4D {
s: f32;
x: f32;
y: f32;
z: f32;
w: f32;
xy: f32;
yz: f32;
@tiye
tiye / respo-mbt-intro.md
Last active November 1, 2024 14:42
Respo MoonBit intro

MoonBit Respo

一些介绍和迁移感受


关于我

题叶. 工作前几年专注 React 单页面应用. 对 Rust, WebGPU 感兴趣. Calcit 脚本语言.

@tiye
tiye / 2.log
Last active October 28, 2024 08:35
strace curl 局部日志
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0
sendto(3, "\2\0\0\0\r\0\0\0\6\0\0\0hosts\0", 18, MSG_NOSIGNAL, NULL, 0) = 18
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=3, revents=POLLIN|POLLHUP}])
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="hosts\0", iov_len=6}, {iov_base="\310O\3\0\0\0\0\0", iov_len=8}], msg_iovlen=2, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[4]}], msg_controllen=20, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 14
mmap(NULL, 217032, PROT_READ, MAP_SHARED, 4, 0) = 0x7fcecddc1000
close(4) = 0
close(3) = 0
1
00:00:00,100 --> 00:00:02,533
嘿,朋友们,这里是Visionary 3D
2
00:00:02,533 --> 00:00:03,700
今天我们将
3
00:00:03,700 --> 00:00:06,766
@tiye
tiye / sum-type-prompt.md
Created September 2, 2024 06:38
让 GPT, Gemini 生成个文章..

以 Rust 语言为例, 深入介绍 Sum Type 对于程序简洁和可靠性带来的帮助. 跟 TypeScript 当中的写法做对比. 文章分成 3 个大的部分.

第一部分介绍什么是 Sum Type(特别是带参数的情况), 比如在 Rust 当中的有哪些语法, 详细展示一下. 然后展开介绍 Sum Type 在其他编程语言的使用历史和经验, 业界怎样一步步接受 Sum Type 的使用.

第二部分展示一下 TypeScript 当中模拟带参数的 sum type 的用法, 分析一下对比 Rust 当中写法的优势和劣势. 注意提供一个案例来读取数据. 分别基于 tagged union 写法, 跟 interface 写法, 来展示和对比.

第三部分基于 Rust 的 Sum Type 展示一个业务的场景, 配合 Pattern Matching 用一段较复杂的逻辑来展示实用性. 特别是写一个例子来展示出在代码变更时, 模式匹配配合类型, 在代码的可靠性上的优势. 展示一下 Rust 是如何帮你避免因为业务变更写出 Bug 的, 比如增加一个新的 Variant, 通过代码展示一下 Rust 编译器怎样提示出现的错误.

@tiye
tiye / browser-languages.md
Created August 26, 2024 11:30
浏览器原生支持的六大编程语言,你学会了几门?

浏览器原生支持的六大编程语言,你学会了几门?

你是否知道,你的浏览器不仅仅是用来浏览网页的?它其实是一个强大的编程平台,支持着六种原生语言,赋予了网页前所未有的互动性和功能性。你是否已经掌握了这六种语言,并用它们创造出令人惊叹的 web 体验呢?

1. HTML:网页的骨架

HTML(HyperText Markup Language)是网页的基石,负责定义网页内容的结构和语义。它使用标签来标记文本、图像、视频等元素,并通过属性来控制它们的样式和行为。

代码示例:

use image::{ImageBuffer, Rgb};
use num_complex::Complex;
use std::f64::consts::PI;
const WIDTH: u32 = 512;
const HEIGHT: u32 = 255;
const MAX_ITERATIONS: u32 = 99;
fn main() {
let mut img = ImageBuffer::new(WIDTH, HEIGHT);