Skip to content

Instantly share code, notes, and snippets.

@HuakunShen
HuakunShen / effect-style.ts
Last active September 25, 2025 14:20
effect
import { Cause, Effect, Layer, Logger } from "effect";
import { NodeRuntime } from "@effect/platform-node";
import { DevTools } from "@effect/experimental";
import { NodeSdk } from "@effect/opentelemetry";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
import { trace, context } from "@opentelemetry/api";
@HuakunShen
HuakunShen / main.go
Created August 25, 2025 06:54
Pocketbase + Turso
package main
import (
"log"
"os"
"strings"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/apis"
@HuakunShen
HuakunShen / results.md
Created July 13, 2025 09:27
Web Framework Benchmark

For Hono and Elysia, bun is used as the runtime

Test Machine is Ubuntu 24.04, i7-13700k, 24 logical cores

Hello Benchmark

Framework Score
gin hello 755,416
hono 199,423
@HuakunShen
HuakunShen / sqlite.rs
Created December 13, 2024 01:06
Surrealdb Insert Speed Comparison with sqlite
// https://datasets.imdbws.com/name.basics.tsv.gz
use anyhow::{Context, Result};
use csv::ReaderBuilder;
use rusqlite::{params, Connection};
use std::time::Instant;
fn main() -> Result<()> {
let start = Instant::now();
// Create SQLite database and table
@HuakunShen
HuakunShen / monitor-app-switch.swift
Created December 12, 2024 10:01
Swift Monitor Active App Switching
import Cocoa
import Foundation
class AppSwitchMonitor {
let workspace = NSWorkspace.shared
var observers: [NSObjectProtocol] = []
func startMonitoring() {
// Monitor active application changes
let appObserver = workspace.notificationCenter.addObserver(
@HuakunShen
HuakunShen / deno.d.ts
Created November 3, 2024 19:49
Deno types for Kunkun
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
/// <reference lib="esnext" />
/// <reference lib="deno.net" />
/** Deno provides extra properties on `import.meta`. These are included here
* to ensure that these are still available when using the Deno namespace in
* conjunction with other type libs, like `dom`.
*
* @category Platform
@HuakunShen
HuakunShen / bun-analyze.ts
Created October 8, 2024 00:03
Analyze Bun Bundle Size Distribution
const bundle = await Bun.file("dist/index.js").text()
const lines = bundle.split("\n")
// console.log(lines);
const commentLineIndices = lines
.map((line, index) => (line.trim().startsWith("//") ? index : -1))
.filter((index) => index !== -1)
console.log(commentLineIndices)
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"description": {
[package]
name = "axum-tonic"
version = "0.1.0"
edition = "2021"
[dependencies]
tonic = "0.11"
prost = "0.12"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
@HuakunShen
HuakunShen / Cargo.toml
Created September 2, 2023 15:44
Rust actix file upload
[package]
name = "rust_http_file_upload"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix = "0.13.1"
actix-multipart = "0.6.1"