Skip to content

Instantly share code, notes, and snippets.

View hclivess's full-sized avatar
🏠
Working from home

Jan Kučera hclivess

🏠
Working from home
View GitHub Profile
@hclivess
hclivess / async_url_tester.py
Last active June 30, 2022 16:05
async url tester
import aiohttp
import asyncio
async def test(ip):
async with aiohttp.ClientSession() as session:
async with session.get(ip) as response:
print(f"Running test for: {ip}")
html = await response.text()
@hclivess
hclivess / para.py
Last active June 20, 2022 01:05
Simplest parallel asyncio
import asyncio
import time
async def function1():
await asyncio.sleep(2)
print("a")
async def function2():
print("b")
@hclivess
hclivess / tornado_threaded.py
Last active June 19, 2022 23:32
Simplest possible threaded Tornado server
import tornado.ioloop
import tornado.web
import threading
import time
class ReadHandler(tornado.web.RequestHandler):
def get(self):
self.write("hello world")
@hclivess
hclivess / jazyk_lasky.py
Created December 14, 2021 20:25
jazyk_lasky
# coding=utf-8
odpovedi = []
def pokracuj():
print("")
print(input("*Pokračujte stisknutím libovolné klávesy*"))
class Drak:
def __init__(self):
self.hp = 100
class RybiKosik:
def __init__(self):
self.pocet = 0
drak = Drak()
kosik = RybiKosik()
from threading import Thread
import threading
lock = threading.Lock()
import glob
import os.path
#import cookielib
import http.cookiejar
import re
import time
import os
import time
import tweepy
import logging
import glob
import json
import random
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
@hclivess
hclivess / hn_node_update.py
Created May 25, 2020 12:53
hn_node_update.py
"""
Hypernode / Bismuth node update script. The script can be run in any directory.
"""
import os
import sys
import time
import glob
import tarfile
import requests
@hclivess
hclivess / youtube-dl.py
Last active March 21, 2020 04:52
download all videos linked in links.txt, interface for youtube-dl
"""
import subprocess
with open("links.txt") as infile:
lines = infile.readlines()
for line in lines:
filename = line.split("/")[-2]
command_line = f"youtube-dl {line} --verbose {filename}.mp4"
pipe = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE).stdout
import re
import requests
from datetime import date
import matplotlib.pyplot as plt
web = requests.get("https://nyzo.co/queue/all").text
reds = re.findall("#f88", web)
yellows = re.findall("#ff0", web)
whites = re.findall('style=""', web)