Skip to content

Instantly share code, notes, and snippets.

@tgran2028
tgran2028 / obsidian-local-rest-api.openapi.yaml
Created December 7, 2024 07:07
Obsidan Local Rest API plugins OPENAPI spec
components:
schemas:
Error:
properties:
errorCode:
description: |
A 5-digit error code uniquely identifying this particular type of error.
example: 40149
type: number
message:
@tgran2028
tgran2028 / ANSI-escape-sequences.md
Created December 5, 2024 08:24 — forked from ConnerWill/ANSI-escape-sequences.md
ANSI Escape Sequences cheatsheet

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@tgran2028
tgran2028 / aichat_wrapper_jupyter_magic_class.py
Created November 15, 2024 02:00
Magic line class for jupyter that wraps around the `aichat` cli command. Allows for quick access to LLMs
import os
import subprocess
from typing import Optional
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.magic import register_line_magic
from IPython.core.magic_arguments import (argument, magic_arguments,
parse_argstring)
from rich import print as rprint
@tgran2028
tgran2028 / ANSI.md
Created October 30, 2024 13:29 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@tgran2028
tgran2028 / deb-install-from-url.sh
Last active October 5, 2024 16:32
Utility script for installing a deb file from a url. Uses gdebi to manage dependencies.
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# deb-install-from-url.sh
#
# @description Basic helper script to install deb package from a URL. Requires URL as arg.
# Any additional args are passed to gdebi. Use -n for non-interactive install.
#
# @usage deb-install-from-url.sh <url> [GDEBI_OPTS]
# @arg 1 <url> URL of the deb package to install.
# @nargs [GDEBI_OPTS] args to pass to gdebi (optional)
@tgran2028
tgran2028 / bat-modules.sh
Last active October 2, 2024 12:41
Bat Extras
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# bat-extras | Copyright (C) 2020 eth-p | MIT License
#
# Repository: https://github.com/eth-p/bat-extras
# Issues: https://github.com/eth-p/bat-extras/issues
# -----------------------------------------------------------------------------
# shellcheck disable=SC1090
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
source "${LIB}/constants.sh"
@tgran2028
tgran2028 / ollama-embedding-model.py
Created August 31, 2024 14:13
Embedding example using ollama
#!/home/tim/.local/share/micromamba/evs/cuda-ev/bi/python
# -*- coding: utf-8 -*-
import logging
import ollama
import chromadb
logging.getLogger().setLevel(logging.INFO)
@tgran2028
tgran2028 / zsh-strings.md
Created August 31, 2024 01:21 — forked from mattmc3/zsh-strings.md
Zsh - string utilities

zsh strings

Fish has a utility for [string maniplulation][string].

This is how you can do the same things with Zsh builtins.

References:

  • [Zsh regex][3]
  • [String modifiers][1]
  • [String expansion][2]
# nvm -- sourcing is very slow, use lazy load
if [[ -f "$HOME/.nvm/nvm.sh" ]]; then
function nvm() {
unfunction nvm
source "$HOME/.nvm/nvm.sh"
nvm "$@"
}
fi
@tgran2028
tgran2028 / 0b.bin
Created August 18, 2024 10:27 — forked from m-bartlett/0b.bin
Dell XPS 15 9510 / Dell Precision 5560 ELAN touchpad firmware updates (might fix touchpad input lag)