This file contains 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
timedatectl set-timezone America/Toronto | |
mkdir /home/selenoid | |
cd /home/selenoid | |
apt update -y | |
sudo apt-get install -y docker.io | |
sudo systemctl start docker | |
sudo systemctl enable docker | |
rm -rf cm_linux_amd64 | |
wget https://github.com/aerokube/cm/releases/download/1.8.5/cm_linux_amd64 | |
chmod +x cm_linux_amd64 |
This file contains 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 boto3 import client, Session | |
from botocore.exceptions import ClientError | |
from datetime import datetime, timezone | |
import argparse | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--access_key_id', required=True) |
This file contains 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 sys | |
class MySpider(scrapy.Spider): | |
name = 'my_spider' | |
CONCURRENT_REQUESTS = 10 | |
for x in sys.argv: | |
if 'CONCURRENT_REQUESTS=' in x: | |
CONCURRENT_REQUESTS = x.split('CONCURRENT_REQUESTS=')[1] |
This file contains 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
def slow_scroll_to_element(self, driver, element_selector=None, target_yth_location=None): | |
current_scroll_position = int(driver.execute_script("return window.scrollY")) | |
if element_selector: | |
target_yth_location = int(driver.execute_script("return document.querySelector('{}').getBoundingClientRect()['top'] + window.scrollY".format(element_selector))) | |
scrollSpeed = 100 if target_yth_location-current_scroll_position > 0 else -100 | |
def chunks(a, n): | |
k, m = divmod(len(a), n) |