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
const http = require("http") | |
const https = require("https") | |
let proxyEndpoint = "http://localhost:8080" | |
let isWebsocketUpgrade = (headers) => { | |
return !headers.upgrade || headers.upgrade.toLowerCase() != "websocket" || | |
!headers.connection || headers.connection.toLowerCase() != "upgrade" | |
} |
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 pathlib | |
def path_walk(top_path): | |
if not top_path.is_dir(): return top_path | |
top_queue = [top_path] # using list for a queue here, but any collection with the same offer / pop can do | |
while len(top_queue) != 0: | |
current_dir = top_queue[0] | |
for filepath in current_dir.iterdir(): | |
if filepath.is_dir(): | |
top_queue.append(filepath) |
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
#!/bin/python3 | |
import sys | |
import json | |
import pathlib | |
if len(sys.argv) <= 1: | |
print("Error: Expected one argument; path to Favorite file") | |
exit(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
def spin_it(message, frames=('|', '\\', '-', '/'), delay_scale=1): | |
"""Decorator for printing a message and then start the spinner""" | |
def inner(function): | |
def do_function(*args, **kwargs): | |
sys.stdout.write(message) | |
spinner = Spinner(frames=frames, delay=delay_scale) | |
spinner.start() | |
with io.StringIO() as strout: | |
with contextlib.redirect_stdout(strout): | |
output = function(*args, **kwargs) |
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
local Algorithms = {} | |
Algorithms.Collision = {} | |
function Algorithms.Collision.is_colliding_rectangles(reactA, reactB) | |
local function getMinMax(react) | |
return {x = {min = math.min(react.upper.x, react.lower.x), max = math.max(react.upper.x, react.lower.x)}, | |
y = {min = math.min(react.upper.y, react.lower.y), max = math.max(react.upper.y, react.lower.y)}} | |
end |