Skip to content

Instantly share code, notes, and snippets.

@zouzias
zouzias / alert.sh
Created April 30, 2019 14:09 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@zouzias
zouzias / enum.go
Created July 25, 2019 12:26 — forked from lummie/enum.go
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@zouzias
zouzias / hilbert.py
Created January 30, 2025 07:50 — forked from jrzingel/hilbert.py
Pseudo (generalised?) hilbert curve generator. Maps ordered items from a list to a 2D array. Importantly it works for any specified size, not just powers of two or even numbers
# Pseudo-hilbert curve generator. Maps ordered items from an array (1D) to a rectangle (2D)
# in a way that best retains the distances between indexes of the initial array as euclidean distances in the rectangle
#
# Hilbert curves are only possible for powers of 2, so the gilbert() function instead tries to fit as many hilbert
# "blocks" together as possible. This is through a greedy approach and works well enough for my needs
#
# Free for any use, but let me know so I know someone found it useful :)
#
# AUTHOR : James Zingel (2022)