https://learn.microsoft.com/en-us/windows/wsl/wsl-config#network-settings
[boot]
systemd=true
[network]
generateResolvConf=true
https://learn.microsoft.com/en-us/windows/wsl/wsl-config#network-settings
[boot]
systemd=true
[network]
generateResolvConf=true
edge tts
获取语音列表:
tts接口
wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&Sec-MS-GEC=C14242292B2241ECB17DD93BD17E481FADED759D70DCE83CA526064D9E90420C&Sec-MS-GEC-Version=1-114.0.1823.67&ConnectionId=373cb9fe3c926de352de8ad4c800b24c HTTP/1.1
Host: speech.platform.bing.com
import os | |
import sys | |
import zipfile | |
import shutil | |
def unzip_py_env(py_env_zip: str): | |
py_env_dir = py_env_zip.removesuffix('.zip') | |
need_update = not os.path.isdir(py_env_dir) | |
if not need_update: |
#[cfg(target_os = "windows")] | |
extern { | |
// https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode?view=msvc-170 | |
// https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa298581(v=vs.60) | |
fn _setmode(fd: std::os::raw::c_int, mode: std::os::raw::c_int) -> std::os::raw::c_int; | |
// https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/wwfcfxas(v=vs.100) | |
fn _get_errno(p_value: *mut std::os::raw::c_int) -> std::os::raw::c_int; | |
} | |
#[cfg(target_os = "windows")] |
use aes::cipher::block_padding::Pkcs7; | |
use aes::cipher::{KeyIvInit, BlockEncryptMut, BlockDecryptMut}; | |
use rand::RngCore; | |
type Aes256CbcEnc = cbc::Encryptor<aes::Aes256>; | |
type Aes256CbcDec = cbc::Decryptor<aes::Aes256>; | |
const AES256_SECRET_SIZE: usize = 32; | |
const AES256_BLOCK_SIZE: usize = 16; |
#!/usr/bin/env python3 | |
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
from cryptography.hazmat.primitives import padding | |
# https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/ | |
# https://cryptography.io/en/latest/hazmat/primitives/padding/#cryptography.hazmat.primitives.padding.PKCS7 | |
class AES256: | |
KEY_SIZE = 32 | |
BLOCK_SIZE = 16 |
#!/usr/bin/env python3 | |
import os | |
import sys | |
DIR_STACK = [] | |
def pushd(path: str): |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"net/http" | |
"time" | |
) |
use lmdb::{Cursor, Transaction}; | |
fn test_lmdb_dup_sort_update_in_place() -> anyhow::Result<()> { | |
let db_dir = "lmdb-dir"; | |
if let Err(err) = std::fs::remove_dir_all(db_dir) { | |
if err.kind() != std::io::ErrorKind::NotFound { | |
return Err(err.try_into()?); | |
} | |
} |
use lmdb::{Cursor, Transaction}; | |
fn test_lmdb_dup_sort_update_in_place() -> anyhow::Result<()> { | |
let db_dir = "lmdb-dir"; | |
if let Err(err) = std::fs::remove_dir_all(db_dir) { | |
if err.kind() != std::io::ErrorKind::NotFound { | |
return Err(err.try_into()?); | |
} | |
} |