Skip to content

Instantly share code, notes, and snippets.

View erewok's full-sized avatar

Erik erewok

View GitHub Profile
@erewok
erewok / llama-picode-bootstrap.sh
Last active May 1, 2026 14:35
Bootstrapping script for MBP and llama-server with HF model qwen3.6 and pi-code
#!/bin/bash
set -euo pipefail
# Bootstrap script for local LLM coding agent on Apple Silicon Macs (M1-M5)
# Installs: llama.cpp (llama-server), pi-coding-agent
# Model and params auto-tuned based on available unified memory
LLAMA_PORT=3333
LLAMA_HOST=127.0.0.1
@erewok
erewok / bash_curl.sh
Last active March 12, 2026 15:42
Mulligan Funding iso-api
#!/bin/bash
export CLIENT_ID="..."
export CLIENT_SECRET="..."
# NOTE: I am using our INTERNAL dev domain here but you would use sandbox
export DOMAIN=https://partner.dev.mulligancloud.com
export TOKEN_TEST=$(curl -X POST \
"${DOMAIN}/iso/api/auth/oauth2/token" \
-H "Authorization: Basic ${CLIENT_ID}:${CLIENT_SECRET}")
@erewok
erewok / README.md
Last active December 1, 2024 19:56
Implementation of Control Flow Analysis from the Paper

Interval Creation Process:

  • The algorithm starts at the entry node and creates the first interval.
  • It adds nodes to the current interval if ALL of their predecessors are already in the interval.
  • When a node is found that doesn't satisfy this condition, it becomes a new header node, starting a new interval.

Key Stopping Condition: The crucial part of stopping node addition to an interval is the all_preds_in_interval check.

Specifically:

  • If all predecessors of a node are already in the current interval, the node is added to that interval.
@erewok
erewok / ConnectionPooling.tla
Last active November 25, 2024 23:46
Azure Python SDK Connection Pooling (Sharing)
---- MODULE ConnectionPooling ----
EXTENDS Integers, FiniteSets, Sequences
CONSTANTS
\* Maximum number of connections in the pool (usually <10)
MaxPoolSize,
\* Maximum number of clients per connection (arbitrary, e.g. 10 or 100)
MaxClientsPerConnection
@erewok
erewok / pyproject.toml
Last active March 7, 2023 22:37
Azure service-bus Receiver with Opentelemetry Tracing Bug
[tool.poetry]
name = "service-bus-otel-test"
version = "1.0.0"
description = "Service Bus otel test"
authors = ["Erik Aker <eraker@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.11"
azure-core = "^1.26.3"
azure-servicebus = "7.8.2"
@erewok
erewok / compose.py
Last active August 17, 2022 20:34
Python function composition
"""compose.py - Function composition in Python
"""
# Python module for function composition
from functools import reduce, wraps
from itertools import chain
from typing import Callable, Generic, TypeVar
#!/bin/bash
while [ ! -f /var/lib/cloud/instance/boot-finished ]; do
echo "Cloud Init is still configuring the server."
sleep 1
done
echo "Cloud Init config complete. Lets build some apps!"
@erewok
erewok / Dockerfile
Created August 15, 2020 19:32
Cabal-stack Dockerfile
FROM debian:stretch-slim as base_os
## ensure locale is set during build
ENV LANG C.UTF-8
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
@erewok
erewok / streaming_streaming_base_middleware.py
Last active August 4, 2020 15:32
Example Starlette app to test different scenarios with BaseHttpMiddleware
import asyncio
import json
import uvicorn
from starlette.applications import Starlette
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.background import BackgroundTask
from starlette.responses import JSONResponse, PlainTextResponse, StreamingResponse
class TransparentMiddlewareNoStreaming(BaseHTTPMiddleware):
@erewok
erewok / flask_app.py
Last active June 27, 2024 09:37
JSON Logging Inside a Flask Application: configuration for producing JSON logs under a Flask app running under gunicorn
"""
flask application
"""
import logging
import logging.config
import os
from flask import Flask
import structlog