Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

pathcl

View GitHub Profile
@pathcl
pathcl / .vimrc
Created October 17, 2026 08:48
vimrc
" vim-bootstrap b0a75e4
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
● SELECT
t.service_name,
a2.value_str AS my_other_span_attribute,
regexp_replace(a.value_str, '/[0-9a-f-]{8,}', '/{id}') AS url_pattern,
COUNT(*) AS occurrences
FROM traces t
JOIN attributes a ON a.trace_id = t.trace_id
AND a.scope = 'span'
AND a.key = 'my.span.name'
AND a.value_str LIKE '/%'
metrics_generator:
storage:
remote_write:
- url: http://mimir:9009/api/v1/push
write_relabel_configs:
- source_labels: [my_wrong_label]
regex: ".*/url.*"
action: drop
@pathcl
pathcl / export-data.py
Created September 29, 2026 09:52
export-data.py
import sqlite3
import csv
import json
conn = sqlite3.connect("your_db.sqlite")
cursor = conn.execute("SELECT * FROM your_table")
cols = [d[0] for d in cursor.description]
with open("output.csv", "w", newline="") as f:
writer = csv.writer(f)
@pathcl
pathcl / unique-labels-values.py
Created September 21, 2026 19:53
find unique label values for a promql metric
#!/usr/bin/env python3
import argparse
import json
import sys
import time
from urllib.request import urlopen, Request
from urllib.parse import urlencode
from urllib.error import URLError, HTTPError
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"strings"
@pathcl
pathcl / config.ghostty
Last active July 8, 2026 21:02
config.ghostty
theme = Nord
font-family = Menlo
font-size = 18
background = #2e3440
foreground = #d8dee9
keybind = super+t=new_tab
keybind = super+w=close_surface
@pathcl
pathcl / make-me-an-ipod.py
Last active January 20, 2026 17:38
Download music from a spotify playlist
# Note: pip install spotipy yt-dlp
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import yt_dlp
# Obtain these from https://developer.spotify.com/dashboard
SPOTIFY_CLIENT_ID = "xxxx"
SPOTIFY_CLIENT_SECRET = "xx"
@pathcl
pathcl / README.md
Created February 3, 2025 20:53 — forked from alexcpn/README.md
Prophet for Anomaly detection
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdVssE5hBqzqHfRg6JFRWUAehdMq/jpY9/6gMYhzeu0LhdF3o2vbR5JBTkiSSM0i7dJRH2MHwIRzCThMb16lSCQwUb+JZNPccvq2KifHOkf9RP3NeRf/YO8ExcgCUYrVi79mgHus9YT4DyIhWL7Txt1geqnhLeqgfFtKpJh8bwaXHNfDISEYPnhWG4MUZDPHlALGfhdhoJbFZ4ct6ji1qqX8Msp2lbzcDSe5FESJtMPN5RoBwlfAW0dcG79H3axwFHisWVjfw9rJnMvwLi3WUbP9Wxb6G8z8tcqQWydvOKBvZk3rUSUvCOT/AcJIxVyqE3ZMYxAxI7Y5EkMKG/XYgh1c+2FDzWWE+KfeR6OTpm+TVCKodo9LCf26BTNnjZ/YsNuDDND9Vt6KiedZIu2xwmCkd+ovl6C+DfAViWo2RCIJKoWOORn5+CCao1KsPggZSQye7iexX/jrpmdnZyhq317de49liwZsPPfJsZuvqgBYzr6Wn3zkw3EpWtLBzMPP0= pathcl@espresso