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
""" | |
██████╗ █████╗ ███╗ ███╗███████╗██╗ ███████╗███╗ ██╗ █████╗ ██╗ ██╗███████╗ | |
██╔════╝██╔══██╗████╗ ████║██╔════╝██║ ██╔════╝████╗ ██║██╔══██╗██║ ██╔╝██╔════╝ | |
██║ ███████║██╔████╔██║█████╗ ██║ ███████╗██╔██╗ ██║███████║█████╔╝ █████╗ | |
██║ ██╔══██║██║╚██╔╝██║██╔══╝ ██║ ╚════██║██║╚██╗██║██╔══██║██╔═██╗ ██╔══╝ | |
╚██████╗██║ ██║██║ ╚═╝ ██║███████╗███████╗███████║██║ ╚████║██║ ██║██║ ██╗███████╗ | |
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ | |
github.com/UltrafunkAmsterdam | |
""" |
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 asyncio | |
import PySimpleGUI as sg | |
loop = asyncio.new_event_loop() | |
asyncio.set_event_loop(loop) | |
form = sg.FlexForm( | |
"Everything bagel", auto_size_text=True, default_element_size=(40, 1) | |
) |
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 multiprocessing as mp | |
import queue | |
import asyncio | |
class Process(mp.Process): | |
def __init__(self, in_queue, out_queue, func, func_args=None, func_kwargs=None): | |
self.in_queue:mp.Queue = in_queue |
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 asyncio | |
import multiprocessing | |
class Pool(object): | |
def __init__(self, max_workers=3): | |
self._workers_available = {self._new_pool() for _ in range(max_workers)} | |
self._workers_busy = set() | |
self._can_rotate = asyncio.Event() |
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
Promise.all( | |
[...Array(2 ** 16).keys()].map(function(port) { | |
fetch(`http://localhost:${port}`) | |
.then((result) => { | |
console.log(result) | |
}) | |
.catch((err) => { | |
console.log(err) | |
}) | |
})) |
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
#!/usr/bin/env python3 | |
# coding: utf-8 | |
from __future__ import division | |
from math import atan | |
from math import atan2 | |
from math import cos | |
from math import radians | |
from math import sin | |
from math import sqrt |
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
<scheme name="Monokai" version="142" parent_scheme="Darcula"> | |
<metaInfo> | |
<property name="created">2019-11-21T18:29:56</property> | |
<property name="ide">Python</property> | |
<property name="ideVersion">2018.3.0.0</property> | |
<property name="modified">2019-11-21T18:30:12</property> | |
<property name="originalScheme">_@user_Monokai</property> | |
</metaInfo> | |
<colors> | |
<option name="CARET_COLOR" value="f8f8f0" /> |
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
""" | |
Print indented html tag structure from Beautifulsoup tag | |
example: | |
>>> soup = bs4.BeautifulSoup(some_html, 'html.parser') # or 'lxml' | |
>>> make_structure(soup) | |
out: | |
<html> | |
<head> |
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
#!/usr/bin/env python3 | |
import sys | |
import io | |
import os | |
# USAGE | |
# from terminal/cmd invoke | |
# patch_chromedriver path/to/chromedriver |