Skip to content

Instantly share code, notes, and snippets.

View raviolliii's full-sized avatar

Ravi Patel raviolliii

View GitHub Profile
@raviolliii
raviolliii / thread_decorator.py
Last active February 17, 2024 13:37
Multithreading Decorator in python
from threading import Thread
def threaded(func):
"""
Decorator that multithreads the target function
with the given parameters. Returns the thread
created for the function
"""
def wrapper(*args, **kwargs):
@raviolliii
raviolliii / settings.json
Last active March 11, 2020 22:18
VS Code settings.json file
{
"workbench.colorTheme": "Material Spacegray",
"extensions.ignoreRecommendations": true,
"workbench.fontAliasing": "antialiased",
"workbench.statusBar.visible": false,
"breadcrumbs.enabled": false,
"editor.minimap.enabled": false,
"editor.lineNumbers": "relative",
"editor.matchBrackets": "never",
"editor.parameterHints.enabled": false,
def is_smaller(one, two):
one_sorted = sorted(one)
one_freq = [one.count(l) for l in sorted(set(one_sorted))]
two_sorted = sorted(two)
two_freq = [two.count(l) for l in sorted(set(two_sorted))]
for oc, tc in zip(one_freq, two_freq):
if oc != tc:
return oc - tc < 0
return False