Skip to content

Instantly share code, notes, and snippets.

function update_pyproject_version
if test -f pyproject.toml
# Extract the current version
set current_version (awk -F '"' '/version =/ {print $2}' pyproject.toml)
# Break down the version into major, minor, and patch
set -l major (echo $current_version | cut -d'.' -f1)
set -l minor (echo $current_version | cut -d'.' -f2)
set -l patch (echo $current_version | cut -d'.' -f3)
@Tedfulk
Tedfulk / format_aliases.fish
Created March 11, 2024 19:43
formatting and coloring my alias output
function format_aliases
# Define colors
set cyan (set_color cyan)
set yellow (set_color yellow)
set blue (set_color blue)
set reset_color (set_color normal)
# Find the longest alias name for alignment
set -l longest 0
for line in (alias)
@Tedfulk
Tedfulk / lobe_chat.fish
Created February 28, 2024 17:57
ubuntu fish function to quickly get a the docker container running lobechat working.
function lobe_chat
# Check if Ollama serve is running on port 11434
if not netstat -tuln | grep -q 11434
echo "Starting Ollama serve..."
# Assuming ollama serve is the correct command to start the server
ollama serve &
else
echo "Ollama serve is already running."
end
import requests
import json
import base64
import os
from typing import List
def get_keywords(image: str) -> List[str]:
body = {
"model": "llava",

Fish function To update Ollama models For Mac

function update_ollama_models
    echo "Fetching list of Ollama models..."
    set -l jobs
    ollama list | tail -n +2 | while read -l line
        set model_name (echo $line | awk '{print $1}')
        if test -n "$model_name"
            echo "Attempting to update model: $model_name"
            ollama pull $model_name &
"""If you mix up the order of letters in a word, many people can slitl raed and urenadnstd tehm. Write a function that takes an input sentence, and mixes up the insides of words (anything longer than 3 letters)."""
def scramble(sentence: str):
import random
import string
new_sentence = sentence.translate(str.maketrans('', '', string.punctuation))
words = new_sentence.split()
scrambled = []
for word in words:
if len(word) > 3: