Skip to content

Instantly share code, notes, and snippets.

@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 02:50
Rust の hyper + tokio で HTTPS + HTTP/2 サーバー
[package]
name = "http_server_min"
version = "0.1.0"
edition = "2021"
build = "build.rs"
[dependencies]
hyper = { version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["tokio", "server", "http1", "http2"] }
tokio = { version = "1", features = ["full"] }
@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 02:42
hyper でテキストファイルを表示する HTTP/1 サーバー
[package]
name = "http_server_min"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1.4", features = ["full"] }
hyper = { version = "1.6", features = ["http1", "http2", "server"] }
hyper-util = { version = "0.1", features = ["server-auto", "tokio"] }
http-body-util = "0.1"
@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 02:13
hyper + tokio による HTTP/1 サーバー
[package]
name = "http_server_min"
version = "0.1.0"
edition = "2024"
[dependencies]
tokio = { version = "1.4", features = ["full"] }
hyper = { version = "1.6", features = ["http1", "server"] }
hyper-util = { version = "0.1", features = ["server-auto", "tokio"] }
http-body-util = "0.1"
@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 02:00
Axum v0.8.4 h2c サーバー
[dependencies]
axum = { version = "0.8", features = "http2" }
tokio = { version = "1", features = ["full"] }
hyper = { version = "1", features = ["http2", "server"] }
hyper-util = { version = "0.1", features = ["tokio"] }
@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 01:50
Axum v0.8.4 HTTPS・HTTP/2 サーバー
[package]
name = "axum_project"
version = "0.1.0"
edition = "2024"
[dependencies]
axum = { version = "0.8", features = ["http2"] }
tokio = { version = "1", features = ["full"] }
hyper = { version = "1", features = ["http1", "http2", "server"] }
hyper-util = { version = "0.1", features = ["tokio"] }
@masakielastic
masakielastic / Cargo.toml
Last active June 13, 2025 01:40
Axum v0.8.4 HTTP/1 サーバー最小構成
[dependencies]
axum = { version = "0.8" }
tokio = { version = "1", features = ["full"] }
@masakielastic
masakielastic / cursor.desktop
Last active June 3, 2025 03:00
Chromebook で Cursor のランチャー登録。~/.local/share/applications/cursor.desktop を設置。参考資料として VOICEVOX の voicevox.desktop も添付
[Desktop Entry]
Name=Cursor
Comment=AI Powered Code Editor
Exec=/home/username/Apps/cursor/Cursor.AppImage --no-sandbox %U
Icon=/home/username/Apps/cursor/icon.png
Terminal=false
Type=Application
StartupWMClass=Cursor
Categories=Development;IDE;
@masakielastic
masakielastic / gemini.md
Last active April 18, 2025 23:50
Gemini 2.0 Flash でぬいぐるみの写真を生成するプロンプト
「優しい朝の雰囲気のぬいぐるみ写真」のイメージを描写してください。

条件:
- 白や淡い色のテディベアが被写体
- 朝の柔らかい自然光が差し込む窓辺のシーン
- 小物(本、マグカップ、ブランケットなど)を使ってやさしい雰囲気を演出
- 構図やカメラの角度、光の向きにも触れてください
- 文量は150~200字程度、初心者にもわかるように
pub fn h2frames() []const u8 {
return
// PRI
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" ++
// SETTINGS
"\x00\x00\x0C" ++
"\x04" ++
"\x00" ++
"\x00\x00\x00\x00" ++
"\x00\x02\x00\x00\x00\x00" ++
size_t h2frames_size(void) {
return 24 + 0xC + 9 + 0x00 + 9 + 0x3A + 9;
}
uint8_t *h2frames(void) {
return
// PRI
"PRI * HTTP/2.0\x0D\x0A\x0D\x0ASM\x0D\x0A\x0D\x0A"
// settings
"\x00\x00\x0C"