Skip to content

Instantly share code, notes, and snippets.

@mmguero
mmguero / llama-server.sh
Created January 9, 2026 05:02
run llama-server on a CPU-only box with a bunch of RAM
File: llama-server.sh
#!/usr/bin/env bash
# Paths
LLAMA_BIN="./llama.cpp/build/bin/llama-server"
MODELS_DIR="./models"
# Network
HOST="127.0.0.1"
PORT="8081"
@mmguero
mmguero / redis-keys.sh
Last active January 8, 2026 22:20
get redis keys/values
export REDISCLI_AUTH="$REDIS_PASSWORD" && \
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" --scan |
while read -r key; do
type=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" TYPE "$key")
echo "KEY: $key ($type)"
case "$type" in
list)
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" LRANGE "$key" 0 -1 | jq
;;
esac
@mmguero
mmguero / inpainting_experiment.json
Created December 11, 2025 04:28
inpainting_experiment.json
{
"id": "5f2a65e4-b103-48d4-9c24-daefba71eeff",
"revision": 0,
"last_node_id": 23,
"last_link_id": 37,
"nodes": [
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
@mmguero
mmguero / JSONata query.md
Created November 20, 2025 15:56
JSONata for Uptime Kuma to check Malcolm's ready api

This can check the results of the Malcolm ready API with JSONata.

  • sample data:
{"arkime":true,"dashboards":true,"dashboards_maps":true,"filebeat_tcp":true,"freq":true,"logstash_lumberjack":true,"logstash_pipelines":true,"netbox":true,"opensearch":true,"pcap_monitor":true,"zeek_extracted_file_logger":true,"zeek_extracted_file_monitor":true}
  • query:
$sum($map($.*, function($v){ $v ? 1 : 0 })) = $count($.*)
@mmguero
mmguero / broken-md-links.sh
Created November 18, 2025 23:41
find broken anchor links in a directory of markdown (.md) files that reference each otehr
@mmguero
mmguero / Vagrantfile
Created November 12, 2025 16:08
Vagrantfile for three windows 10 boxes that can all RDP into each other
# -*- mode: ruby -*-
# vi: set ft=ruby :
common_script_0 = <<-SHELL
# Disable hibernation and sleep
REG ADD "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power" /v HiberbootEnabled /t REG_DWORD /d "0" /f
powercfg.exe -x -monitor-timeout-ac 0
powercfg.exe -x -monitor-timeout-dc 0
powercfg.exe -x -disk-timeout-ac 0
powercfg.exe -x -disk-timeout-dc 0
@mmguero
mmguero / llama-run.sh
Last active December 4, 2025 16:46
run llama-server with an LLVM model chosen from a list with some default parameters
#!/usr/bin/env bash
# Default settings
DEFAULT_GPU_LAYERS=20
DEFAULT_CTX_SIZE=768
DEFAULT_TEMP=0.7
DEFAULT_TOP_P=0.9
LLAMA_BIN="./llama.cpp/build/bin/llama-server"
HOST="0.0.0.0"
PORT="8832"
@mmguero
mmguero / shuffle-watch.sh
Created October 8, 2025 04:15
shuffle-watch.sh
find . -mindepth 1 -maxdepth 1 -type f -name "*.mp4" -print0 | shuf -z -n1 | xargs -r -0 -I XXX bash -c 'echo "XXX" ; mpv --autofit=1080x100% "XXX" ; mv -v "XXX" ./watched'
@mmguero
mmguero / a_list_of_steps.md
Last active July 31, 2025 21:13
example for k3s deployment for single-node cluster

Setup

  1. install k3s
    • curl -sfL https://get.k3s.io | sh -
    • or
    • k3sup install --local --k3s-channel v1.33 --k3s-extra-args="--data-dir=/media/extra/k3s --kubelet-arg=root-dir=/media/extra/kubelet"
  2. sudo cp /etc/rancher/k3s/k3s.yaml /home/user/kubeconfig
  3. sudo chown user:user /home/user/kubeconfig
  4. install ingress-nginx
    • kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.13.0/deploy/static/provider/cloud/deploy.yaml
@mmguero
mmguero / find_collisions.sh
Created July 17, 2025 15:53
find "collisions" (_version > 1) in an opensearch index (using a slow scroll)
#!/usr/bin/env bash
# Config
INDEX="arkime_sessions3-*"
SIZE=1000
SCROLL_DURATION="1m"
AUTH="--config /var/local/curlrc/.opensearch.primary.curlrc"
BASE_URL="https://opensearch:9200"
COLLISIONS_RAW="colliding_docs_raw.json"
COLLISIONS_PRETTY="colliding_docs_pretty.json"