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
<?php | |
class Py | |
{ | |
/** | |
* Get the least common multiple | |
* | |
* @param $a | |
* @param $b | |
* @return float|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
""" | |
Rename hexchat.pyi and add to your IDEs (e.g. PyCharm) Project to get | |
autocomplete for hexchat API. | |
Assumes at least Python 3.5 | |
http://img.xrmb2.net/images/940180.png | |
""" | |
import enum |
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
# https://www.youtube.com/watch?v=5C6sv7-eTKg | |
# helpers | |
def _incr(num): | |
return num + 1 | |
def show(num): | |
return print(num(_incr)(0)) | |
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
// Sourced from: https://easings.net/ | |
/** | |
* @enum {Easings} | |
*/ | |
export const Easings = { | |
easeInSine: 'easeInSine', | |
easeOutSine: 'easeOutSine', | |
easeInOutSine: 'easeInOutSine', | |
easeInQuad: 'easeInQuad', | |
easeOutQuad: 'easeOutQuad', |
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 __future__ import annotations | |
from threading import Thread, Event | |
from queue import Queue | |
import subprocess | |
import pygame | |
MONITORS = { | |
'left': (-1920, 0, 1920, 1080), | |
'middle': (0, 0, 2560, 1440), # presumably main monitor, hence offset is (0, 0) |
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 __future__ import annotations | |
import random | |
from collections import deque | |
import time | |
import colorsys | |
import pygame | |
WIDTH, HEIGHT = 50, 50 | |
TILE_WIDTH = 10 |
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 functools import wraps, partial | |
def argumentarize(func): | |
@wraps(func) | |
def decorator(decorated_func=None, /, **kwargs): | |
if decorated_func is None: | |
# decorator was used with (...) | |
# so return the decorator again as partial | |
return partial(func, **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
from __future__ import annotations | |
import threading | |
import socket | |
import os | |
DOCROOT = os.path.dirname(os.path.abspath(__file__)) | |
EXT_MIME_MAP = { | |
'.html': 'text/html; charset=utf-8', | |
'.css': 'text/css; charset=utf-8', | |
'.txt': 'text/plain; charset=utf-8', |
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 __future__ import annotations | |
import asyncio | |
from rich.text import Text | |
from textual.app import App | |
from textual.widgets import ScrollView, Footer | |
from textual_inputs import TextInput | |
try: | |
import tomllib |
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 extract(obj, path: list[str]): | |
def _inner(_obj, _path: list[str], used_path: list): | |
if not _path: | |
yield tuple(used_path), _obj | |
return | |
current, *rest = _path | |
if current == '*': | |
# yield from all items on the current level | |
if isinstance(_obj, list): |