Skip to content

Instantly share code, notes, and snippets.

Avatar

Kiollpt

View GitHub Profile
View sqs.py
sqs= boto3.resource('sqs', aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SECRET_ACCESS_KEY,
region_name = REGION_NAME)
def receive_message_from_sqs(spider,delete=True):
queue = sqs.get_queue_by_name(QueueName=spider)
rows = []
View nginx.ini
[uwsgi]
module = application:app
master = true
processes = 3
chdir = YOUR_PROJECT_PATH
socket = YOUR_SOCK_FILE_PATH
chmod-socket = 777
vacuum = true
View test.py
print('I am hungry Friday and Saturday is beautiful day')
View color print.py
c = (
"\033[0m", # End of color
"\033[36m", # Cyan
"\033[91m", # Red
"\033[32m", # Green
)
@Kiollpt
Kiollpt / sleep.py
Last active Sep 2, 2020
async sleep #asyncio
View sleep.py
from threading import Thread
from threading import current_thread
from asyncio import Future
import asyncio
import time
c = (
"\033[0m", # End of color
"\033[36m", # Cyan
"\033[91m", # Red
@Kiollpt
Kiollpt / quene.py
Last active Sep 6, 2020
quene #asyncio
View quene.py
import asyncio
import itertools as it
import os
import random
import time
async def makeitem(size: int = 5) -> str:
return os.urandom(size).hex()
async def randsleep(a: int = 1, b: int = 5, caller=None) -> None:
View Outline.md

ch1

thinking about the data system

View main.py
if __name__ == "__main__":
View 1.py
from aiohttp import gather, create_task
from string import Template
from aiohttp import web, ClientSession
from bs4 import BeautifulSoup
async def news(request):
sites = [
('http://edition.cnn.com',cnn_articles),
('http://www.aljazeera.com',aljazeera_articles)
]