Skip to content

Instantly share code, notes, and snippets.

View psmiley2's full-sized avatar
🐬
Chillin

Peter Smiley psmiley2

🐬
Chillin
View GitHub Profile
@psmiley2
psmiley2 / shortestPaths.js
Last active February 11, 2021 03:59
Reinforcement Learning Traveling Salesman
class ShortestPath {
// Setup
constructor(coordinates) {
this.dissectors = coordinates;
this.totalDissectors = coordinates.length;
this.popSize = 500;
this.population = [];
this.fitness = [];
@psmiley2
psmiley2 / MappedThreading.py
Created December 31, 2020 02:55
Mapped Threading
import requests
import time
import concurrent.futures
# Start my timer
begin = time.perf_counter()
quote_urls = [
"https://www.tronalddump.io/quote/L21PXLngRJKWZMbYxe9H7w",
"https://www.tronalddump.io/quote/U6NdL3xJRECVsvp5x-Uslw",
@psmiley2
psmiley2 / SingleThread.py
Created December 31, 2020 02:40
Single Thread Example
import requests
import time
# Start my timer
begin = time.perf_counter()
# This is the function that we are starting in a new thread each time
def get_quote(url):
res = requests.get(url) # Api call (the step that causes downtime)
@psmiley2
psmiley2 / MultithreadingRegular.py
Last active December 31, 2020 02:30
Multithreading Regular example
import requests
import time
import concurrent.futures
# Start my timer
begin = time.perf_counter()
# This is the function that we are starting in a new thread each time
def get_quote(url):