Skip to content

Instantly share code, notes, and snippets.

@odoku
odoku / coroutine.py
Created May 10, 2019 07:18
python - coroutine
import asyncio
async def wait():
print('Waiting')
for x in range(10 ** 100):
z = 10 + 20
print('Done')
#!/bin/bash
set -eu
# Install PyEnv
if [ ! -e ~/.pyenv ]; then
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
from typing import Type, TypeVar, Union
import numpy as np
Number = TypeVar("TypeVar", int, float)
class Rectangle(np.ndarray):
def __new__(
cls,
import hashlib
def compute_file_checksum(
filepath: str,
algorithm: str = "md5",
chunk_size: int = 1024,
) -> str:
hasher = hashlib.new(algorithm)
with open(filepath, "rb") as fp: