Finetune Whisper

August 22, 2024 · 0 min · Gray King

FFmpeg

tags: Tools

August 19, 2024 · 1 min · Gray King

Ubuntu FFmpeg4 PPA

tags: Linux, FFmpeg source: https://askubuntu.com/a/1360862 sudo add-apt-repository ppa:savoury1/ffmpeg4 sudo apt-get update sudo apt-get install ffmpeg

August 19, 2024 · 1 min · Gray King

FreeBSD Flushing Network Cache Solved Samba Writing Issue

tags: FreeBSD source: https://forums.freebsd.org/threads/samba-share-permission-privilege-changed-since-update.90685/post-626157 I’m running a Samba4 on the FreeBSD 14 system. I couldn’t write content to that share filesystem after a system rebooting. After running the below command, the write permission is back: service samba_server stop net cache flush # -> tdb(/var/db/samba4/gencache.tdb): tdb_rec_read bad magic 0x10878 at offset=67584 service samba_server start

July 11, 2024 · 1 min · Gray King

Rust std::borrow::Cow

ref: Rust, Rust Borrow and Lifetimes 发现一个 Cow 用处,可以让变量支持同时赋值引用类型和值类型,场景就是我们可能接收到一个引用,同时可能需要把它变成值类型做一些处理,我们可以通过 clone 或 to_owned 统一变成值类型: fn maybe_need_to_change(s: &str) { let s = if s.starts_with("xxx") { manipulate(s) } else { s.to_owned() // 存在额外的开销 }; take_reference(&s); // s.into_owned() 可以得到 String 类型的值 } fn manipulate(s: &str) -> String { s.to_owned() } fn take_reference(s: &str) { } 另外一种方式就是通过 Cow 避免不必要的 clone 开销: fn maybe_need_to_change(s: &str) { let s = if s.starts_with("xxx") { Cow::from(manipulate(s)) } else { Cow::from(s) // 没有额外的开销 }; take_reference(&s); } fn manipulate(s: &str) -> String { s.to_owned() } fn take_reference(s: &str) { }

May 6, 2024 · 1 min · Gray King