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
use std::time::{Duration, Instant}; | |
use async_io::{block_on, Timer}; | |
use async_stream::stream; | |
use futures::StreamExt; | |
use futures_lite::future::yield_now; | |
fn main() { | |
let result = block_on(async { | |
stream! { | |
loop { | |
yield async { |
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
use std::pin::pin; | |
use std::time::{Duration, Instant}; | |
use async_io::{block_on, Timer}; | |
use async_stream::stream; | |
use futures::StreamExt; | |
use futures_lite::future::yield_now; | |
async fn item() -> Duration { | |
let start = Instant::now(); |
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
use snafu::Snafu; | |
use std::future::Future; | |
use std::pin::Pin; | |
use std::thread; | |
use tokio::runtime::Builder; | |
use tokio::sync::mpsc; | |
use tokio::sync::mpsc::Receiver; | |
use tokio::sync::mpsc::Sender; | |
use tokio::task::{spawn_local, LocalSet}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQINBF6n+K0BEAChGyyyxLlkJ8CUD/hd6XlJQHAg1+/THhxR4UcYoDcnGO2iJPUE | |
WQpDARt7A3ot7bj6L0l7QLahHF/M4XHe8pDs/uNgmPzOq9rCwQ8mVcUpblZ6Fmks | |
HrBe3nmYk3sESeowOjwRaIKHSAjc/rwCd6A0xdk+YI8Pfe3QZhV+CZ2E1JSkxigB | |
ReveybwemY3V730wX2vVksBh+JwCDkYFKD4aZuHMcbTDqZyJFYV4TkkEOF2Zgp9+ | |
bfmCL1XMZpSVw/xGVoOHS8t6U/M0OlSVl7aPqOw9Hdr4DSIfWVe2vXJ7Vf8gdEUO | |
To/XeHzFtIhI8PkxpI2GR2mngCLoEo/DKXMY31bE8Hg/Tr1qx/huSqboRh4Jt7DJ | |
m0MViPWjz1hJx1/wTCr1IH1dB369WuAGLnLRM0gu+Qv5vBVTVUg+ZAQlZTUxRo1J | |
83qcdrSgO/orxIId4X5xh1RetUqhS2GE2KyXMbNqdKczGlkrC8pTsUGTICw5+fWH |
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
function f() | |
cnt = 1 | |
function add() | |
cnt += 1 | |
cnt | |
end | |
end | |
a = f() | |
println(a()) |
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
def foo | |
cnt = 0 | |
return lambda { | |
cnt += 1 | |
return cnt | |
} | |
end | |
func = foo |
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
function [ freq ] = HPS(audiofile) | |
CORRECTFACTOR=1; | |
[sample, fs] = audioread(audiofile); | |
fftn = fs; | |
sample = sample .* hann(length(sample)); | |
fftr = abs(fft(sample,fftn)); | |
fftr = fftr(1:fftn/2); | |
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 multiprocessing import Pool | |
import requests | |
def process_url(url): | |
print('start') | |
requests.get(url) | |
print('done') | |
return |
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
import asyncio | |
async def sleep(): | |
print('start') | |
try: | |
await asyncio.sleep(100) | |
except: | |
print('canceld') |
NewerOlder