I hereby claim:
- I am yeraydiazdiaz on github.
- I am yeray (https://keybase.io/yeray) on keybase.
- I have a public key ASDryYOOFGs1AuHPvXF7x86jHab4IQvfrL1uatweH2jFlQo
To claim this, I am signing this object:
#!/bin/bash | |
set -e | |
if [ -n "$1" ]; then | |
PYTHON_VERSION=$1 | |
else | |
echo "Please specify a Python version, e.g. 3.7.1"; | |
exit 1 | |
fi | |
set +e |
""" | |
A demonstration on how raising KeyboardInterrupt in the context of tasks | |
spawned via asyncio's loop.run_in_executor does not cancel the threads | |
using any of the cancellation methods in asyncio Futures. | |
The only "proper" way to cancel is to: | |
1. unregister the `atexit` registered `_python_exit` function | |
2. call `shutdown(wait=False)` | |
The reason is that the `thread` module registers `_python_exit` forcing a |
""" | |
Basic Twisted example with unit tests using twisted.trial. | |
The snippet below is a most basic Twisted example runnable in an interpreter: | |
``` | |
from twisted.internet import task, reactor | |
d = task.deferLater(reactor, 0.1, lambda: print('foo')) # creates and schedules a Deferred | |
d.addCallback(lambda x: reactor.stop()) # add a callback to stop when completed | |
reactor.run() # run the event loop |
/** | |
* Comparison between lunr1 and lunr2 searching based on MkDocs search index JSON | |
* | |
* Install both versions of lunr: | |
* 1. install Yarn `npm i -g yarn` | |
* 2. yarn add lunr1@npm:[email protected] | |
* 3. yarn add lunr@latest | |
* | |
* `search_index.json` should available in the same directory as this script | |
* Run `node test.js` |
/** | |
* A port of the recursive HN comment calculator used in | |
* "Asyncio Coroutine Patterns" using Node.js async/await | |
* | |
* Assume we want to calculate the number of comments of a particular post in | |
* Hacker News by recursively aggregating the number of descendants. | |
* | |
* Original article at: | |
* https://medium.com/python-pandemonium/asyncio-coroutine-patterns-beyond-await-a6121486656f | |
* |
I hereby claim:
To claim this, I am signing this object: