Skip to content

Instantly share code, notes, and snippets.

@fdeh75
fdeh75 / deploy.sh
Created July 14, 2023 08:33
Docker image simple geploy
#!/usr/bin/bash
set -x
set -e
DEPLOY_HOST=${1}
if [ -z "$DEPLOY_HOST" ]
then
echo 'DEPLOY_HOST is undefined'
exit 1
@fdeh75
fdeh75 / await.py
Created March 18, 2019 07:13 — forked from chrisseto/await.py
from IPython.core.magic import Magics, magics_class, line_magic
import asyncio
@magics_class
class AsyncMagics(Magics):
@line_magic
def await(self, line):
return asyncio.get_event_loop().run_until_complete(eval(line, self.shell.user_global_ns, self.shell.user_ns))
@fdeh75
fdeh75 / asyncio_loops.py
Created March 18, 2019 07:06 — forked from lars-tiede/asyncio_loops.py
asyncio + multithreading: one asyncio event loop per thread
import asyncio
import threading
import random
def thr(i):
# we need to create a new loop for the thread, and set it as the 'default'
# loop that will be returned by calls to asyncio.get_event_loop() from this
# thread.
loop = asyncio.new_event_loop()