Skip to content

Instantly share code, notes, and snippets.

View miticojo's full-sized avatar

Giorgio Crivellari miticojo

View GitHub Profile
@miticojo
miticojo / agents.md
Last active June 20, 2026 09:24
My AI Coding Harness

Coding rules — always apply.

1. Spec-driven. Build exactly what's asked. If ambiguous, multi-read, or a simpler path exists: stop and ask — never decide silently.

2. YAGNI / KISS. Minimum code that solves it. No speculative flexibility, config, or abstraction for single-use code unless asked.

3. Surgical. Change only what the request needs; every line traces to it. Match existing style; don't touch unrelated code. Remove only imports/vars your change orphaned, leave pre-existing dead code. Keep changes small; refactors separate from features.

4. TDD. Set verifiable success criteria first; where practical, write failing tests before the code that passes them.

{
"displayName": "Claude Code — daily cost per user over threshold",
"documentation": {
"content": "A user's Claude Code spend over the last 24h exceeded the configured threshold (default $50). Check the 'Cost Governance & Usage' dashboard, filter by the user in the incident labels, and review cost by model / query_source.",
"mimeType": "text/markdown"
},
"combiner": "OR",
"conditions": [
{
"displayName": "Cost per user over 24h > $50 (USD, Claude estimate)",
@miticojo
miticojo / gke_utilization.sh
Last active July 25, 2024 07:32
Analyze GKE realtime utilization
#!/bin/bash
set -e
# Function to convert resources to milli format
convert_to_m() {
local value=$1
case ${value: -1} in
m) echo "${value%?}";;
"") echo "$((value * 1000))";;
@miticojo
miticojo / ocp-dump.sh
Created February 19, 2024 12:54
OKD/OCP dump
#!/bin/bash
# Function to redact sensitive fields within Secret objects
redact_secrets() {
secret_name=$1
namespace=$2
# Fields likely to contain sensitive information
sensitive_fields=("data.password" "data.token" "stringData")
@miticojo
miticojo / setup-pubsub-to-cb-cross-project.md
Last active January 11, 2023 11:19
GCP: setup Pub Sub Cloud Build Trigger across Project

Step by step procedure

If you need to setup a cross project trigger from Cloud Source Repository (aka CSR) to Cloud Build (aka CB), one way could be this one:

Setup env variables used

# this is the project containing the Cloud Source Repository
export PROJECT_CSR=my-csr-project
export CSR_REPO_NAME=my-repo
# this is the project running Cloud Build Job
@miticojo
miticojo / httpbin-istio.yaml
Last active November 21, 2022 11:26
quick istio httpbin test
apiVersion: v1
kind: ServiceAccount
metadata:
name: httpbin
---
apiVersion: v1
kind: Service
metadata:
name: httpbin
labels:
@miticojo
miticojo / cloudbuild.yaml
Last active October 27, 2021 06:39
Sync docker images from a remote registry with GCP Artifact service
steps:
- id: access remote docker registry
name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker login 10.1.0.5:5000 --username=$$USERNAME --password=$$PASSWORD']
secretEnv: ['USERNAME', 'PASSWORD']
- id: sync repo
name: quay.io/skopeo/stable
@miticojo
miticojo / http2pubsub.py
Last active May 23, 2020 18:59
Google Cloud Function push to Pub/Sub with Stackdriver Error Reporting integration
import os
import json
from flask import abort
from google.cloud import pubsub_v1, error_reporting
client = error_reporting.Client(project=os.getenv('GCP_PROJECT'))
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(os.getenv('GCP_PROJECT'), os.getenv('TOPIC_NAME'))
def http2pubsub(request):
@miticojo
miticojo / readme.md
Created March 5, 2020 08:02
Kernel and Network Tuning

Kernel and Network Tuning Consider tuning kernel and network and add this kind of following settings in /etc/sysctl.conf:

net.ipv4.tcp_max_syn_backlog = 40000
net.core.somaxconn = 40000
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
#!/bin/bash
APIURL=https://speech.googleapis.com
REMOTEIP=$(curl -s ipinfo.io/ip)
REMOTEASN=$(curl -s ipinfo.io/org | cut -d' ' -f1)
RESULTFILE="google-ping-api-results-$(date +%s).csv"
## Script start time
START=$(date +%s)