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
brew install openssl@3 readline tcl-tk | |
export PYENV_CCACHE_DISABLE=1 | |
export PYTHON_CFLAGS='-mcpu=native' | |
export PYTHON_CONFIGURE_OPTS='--enable-optimizations' | |
MAKE_OPTS='-j4' pyenv install -f 3.8 | |
export PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' | |
MAKE_OPTS='-j4' pyenv install -f 3.9 3.10 3.11 3.12 |
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
module Interval | |
import Data.So | |
-- [TODO] Can we use a "parameters" block to avoid writing `Ord t =>` everywhere? | |
public export | |
rangeValid : Ord t => (closed : Bool) -> (lower: t) -> (upper: t) -> Bool | |
rangeValid closed lower upper = (ifThenElse closed (<=) (<)) lower upper |
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
## Lists | |
result_list_1 = [] | |
for x in xs: | |
for y in ys: | |
for z in zs: | |
if condition(x, y, z): | |
result_list_1.append((x, y, z)) | |
result_list_2 = [ |
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
dotenv list --format=shell |
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
[tool.flakeheaven] | |
max-line-length = 88 | |
format = 'grouped' | |
# Options for flake8-rst-docstrings | |
# https://github.com/peterjc/flake8-rst-docstrings#configuration | |
rst-roles = [ | |
# Built-in roles |
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
; https://stackoverflow.com/a/40028542/2954547 | |
(defun collect-alist-loop (items) | |
(unless (evenp (length items)) | |
(error "Items must have an even number of pairs!")) | |
(loop | |
:for (a b) | |
:on items | |
:by #'cddr | |
:collect (cons a b))) |
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
#!/usr/bin/env python | |
r"""Extract dependencies from Pyproject PEP 621 "project" section. | |
Specificiation: https://peps.python.org/pep-0621/ | |
""" | |
import sys | |
from argparse import ArgumentParser | |
from enum import IntEnum |
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
from collections import UserString | |
from collections.abc import Callable, Mapping | |
from typing import Any, MutableSequence, ParamSpec, Protocol, TypeVar, overload | |
from typing_extensions import Self, Unpack | |
class _HasName(Protocol): | |
__name__: str | |
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 indent_lines(text: str, spaces: int | str = 4) -> str: | |
r"""Indent lines of text by some fixed amount. | |
:param text: The text to indent. | |
:param spaces: The amount of spaces to indent by, or an arbitrary string to use as a | |
line prefix. | |
:returns: The indented text. | |
""" | |
if isinstance(spaces, int): | |
spaces = " " * spaces |
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
r"""Quickly configure a single logger. | |
Based on: https://docs.python.org/3/library/logging.html#logging.basicConfig | |
Adapted from my rejected PR: | |
https://github.com/python/cpython/compare/main...gwerbin:cpython:gwerbin/basicconfig-any-logger | |
""" | |
import logging | |
from collections.abc import Callable, Sequence |
NewerOlder