Skip to content

Instantly share code, notes, and snippets.

View markuskreitzer's full-sized avatar

Markus markuskreitzer

View GitHub Profile
@markuskreitzer
markuskreitzer / README.md
Last active February 13, 2025 16:25
Deploying OpenWebUI and Ollama to your Kubernetes Homelab

Deploying Ollama and OpenWebUI to Kubernetes

Deployment Order

  • Create the PVs and PVCs for ollama and open-webui.
  • Deploy the ollama Deployment and Service.
  • Deploy the open-webui Deployment and Service.
  • Finally, apply the Ingress for open-webui.
kubectl apply -f ollama-pv.yaml
@markuskreitzer
markuskreitzer / sync_time.md
Created December 9, 2024 22:05
Sync Time on Linux

Sync Time on Linux

Some quirky systems out there doesn't have the usual utilities to sync time. If they have access to the internet, here's a quick way. I found this somewhere on the internet, but don't remember where.

DATE=$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)
sudo date -s "${DATE}Z"
@markuskreitzer
markuskreitzer / translate.py
Created April 2, 2024 20:08
Translate Python to Julia
import re
from typing import List, Tuple
import requests
from pathlib import Path
from ollama import AsyncClient
import asyncio
from tqdm import tqdm
import sys
import json
@markuskreitzer
markuskreitzer / make_branches_and_mr.py
Created January 18, 2024 19:33
how to mass create branch and MRs
import gitlab
import argparse
from typing import Iterable
def fix_cicd(project: Project, replacements:Iterable, branch='gitlab-ultimate-migration'):
f = project.files.get('.gitlab-ci.yml', ref=branch)
f_new = f.content
for replacement in replacements:
f_new.replace(replacement[0], repalcement[1])
@markuskreitzer
markuskreitzer / README.md
Last active January 23, 2025 01:57
A docker-compose for running ollama with openwebui

Running Ollama on Docker Compose

Assuming you start with a vanilla Ubuntu, you need to install Nvidia stuff

Add Nvidia apt registries:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
@markuskreitzer
markuskreitzer / docker-compose.yml
Created January 1, 2024 20:48
A Gitlab Docker Compose Deployment - For MacOS Sonoma with Docker on M1
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ee:latest'
platform: 'linux/amd64'
restart: always
hostname: 'g.example.dev'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://g.example.dev:8443'
@markuskreitzer
markuskreitzer / README.md
Last active January 1, 2024 22:06
How do set up a persistent reverse proxy on Ubuntu Linux

Create a secure SSH server with a static IP or DNS entry. It is important to set up keys and cache public key of destination server prior to these steps. There are many guides on doing this, so we'll skip over those.

The Script

Create a script with the following content. You can save it as /root/revese_ssh.sh for this example.

#!/usr/bin/env bash

REMOTE_PORT=22
@markuskreitzer
markuskreitzer / find_dups.py
Created December 5, 2022 03:10
Find Duplicate Files Fast!
#!/usr/bin/env python3
from pathlib import Path
import sys
import hashlib
my_path = Path(sys.argv[1])
b = {}
def filehash(filename: Path):
with filename.open("rb") as f:
@markuskreitzer
markuskreitzer / github2gitea.sh
Created October 26, 2021 00:40
Migrate all Github Repos to a self-hosted Gitea server
#!/bin/bash
# Adapted from Nicolas Boyer by elec3647
# Original post: https://dev.to/nicolasboyer/migrate-all-of-your-repos-from-github-to-gitea-3fk
# Changelog:
# 1. Added ability to pull a user's personal repos or organization.
# 2. Updated `sed` command to work on Linux.
# TODO: Add some logic to pick between org or user.
# TODO: Give ownership to org in Gitea if pulling org.
GITHUB_USERNAME=""