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 flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/', defaults={'path': ''}, methods=["GET", "POST", "PUT", "DELETE"]) | |
@app.route('/<path:path>', methods=["GET", "POST", "PUT", "DELETE"]) | |
def catch_all(path): | |
# Print the incoming request and payload | |
print(f"Incoming Request: {request.method} {request.url}") | |
if request.data: |
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 selenium import webdriver | |
from selenium.webdriver.chrome.service import Service | |
from selenium.webdriver.common.service import Service | |
# Replace with the URL of your Selenium Grid hub on localhost. | |
grid_hub_url = "http://localhost:4444/wd/hub" | |
# Set the Chrome browser options. | |
chrome_options = webdriver.ChromeOptions() | |
chrome_options.add_argument("--headless") # Example: Run Chrome in headless mode. |
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
docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome |
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 time | |
from locust import HttpUser, task, between | |
class QuickstartUser(HttpUser): | |
wait_time = between(1, 2) | |
@task | |
def index_page(self): | |
self.client.get("/") |
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 curses | |
from random import randrange, choice | |
from collections import defaultdict | |
# Initialize the game | |
actions = ['Up', 'Down', 'Left', 'Right'] | |
keys = [ord('w'), ord('s'), ord('a'), ord('d')] | |
actions_dict = dict(zip(keys, actions)) | |
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
#!/bin/bash | |
# Array to store the filenames from the previous loop | |
previous_files=() | |
# Infinite loop | |
while : | |
do | |
# Run the lsof command and filter for Google Chrome process | |
files=$(lsof -c "Google Chrome" | awk '{print $9}' | sed '1d') |
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
osascript -e 'tell application "Google Chrome" to open location "https://www.sotong.io"' |
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
osascript -e 'tell application "Firefox" to quit' |
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
SELECT moz_places.url, datetime(moz_historyvisits.visit_date / 1000000,'unixepoch', 'localtime') AS visit_time FROM moz_places JOIN moz_historyvisits ON moz_historyvisits.place_id = moz_places.id ORDER BY moz_historyvisits.visit_date DESC LIMIT 10; |
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
SELECT url FROM urls ORDER BY last_visit_time DESC LIMIT 10; |