Skip to content

Instantly share code, notes, and snippets.

https://www.aeracode.org/2018/02/19/python-async-simplified/
def get_chat_id(name):
# blocking code
return Chat.objects.get(name=name).id
async def main():
executor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
loop = asyncio.get_event_loop()
result = await loop.run_in_executor(executor, get_chat_id, "django")
# https://blog.adriel.co.nz/2018/01/25/change-docker-data-directory-in-debian-jessie/
sudo nano /etc/docker/daemon.json
{
"data-root": "/new/path/to/docker-data"
}
sudo systemctl stop docker
sudo rsync -axPS /var/lib/docker/ /new/path/to/docker-data
git submodule add https://github.com/facebook/duckling libs/duckling
git add libs/duckling
git commit -m "add duckling module"
git submodule update --init libs/duckling/
To remove a submodule you need to:
Delete the relevant section from the .gitmodules file.
Stage the .gitmodules changes git add .gitmodules
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Run rm -rf .git/modules/path_to_submodule (no trailing slash).
Commit git commit -m "Removed submodule "
Delete the now untracked submodule files rm -rf path_to_submodule