This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
风雪渐披肩,入夜阑火蜷 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokio::runtime::Builder::new_multi_thread().worker_threads(4).enable_all().build().unwrap().block_on( | |
async{ | |
let mut handles = Vec::with_capacity(8); | |
for i in 1..4{ | |
let joinhandle = tokio::spawn(async move{ | |
tokio::task::yield_now().await; | |
co_run(i).await; | |
}); | |
handles.push(joinhandle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let piano_frequencys = [ | |
27.500, 29.135, 30.868, 32.703, 34.648, 36.708, 38.891, 41.203, | |
43.654, 46.249, 48.999, 51.913, 55.000, 58.270, 61.735, 65.406, | |
69.296, 73.416, 77.782, 82.407, 87.307, 92.499, 97.999, 103.826, | |
110.000, 116.541, 123.471, 130.813, 138.591, 146.832, 155.563, 164.814, | |
174.614, 184.997, 195.998, 207.652, 220.000, 233.082, 246.942, 261.626, | |
277.183, 293.665, 311.127, 329.628, 349.228, 369.994, 391.995, 415.305, | |
440.000, 466.164, 493.883, 523.251, 554.365, 587.330, 622.254, 659.255, | |
698.456, 739.989, 783.991, 830.609, 880.000, 932.328, 987.767, 1046.502, | |
1108.731, 1174.659, 1244.508, 1318.510, 1396.913, 1479.978, 1567.982, 1661.219, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut file = File::options().read(true).write(true).open("json.txt").unwrap(); | |
let mut file_reader = BufReader::new(file); // Rust文件读写是无缓冲的, 使用BufReader/BufWriter为文件读写增加缓冲 | |
let mut result = String::new(); | |
let mut result2 = String::new(); | |
// Rust 文件操作会改变seek位置,且多个clone共享。当某个clone read_to_string后,此时file已经到EOF,其他clone再读也是空。必须重置seek | |
// let seek = file.seek(std::io::SeekFrom::Current(0)).unwrap(); | |
// file.try_clone().unwrap().read_to_string(&mut result).unwrap(); | |
// file.seek(std::io::SeekFrom::Start(seek)).unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageGrab | |
from plyer import notification | |
import time | |
import numpy as np | |
import pytesseract | |
import easyocr | |
import keyboard | |
class TesseractOcr: | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* at https://github.com/microsoft/WSL/discussions/4872 | |
> touch /etc/fstab | |
> update-alternatives --set iptables /usr/sbin/iptables-legacy | |
> update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy | |
> service docker start |