Skip to content

Instantly share code, notes, and snippets.

View erikseulean's full-sized avatar
🐻

Erik-Cristian S. erikseulean

🐻
  • London
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ngErrorRedirect</title>
</head>
<body>
<div>
Error
</div>
@erikseulean
erikseulean / five_stop.py
Last active April 13, 2022 22:04
Stop thread after 5 seconds
import threading
import time
def do_something_random_until_stopped(event):
counter = 0
elapsed = time.time()
while not event.isSet():
print(f"I am at {counter}")
counter += 1
from functools import lru_cache
def minCut(s: str) -> int:
def is_palindrome(start, end):
while start < end:
if s[start] != s[end]:
return False
start += 1
from collections import defaultdict
class ConversionNotPossible(Exception):
def __init__(self, from_unit, to_unit):
super(Exception).__init__()
self.from_unit = from_unit
self.to_unit = to_unit
def __repr__(self) -> str:
def find_perfect_squares(number):
perfect_squares = {i * i for i in range(sqrt(n)}
for other_i in sqrt(n):
if n - other_i * other_i in perfect_squares:
return True
return False