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 bash | |
| set -euo pipefail | |
| # ---------------------------- | |
| # Claude config (configure here) | |
| # ---------------------------- | |
| additional_args=() | |
| # 1) Allowed tools (safer than skipping permissions) | |
| # additional_args+=( |
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
| vim.env.LAZY_STDPATH = ".repro" | |
| load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))() | |
| require("lazy.minit").repro({ | |
| spec = { | |
| { "folke/trouble.nvim", opts = {} }, | |
| -- add any other plugins here | |
| }, | |
| }) |
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
| # 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 |
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
| #include <sys/ioctl.h> | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <termios.h> | |
| enum { | |
| KEYSTATE_NONE = 1024, | |
| KEYSTATE_ESCAPE, | |
| KEYSTATE_CONTROL, | |
| KEYSTATE_MOUSE_PROPS |
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 rich.progress import ( | |
| Progress, | |
| ProgressColumn, | |
| SpinnerColumn, | |
| Task, | |
| TextColumn, | |
| TimeElapsedColumn, | |
| ) | |
| from rich.text import Text |
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 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() |
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 ast | |
| import os | |
| from abc import ABC, abstractmethod | |
| from dataclasses import asdict, dataclass, fields | |
| from types import NoneType, UnionType | |
| from typing import get_args, get_origin | |
| import rich | |
| from rich.console import Console | |
| from typing_extensions import override |
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
| # 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 | |
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 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 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
| """ | |
| 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 |
NewerOlder