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
def abs(x): | |
if x < 0: | |
return 0 - x | |
else: | |
return x | |
def calculate_distance(rgb1, rgb2): | |
r1 = rgb1[0] | |
b1 = rgb1[1] |
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 re | |
import requests | |
from time import sleep | |
def unique(iter): | |
result = [] | |
for x in iter: | |
if x not in result: | |
result.append(x) |
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 os | |
from os.path import isdir | |
indent_amount = 4 | |
collapse_amount = 10 | |
indent_char = ' ' | |
# indent_amount = 1 | |
# collapse_amount = 5 | |
# indent_char = '-' |
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 requests | |
import typing | |
class NWSWeatherAPI: | |
def __init__(self, user_agent: str, longitude: str, latitude: str, ignore_test_alerts: bool = True, max_alert_cache_size: int = 256): | |
# Read about User-Agents here: https://www.weather.gov/documentation/services-web-api | |
self._user_agent_header = {'User-Agent': user_agent} | |
self._long_lat = f'{longitude},{latitude}' | |
self._api_url = 'https://api.weather.gov' |
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
# I wrote this code a long time ago lol | |
import requests | |
import re | |
from pprint import pprint | |
class Animal(object): | |
def __init__(self, name): | |
self.name = name | |
self.url_1 = f'https://en.wikipedia.org/wiki/{name.replace(" ", "_")}' |
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
#![allow(clippy::collapsible_else_if, dead_code)] | |
// Just some code I wrote when watching https://youtu.be/EGoRJePORHs | |
fn main() { | |
let start = 1; | |
let mut current = int_to_vec_of_binary_digits(start); | |
for _ in 0..1_000 { | |
let mut zeroes = 0; |