This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from aiohttp import ClientSession | |
| async def get_file(name, url): | |
| async with ClientSession() as session: | |
| async with session.get(url) as response: | |
| result = await response.read() | |
| print(name, response.status) | |
| async def parallel_on_loop(): | |
| await asyncio.gather( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| async def requests_coroutine(name, url): | |
| print(name, requests.get(url)) | |
| loop = asyncio.get_event_loop() | |
| loop.run_until_complete(requests_coroutine("a", "http://www.google.com")) | |
| loop.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tkinter as tk | |
| import time | |
| import statistics | |
| CIRCLE_X=100 | |
| CIRCLE_Y=120 | |
| CIRCLE_RADIUS=40 | |
| PREVIOUS_ACTION=None | |
| CORRECT_MOVE=True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import java.net.DatagramPacket; | |
| import java.net.InetAddress; | |
| import java.net.MulticastSocket; | |
| import java.net.NetworkInterface; | |
| import java.net.SocketException; | |
| import java.net.UnknownHostException; | |
| /** | |
| * To run: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import math | |
| import pprint | |
| from operator import attrgetter | |
| import logging | |
| logging.basicConfig(filename="queues-sim.log", level=logging.INFO, | |
| filemode="w") | |
| class Shop(object): |