Skip to content

Instantly share code, notes, and snippets.

View darth-veitcher's full-sized avatar

James Veitch darth-veitcher

View GitHub Profile
@darth-veitcher
darth-veitcher / pyenv-optimised-native.sh
Created September 14, 2024 13:20
platform optimised python with pyenv
env PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' \
PYTHON_CFLAGS='-march=native -mtune=native' MAKEFLAGS="-j$(nproc)" pyenv install 3.12
@darth-veitcher
darth-veitcher / .env
Created August 23, 2024 14:38
Ollama + Lite LLM + CrewAI
DOMAIN=mydomain.com
STORAGE_ROOT=/mnt/data/ai
@darth-veitcher
darth-veitcher / install-builds.sh
Last active July 22, 2024 16:59
install docker buildx
mkdir -p ~/.docker/cli-plugins
REPO_NAME=buildx
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/${REPO_NAME}/releases/latest`
LATEST_VERSION=${LATEST_URL##*/}
DOWNLOAD_URL=https://github.com/docker/${REPO_NAME}/releases/download/${LATEST_VERSION}/${REPO_NAME}-${LATEST_VERSION}.`uname -s`-`uname -m`
curl -L ${DOWNLOAD_URL} -o ~/.docker/cli-plugins/docker-${REPO_NAME}
chmod +x ~/.docker/cli-plugins/docker-${REPO_NAME}
docker buildx install
@darth-veitcher
darth-veitcher / gitea.md
Created February 17, 2024 17:42 — forked from adamlwgriffiths/gitea.md
Setup Gitea on Synology DiskStation NAS

Synology Gitea setup

Install Docker

Package Centre > Docker > Install

Create folders

    /docker/gitea/postgresql
 /docker/gitea/gitea
@darth-veitcher
darth-veitcher / rtl8188eus-on-raspi.md
Last active September 8, 2023 17:14
Installing a TP-Link TL-WN725N Wireless Adapter on a RaspberryPi

This was a proper pain... Turns out there's a whole host of issues with the rtl8188eus driver.

Steps to fix (on Debian / RaspberryPi OS).

1. Install build tools

sudo apt install -y \
  build-essential \
 git \
@darth-veitcher
darth-veitcher / logger.py
Created August 15, 2023 16:25 — forked from nkhitrov/logger.py
Configure uvicorn logs with loguru for FastAPI
"""
WARNING: dont use loguru, use structlog
https://gist.github.com/nkhitrov/38adbb314f0d35371eba4ffb8f27078f
Configure handlers and formats for application loggers.
"""
import logging
import sys
from pprint import pformat
@darth-veitcher
darth-veitcher / gpt4all-mac.md
Created April 11, 2023 08:29
GPT4All on a Mac

High level instructions for getting GPT4All working on MacOS with LLaMACPP

See nomic-ai/gpt4all for canonical source.

Environment

  • This walkthrough assumes you have created a folder called ~/GPT4All. Adjust the following commands as necessary for your own environment.
  • It's highly advised that you have a sensible python virtual environment. A conda config is included below for simplicity. Install it with conda env create -f conda-macos-arm64.yaml and then use with conda activate gpt4all.
@darth-veitcher
darth-veitcher / set-optimum-cude-device.md
Last active April 11, 2023 07:44
Set Optimum CUDA device

Optimum CUDA Device

Simple script to detect operating system, GPU architecture, and return device for CUDA usage. Useful for when running on MacOS with Apple Silicon and need to swap out hardcoded cuda:0 type strings for mps.

"""Uses some sensible logic to determine platform and best available device for pytorch.

Assumed combinations (in order of preference):

* CUDA (nvidia GPU) / AMD (ROCm)
@darth-veitcher
darth-veitcher / stable-diffusion-on-apple-silicon.md
Created February 12, 2023 02:22
Stable Diffusion on Apple Silicon

Stable Diffusion on Apple Silicon

This repository outlines what I have done in order to get Stable Diffusion running on a MacBook Pro with a M2 chip.

Exact Specs:

Key Value
Model MacBook Pro
Screen 14"
@darth-veitcher
darth-veitcher / micro-k8s-setup.md
Created November 10, 2022 08:09 — forked from borkmann/micro-k8s-setup.md
MicroK8s setup for Cilium

Set up microk8s with Cilium for development

Microk8s is a Canonical project to provide a kubernetes environment for local development, similar to minikube but without requiring a separate VM to manage. These instructions describe setting it up for common development use cases with Cilium and may be helpful in particular for testing BPF kernel extensions with Cilium.

Microk8s will run its own version of docker for the kubernetes runtime, so if you have an existing docker installation then this may be confusing, for instance when building images the image may be stored with one of these installations and not the other. This guide assumes you will run both docker daemon instances, and use your existing docker-ce for building Cilium while using the microk8s.docker daemon instance for the runtime of your kubernetes pods.

Requirements