Skip to content

Instantly share code, notes, and snippets.

@csghone
csghone / config.toml
Last active April 27, 2026 05:41
codex with ollama
# ~/.codex/config.toml
# Sample command: codex --oss -m gemma4:26b --dangerously-bypass-approvals-and-sandbox
model_provider = "ollama_local"
model = "gemma4:26b"
model_context_window = 131072
[model_providers.ollama_local]
name = "ollama_local"
base_url = "http://localhost:11434/v1"
@csghone
csghone / ollama.sh
Created April 26, 2026 16:37
Ollama references
# Manual installation
tar --use-compress-program=zstd -xvf ollama-linux-amd64.tar.zst
# Pull model (You might want to soft-link /usr/share/ollama to somewhere else so as to not fill up root partition)
# Alternatively override default path using OLLAMA_MODELS environment variable before running.
# Also edit in /etc/systemd/system/ollama.service if needed
ollama pull gemma4:26b # To pu
# Manually runs only - no daemon
sudo systemctl disable ollama.service
@csghone
csghone / matplotlib_helper.py
Last active February 18, 2025 05:05
Matplotlib helpers
# Refs:
# https://matplotlib.org/3.9.3/users/explain/quick_start.html
# https://stackoverflow.com/questions/7908636/how-to-add-hovering-annotations-to-a-plot
# https://www.geeksforgeeks.org/how-to-draw-a-line-inside-a-scatter-plot/
# https://python-graph-gallery.com/scatterplot-with-regression-fit-in-matplotlib/
# https://stackoverflow.com/questions/22239691/code-for-best-fit-straight-line-of-a-scatter-plot
# https://stackoverflow.com/questions/27878217/how-do-i-extend-the-margin-at-the-bottom-of-a-figure-in-matplotlib
# https://stackoverflow.com/questions/51473993/plot-an-histogram-with-y-axis-as-percentage-using-funcformatter
def plot_cols(inp_df: pandas.DataFrame, *args):
@csghone
csghone / setup_lvm.sh
Created September 6, 2024 03:12
New LVM
fdisk -l # To get diskname - '/dev/nvme1n1' in example below and mount at /local/mnt2/
# DISK_NAME=/dev/nvme1n1
# VG_NAME=vg10
# LV_NAME=lv_local_mnt2
# MOUNT_TARGET=/local/mnt2
pvcreate /dev/nvme1n1 # You might have to wipe GPT signatures if this was partitioned by Windows
vgcreate vg10 /dev/nvme1n1
lvcreate -n lv_local_mnt2 -l +100%FREE vg10
@csghone
csghone / lvm_resize.sh
Created September 6, 2024 03:09
LVM resizing
exit 1 # DONT RUN DIRECTLY
# Original system: "/" and "/local/mnt" with 20 GB and 2000 GB
# Target: Increase "/" to 200 GB
# Do reboot since some random processes keep accessing /local/mnt
# Run following as root as soon as you reboot
df -h # Note down / and /local/mnt partition sizes
umount /local/mnt
@csghone
csghone / create_cli_args_from_dict.py
Last active September 6, 2024 03:03
Create cli args using Dict and ArgumentParser
import argparse
from typing import Any, Dict
def create_cli_args_from_dict(parser: argparse.ArgumentParser, inp_args_dict: Dict[str, Any]):
ret_val_list = []
for action in parser._actions:
if action.dest not in inp_args_dict: continue
val = inp_args_dict[action.dest]
if isinstance(action, argparse._StoreTrueAction):
assert isinstance(val, bool)
@csghone
csghone / dot_viewer.html
Created December 4, 2023 18:31
Dot Viewer
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>Dot Viewer</title>
<meta property="og:title" content="Dot Viewer">
</head>
<body>
@csghone
csghone / graphviz_html_label_graph.py
Created December 4, 2023 18:29
Create GraphViz graph with HTML-like labels
#!/usr/bin/env python
import argparse
import logging
import logging.handlers
import os
import sys
import textwrap
import traceback
from dataclasses import dataclass