A simple reminder for myself of some often used commands. Plenty of useful docs over on https://git-annex.branchable.com/
This is a work in progress notebook...
| from __future__ import annotations | |
| from dataclasses import dataclass, field | |
| from concurrent.futures import Future | |
| from threading import Lock, Event | |
| from collections import deque | |
| from weakref import WeakSet | |
| from typing import Generic, Type, TypeVar, Optional, Any, Dict, Callable, Union, List, Tuple, overload, final, Final, cast, Set | |
| T_co = TypeVar("T_co", covariant=True) | |
| T = TypeVar("T") |
| from functools import partial, reduce | |
| class M: | |
| def __init__(self, val): | |
| self.val=val | |
| def map(self, func): | |
| return M(func(self.val)) | |
| def bind(self, func): | |
| return M(func(self.val).val) | |
| def __repr__(self): |
| from typing import overload, Any | |
| # <gen_get_overloads codegen> | |
| # Anything in here is replaced with the result of gen_get_overloads() | |
| # </gen_get_overloads> | |
| def get(val: Any) -> Any: | |
| return val | |
| if __name__ == "__main__": |
| # Make cards out of exported lists | |
| # https://5e.tools/makecards.html | |
| # Export then pass to tool to add background images | |
| import json | |
| import argparse | |
| import unicodedata | |
| import urllib.parse | |
| import urllib.request |
| import time | |
| import sys | |
| anim = ( | |
| "\r| |", | |
| "\r| |", | |
| "\r| |", | |
| "\r| |", | |
| "\r| |", | |
| "\r} |", |
| import dataclasses | |
| class DataFactory(type): | |
| def from_number(cls, num: int) -> "Data": | |
| return cls(str(num)) | |
| @dataclasses.dataclass | |
| class Data(metaclass=DataFactory): | |
| value: str |
| " Install vim-plug with following command | |
| " curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
| " Then ':PlugInstall' to install them | |
| " Set leader to space. This is set up before plugins are loaded. | |
| let mapleader = " " " map leader to Space | |
| " Declare plugins | |
| call plug#begin() |
| from functools import partial | |
| import builtins | |
| class Emoji: | |
| """ Execute functions with style """ | |
| __empty = object() | |
| def __init__(self, left=__empty, right=__empty): | |
| self.__left = left | |
| self.__right = right |
| import re | |
| def parse_compact_range(expression): | |
| numbers = set() | |
| for match_ in re.finditer(r"(?:(\d+)\s*\-\s*(\d+)|(\d+))\s*(?:,|$)", expression): | |
| start, stop, exact = match_.group(1,2,3) | |
| if exact is not None: | |
| numbers.add(int(exact)) | |
| else: | |
| begin, end = sorted(map(int, (start, stop))) |
A simple reminder for myself of some often used commands. Plenty of useful docs over on https://git-annex.branchable.com/
This is a work in progress notebook...