Skip to content

Instantly share code, notes, and snippets.

View freeseacher's full-sized avatar
💭
(3↑↑↑↑3)+1. Yo. Not.

Aleksey Shirokih freeseacher

💭
(3↑↑↑↑3)+1. Yo. Not.
View GitHub Profile
@f41gh7
f41gh7 / README.md
Last active January 5, 2024 21:15
metricsql.py

python wrapper for metricsql expr validation.

usage:

  1. build shared lib: go build -buildmode=c-shared -o library.so main.go
  2. use it
python3 metricsql.py 'not_exist(up)'`
failed to parse expr: not_exist(up), error: unsupported function "not_exist"
@osipxd
osipxd / !paper-versions.md
Last active May 29, 2024 15:04
Paper versions links
@dorneanu
dorneanu / plugin_architecture.md
Last active May 24, 2024 16:01
Python: Implement basic plugin architecture with Python and importlib

Implementing a basic plugin architecture shouldn't be a complicated task. The solution described here is working but you still have to import every plugin (inheriting from the base class).

This is my solution:

Basic project structure

$ tree
@abeluck
abeluck / playbook.yml
Last active September 21, 2023 13:11
Ansible tasks to create and delete alertmanager silences
# creates a silence in alertmanager that starts `now` and lasts for 10 minutes
- hosts: localhost
gather_facts: yes
tasks:
- set_fact:
start_datetime: "{{ ''| local_time_iso8601 }}"
future_datetime: "{{ ''|local_time_iso8601 | add_time_iso8601(minutes=10) }}"
- debug:
var: future_datetime
@enaeseth
enaeseth / yaml_ordered_dict.py
Created February 25, 2011 19:54
Load YAML mappings as ordered dictionaries
import yaml
import yaml.constructor
try:
# included in standard lib from Python 2.7
from collections import OrderedDict
except ImportError:
# try importing the backported drop-in replacement
# it's available on PyPI
from ordereddict import OrderedDict