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 io | |
| import logging | |
| import os | |
| import time | |
| from datetime import datetime, timedelta | |
| import gtts | |
| import irc.bot | |
| import sounddevice as sd | |
| import soundfile as sf |
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 itertools | |
| from sys import stdout | |
| from typing import Self | |
| def emoji_bool(b: bool): | |
| return b and "✅" or "❌" | |
| class Node: |
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 re | |
| word_numbers = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] | |
| real_numbers = [str(i) for i in range(1, 10)] | |
| numbers_re = "|".join(real_numbers + word_numbers) | |
| first_re = rf"^.*?({numbers_re}).*$" | |
| last_re = rf"^.*({numbers_re}).*?$" |
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 re | |
| import subprocess | |
| DIVIDER_RE = r"^.+\s+[0-9a-f]+$" | |
| ITEM_RE = r"^.+\s+.+\s+.*$" | |
| def get_line_changes_over_time(): | |
| process = subprocess.Popen( | |
| [ |
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
| from typing import Optional | |
| class ListNode: | |
| def __init__(self, x): | |
| self.val = x | |
| self.next = None | |
| def list(l: list) -> Optional[ListNode]: |
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
| let width = 800; | |
| let height = 800; | |
| let xdots = 30; | |
| let ydots = 30; | |
| class Turtle { | |
| constructor(position) { | |
| this.position = position; | |
| this.direction = createVector(0, -1); | |
| this.color = color(255, 255, 255); |
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
| let width = 800; | |
| let height = 600; | |
| let particles = []; | |
| class Particle { | |
| constructor(position, velocity, color) { | |
| this.position = position; | |
| this.velocity = velocity; | |
| this.color = color; | |
| } |
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
| require 'set' | |
| class Node | |
| attr_accessor :value, :parent | |
| def initialize(value = nil, parent = nil) | |
| @is_word = false | |
| @parent = parent | |
| @value = value | |
| @children = {} |
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
| from typing import List | |
| class Item: | |
| name: str | |
| degradation: int = 1 | |
| quality_min: int = 0 | |
| quality_max: int = 50 | |
| def __init__(self, name: str, sell_in: int, quality: int): |
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
| #!/usr/bin/env python | |
| import enum | |
| from random import randrange | |
| from typing import Optional | |
| class QuestionGenerator: | |
| def __init__(self, category: str) -> None: | |
| self.category = category |