Skip to content

Instantly share code, notes, and snippets.

@Tedfulk
Tedfulk / update_ollama_models.sh
Created August 2, 2024 23:50
update all the ollama models
function update_ollama_models {
echo "Fetching list of Ollama models..."
jobs=()
ollama list | tail -n +2 | while read -r line; do
model_name=$(echo "$line" | awk '{print $1}')
if [[ -n "$model_name" ]]; then
echo "Attempting to update model: $model_name"
ollama pull "$model_name" &
jobs+=("$!")
echo "Started update for model: $model_name"
@Tedfulk
Tedfulk / convert_and_move_dalle_images.fish
Last active August 2, 2024 15:05
Converts the images, logs which ones have been converted, also option to delete the webp files that were copied.
function convert_and_move_dalle_images
# Parse the arguments
set delete_flag 0
for arg in $argv
switch $arg
case '-d' '--delete'
set delete_flag 1
end
end
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-phi",

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: