Skip to content

Instantly share code, notes, and snippets.

@lxl66566
lxl66566 / main.py
Created August 17, 2024 10:18
Test audio speedup by using soundtouch
import ctypes
import math
import numpy as np
import scipy.io.wavfile as wavfile
# 加载DLL
soundtouch_dll = ctypes.CDLL("soundtouch_dll-2.3.3/SoundTouchDLL_x64.dll")
# 定义函数原型
@lxl66566
lxl66566 / build.rs
Created July 29, 2024 09:30
generate some path depended code
use std::fs::OpenOptions;
use std::io::Write;
use std::path::PathBuf;
fn main() -> std::io::Result<()> {
let functions_dir = PathBuf::from("src/functions");
let mut out = String::from("use clap::Command;\n");
let entries = std::fs::read_dir(&functions_dir)?;
let filenames: Vec<_> = entries
@lxl66566
lxl66566 / kv.rs
Created July 15, 2024 10:40
Failed to implement Future for PutFut
use crate::error::Result;
use curp::client::ClientApi;
use futures::{future::BoxFuture, FutureExt};
use pin_project::pin_project;
use std::future::Future;
use std::task::Poll;
use std::{pin::pin, sync::Arc};
use tonic::Status;
use xlineapi::{
command::{Command, CommandResponse, KeyRange, SyncResponse},
@lxl66566
lxl66566 / test.py
Created May 11, 2024 04:42
Typst table with merged cells from excel (forwarded)
import win32com.client
excel = win32com.client.GetActiveObject("Excel.Application")
wb = excel.ActiveWorkbook
sheet = wb.ActiveSheet
selected = excel.Selection
columns = selected.Columns.Count
out = open("output.typ", "w", encoding="utf-8")
out.write(f"#table(columns: {columns}, ")
@lxl66566
lxl66566 / minimal_test.typ
Created December 23, 2023 02:34
typst content.at() will always check 'default' even if the given field exists
#let get_text(knt) = {
let temp = knt.at("body", default: false)
if temp == false { temp = knt.at("text") }
temp
}
#let get_text2(knt) = {
knt.at("body", default: knt.at("text", default: "anything"))
}
#let get_text3(knt) = {
knt.at("body", default: knt.at("text"))