Neovim, tmux, Starship, zoxide, fzf, exa, bash vi mode, ...
Shows git stats, command runtime etc. in a nice way.
You can change directory with partial keyword you remember. It will remember the most frequent cd and find it.
# Run multiple commands in a tmux session | |
script_dir=$(dirname "$(realpath -s "$0")") | |
if [[ $# -ne 1 ]]; then | |
sess=session_name | |
else | |
sess="$1" | |
fi | |
tmux new -d -s "$sess" -c "$script_dir" # Use default directory as this script directory |
#include <sys/ioctl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <termios.h> | |
enum { | |
KEYSTATE_NONE = 1024, | |
KEYSTATE_ESCAPE, | |
KEYSTATE_CONTROL, | |
KEYSTATE_MOUSE_PROPS |
from rich.progress import ( | |
Progress, | |
ProgressColumn, | |
SpinnerColumn, | |
Task, | |
TextColumn, | |
TimeElapsedColumn, | |
) | |
from rich.text import Text |
import tensorrt as trt | |
import torch | |
import tqdm | |
logger = trt.Logger(trt.Logger.WARNING) | |
runtime = trt.Runtime(logger) | |
with open("vae_encoder_engine.trt", "rb") as f: | |
serialized_engine = f.read() |
# flake8: noqa: D100 D101 D102 D105 T201 | |
from dataclasses import dataclass, field | |
@dataclass | |
class BaseConfig: | |
@property | |
def envvar_prefix(self) -> str: | |
return "MLCONFIG_" |
# NOTE: __future__ annotations are needed because we want to lazily evaluate torch type hints during runtime. | |
# Or, you need to wrap the types in quotes, e.g. "torch.nn.Module" instead of torch.nn.Module. | |
from __future__ import annotations | |
from typing import TYPE_CHECKING | |
if TYPE_CHECKING: | |
import torch | |
#!/usr/bin/env python3 | |
from pathlib import Path | |
from safetensors.torch import load_file | |
def summarize_tensor(x): | |
if x is None: | |
return "None" | |
x = x.float() | |
return f"({x.min().item():.3f}, {x.mean().item():.3f}, {x.max().item():.3f})" |
""" | |
This will make pptx slides containing images. | |
It assumes your images are square shaped. | |
""" | |
from glob import glob | |
from pptx import Presentation | |
from pptx.dml.color import RGBColor | |
from pptx.util import Inches |
""" | |
Author: Kiyoon Kim ([email protected]) | |
Since torchvision 0.13 (PyTorch 1.12), the new `weights` parameter is introduced and the original `pretrained` parameter is now deprecated. | |
It supports more pretrained weights but it is more difficult to find the right one. | |
This script provides a backward compatible but supporting new version in ease, using strings. | |
""" | |
from __future__ import annotations | |
from typing import Callable, get_type_hints, get_args | |
from enum import Enum | |
from packaging import version |