Skip to content

Instantly share code, notes, and snippets.

View markomitranic's full-sized avatar
🧀
Cheese mode!

Marko Mitranic markomitranic

🧀
Cheese mode!
View GitHub Profile
@markomitranic
markomitranic / openapi-to-md.mjs
Created February 2, 2026 13:27
Converts OpenAPI spec to Markdown format. Useful for generating LLM docs out of OpenAPI specs.
import { readFileSync, writeFileSync } from 'fs';
/**
* Converts OpenAPI spec to Markdown format. Useful for generating LLM docs out of OpenAPI specs.
* @example node openapi-to-md.mjs openapi.json
* @example node openapi-to-md.mjs openapi.json --no-params
*/
const stripHtml = (str) => str.replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim();
@markomitranic
markomitranic / sync-agents-md.sh
Created January 31, 2026 15:44
Copies the AGENTS.md file to proprietary platforms and formats (e.g. Cursor, Claude Code, GitHub Copilot)
#!/bin/bash
# Copies the AGENTS.md file to proprietary platforms and formats (e.g. Cursor, Claude Code, GitHub Copilot)
#
# Usage: ./scripts/sync-agents-md.sh
#
# Pro tip: add to your `.husky/pre-push`, `.husky/post-merge`, `.husky/post-checkout` hooks.
# > echo "🔖 (operation) Sync AGENTS.md for proprietary platforms. (Cursor, Claude, GitHub Copilot...)"
# > ./scripts/sync-agents-md.sh
#
# Pro tip 2: Make the harnesses ignore each-others files:
@markomitranic
markomitranic / generate-agents-docs.sh
Last active February 2, 2026 14:53
Script that reads agents-docs files and creates a Vercel-style compressed index
#!/bin/bash
# Generates a compressed docs index for AI agents from .docs folder
# See: https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals
#
# Usage: ./scripts/generate-agents-docs.sh [--preview]
#
# Pro tip: add to your `.husky/pre-push`, `.husky/post-merge`, `.husky/post-checkout` hooks.
# > echo "💽 (operation) Re-generate the docs index in AGENTS.md"
# > ./scripts/generate-agents-docs.sh
@markomitranic
markomitranic / statusline.sh
Created January 29, 2026 09:13
Minimal Claude Code statusline with context window warning
#!/usr/bin/env bash
# Status line script for Claude Code
# Displays: Branch, Model, Cost, Duration, Lines changed
# Location: ~/.claude/scripts/statusline.sh
#
# Installation: ~/.claude/settings.json
# "statusLine": {
# "type": "command",
# "command": "~/.claude/scripts/statusline.sh"
@markomitranic
markomitranic / ralph.sh
Last active January 25, 2026 16:13
Ralph loop for Opencode. Because everything currently out there sucks :(
#!/bin/bash
set -o pipefail
AI_MODEL="opencode/gemini-3-flash"
PLANNER_MESSAGE=$(cat <<'EOF'
@./PRD.md
1. Pick the first available task that has not yet been marked as complete in the `PRD.md` file.

You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse. IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).

Here are useful slash commands users can run to interact with you:

  • /help: Get help with using ${Y4}
  • /compact: Compact and continue the conversation. This is useful if the conversation is reach
@markomitranic
markomitranic / env.ts
Last active February 17, 2025 06:00
Unified Astro facade for accessing environment variables.
import * as client from "astro:env/client";
import type ServerEnv from "astro:env/server";
/**
* If we're in SSR, use the real server env.
* Otherwise, a proxy that throws if you try to access it.
*/
const server = import.meta.env.SSR
? await import("astro:env/server")
: (new Proxy(
@markomitranic
markomitranic / forecast_model_template.sql
Created March 16, 2023 08:32 — forked from Sassano-Weld/forecast_model_template.sql
Sales forecasting model written for GOOGLE BIGQUERY
--------**********---------
/*
AUTHOR: CHRISTIAN SASSANO/DARYL PAUL : WELD TECHNOLOGIES ApS
PUBLISHED: MAY 2022
https://weld.app
Join us in slack: https://join.slack.com/t/weldcommunity/shared_invite/zt-19b372339-1m9ftp0YW2AU8ToZpBViAA
Sales forecasting model written for GOOGLE BIGQUERY using the following inputs
CUSTOMER_ID|FIRST_ENTERED_SALES_FUNNEL_DATE|FIRST_CONVERTED_DATE|DAYS_TO_WON|ENTERED_SALES_FUNNEL|CONVERTED
@markomitranic
markomitranic / workspace.code-workspace.json
Created August 24, 2021 14:09
Remote Workspace Settings
{
"folders": [
{
"path": ".."
}
],
"settings": {
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#1f6fd0",
"activityBar.activeBorder": "#ee90bb",
// Simply paste all of this code on any instagram post.
// Or drag the file to the console and press Enter.
function init() {
loadAllComments();
}
function loadAllComments() {
// Load all comments pages...
const clickerInterval = setInterval(() => {