Skip to content

Instantly share code, notes, and snippets.

View efwfe's full-sized avatar
🫥
hello there.

efwfe efwfe

🫥
hello there.
View GitHub Profile
@efwfe
efwfe / installer.sh
Last active December 19, 2024 03:13
bash install docker nvidia toolkit
#!/bin/bash
## install docker and docker nvidia-toolkit
sudo apt-get update
sudo apt-get install ca-certificates wget curl gcc g++ cmake git -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
@efwfe
efwfe / aproducer.py
Created June 15, 2021 07:12 — 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:
@efwfe
efwfe / pubsub.py
Created August 11, 2019 14:34 — forked from appeltel/pubsub.py
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@efwfe
efwfe / download_multiple.py
Created July 22, 2019 10:21 — forked from Hammer2900/download_multiple.py
Use asyncio and aiohttp to asynchronously download multiple files at once and handle the responses as they finish
import asyncio
from contextlib import closing
import aiohttp
async def download_file(session: aiohttp.ClientSession, url: str):
async with session.get(url) as response:
assert response.status == 200
# For large files use response.content.read(chunk_size) instead.