Skip to content

Instantly share code, notes, and snippets.

@somera
somera / codebase_chat_cli_v1.3.py
Created April 5, 2025 15:15
Codebase Chat CLI - A command-line interface for interacting with codebases using local LLMs via Ollama.
#!/usr/bin/env python3
"""
Codebase Chat CLI - GPU Accelerated
A command-line interface for interacting with codebases using local LLMs via Ollama.
Supports GPU acceleration for improved performance and ChromaDB for vector indexing.
Features:
- Vector index creation of source code files with ChromaDB and Ollama embeddings
- .codechatignore support for excluding files/folders
@somera
somera / .env
Created April 5, 2025 15:13
Environment variables for codebase_chat_cli_v1.3.py
# ollama
OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=phi4:14b
OLLAMA_TEMPERATURE=0.2
OLLAMA_NUM_CTX=16384
OLLAMA_TOP_P=0.95
OLLAMA_REPEAT_PENALTY=1.1
# index
INDEX_ROOT=~/.codechat/indexes
@somera
somera / sync-history.sh
Created October 19, 2024 08:12 — forked from jan-warchol/sync-history.sh
Synchronize history across bash sessions
# Synchronize history between bash sessions
#
# Make history from other terminals available to the current one. However,
# don't mix all histories together - make sure that *all* commands from the
# current session are on top of its history, so that pressing up arrow will
# give you most recent command from this session, not from any session.
#
# Since history is saved on each prompt, this additionally protects it from
# terminal crashes.
@somera
somera / noVNCCopyPasteProxmox.user.js
Created September 25, 2023 18:21 — forked from amunchet/noVNCCopyPasteProxmox.user.js
Copy/Paste for noVNC Proxmox
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.2a
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none
@somera
somera / LLM.md
Created July 2, 2023 17:16 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@somera
somera / generate-certificate-chain.sh
Created May 27, 2023 18:02 — forked from granella/generate-certificate-chain.sh
Create self-signed certificate with root and ca for development
#!/bin/bash
rm *.jks 2> /dev/null
rm *.pem 2> /dev/null
echo "===================================================="
echo "Creating fake third-party chain root -> ca"
echo "===================================================="
# generate private keys (for root and ca)
@somera
somera / latency.txt
Created April 15, 2023 20:35 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@somera
somera / latency.markdown
Created April 15, 2023 20:34 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@somera
somera / convert_to_safe.py
Created March 10, 2023 18:21 — forked from zer0TF/convert_to_safe.py
Convert all CKPT files to SAFETENSOR files in a directory
# Got a bunch of .ckpt files to convert?
# Here's a handy script to take care of all that for you!
# Original .ckpt files are not touched!
# Make sure you have enough disk space! You are going to DOUBLE the size of your models folder!
#
# First, run:
# pip install torch torchsde==0.2.5 safetensors==0.2.5
#
# Place this file in the **SAME DIRECTORY** as all of your .ckpt files, open a command prompt for that folder, and run:
# python convert_to_safe.py
@somera
somera / enable-all-advanced-power-settings.ps1
Created November 16, 2022 16:12 — forked from raspi/enable-all-advanced-power-settings.ps1
Enable all advanced power settings in Windows.
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
$powerSettingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSetting
$powerSettingInSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingInSubgroup
Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingCapabilities | ForEach-Object {
$tmp = $_.ManagedElement