Skip to content

Instantly share code, notes, and snippets.

@dabeaz
dabeaz / aproducer.py
Created October 17, 2019 17:46
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 - https://www.youtube.com/watch?v=Y4Gt3Xjd7G8
# aproducer.py
#
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
@guojianwei001
guojianwei001 / program.cs
Last active May 30, 2022 13:01
Convert old BeginRead/EndRead asyn method to async/await method; implete a simple FromAsync similar to Task.Factory.FromAsync
#nullable enable
using System;
using System.IO;
using System.Threading.Tasks;
namespace AsyncAwaitPlay
{
class Program
{
/*
@guojianwei001
guojianwei001 / aproducer.py
Created June 1, 2022 12:49 — forked from dabeaz/aproducer.py
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 - https://www.youtube.com/watch?v=Y4Gt3Xjd7G8
# aproducer.py
#
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
@FrankFang
FrankFang / lambda.js
Last active January 7, 2024 15:14
λ演算
ZERO = f => x => x
ONE = f => x => f(x)
TWO = f => x => f(f(x))
THREE = f => x => f(f(f(x)))
FOUR = f => x => f(f(f(f(x))))
FIVE = f => x => f(f(f(f(f(x)))))
SIX = f => x => f(f(f(f(f(f(x))))))
SEVEN = f => x => f(f(f(f(f(f(f(x)))))))
EIGHT = f => x => f(f(f(f(f(f(f(f(x))))))))
NINE = f => x => f(f(f(f(f(f(f(f(f(x)))))))))