Skip to content

Instantly share code, notes, and snippets.

View Logiraptor's full-sized avatar
👁️

Patrick Oyarzun Logiraptor

👁️
View GitHub Profile
@Logiraptor
Logiraptor / db.go
Created December 2, 2023 15:38
a way to do object storage-only dbs
package db
import (
"context"
"io"
"strings"
"time"
"github.com/grafana/dskit/services"
)
@Logiraptor
Logiraptor / split.py
Created April 10, 2023 20:49
A Trie designed to split a list of names into prefixes for querying prometheus efficiently
import string
class Trie:
def __init__(self, prefix='', terminal=False, children=None):
self.prefix = prefix
self.terminal = terminal
self.children = children or []
def add(self, name):
if not name.startswith(self.prefix):
# Replace these with proper values for your Grafana Cloud tenant
TENANT_ID="123456"
API_KEY="abcde=="
USER_AGENT="Customer/0.0.1 shell script"
ENDPOINT="https://prometheus-prod-10-prod-us-central-0.grafana.net"
# List all rules for your tenant
curl --user "$TENANT_ID:$API_KEY" \
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Mimir
type: prometheus
url: 'http://gem-mimir-gateway.default.svc.cluster.local:8080/prometheus'
access: proxy
isDefault: true
jsonData:
resources:
- name: my-resource
jobs:
- name: my-job
plan:
- get: my-resource
serial: true
- name: my-job
serial: false
plan:
Api Call HTTP Status UI Behavior CLI Behavior
PUT "/api/v0/staged/director/properties" 200 * Continue
PUT "/api/v0/staged/director/availability_zones" 207 Warning (AvailabilityZonesVerifier) Halt
vv Below this line, I commented the az config before running
PUT "/api/v0/staged/director/networks" 200 Warning (IaasConfigurationVerifier, NetworksExiste
javascript:(function(){
let script = document.createElement('script');
script.src = 'https://unpkg.com/[email protected]/viz.js';
script.onload = function() {
let findReactComponent = function (el) {
for (const key in el) {
if (key.startsWith('__reactInternalInstance$')) {
@Logiraptor
Logiraptor / main.ts
Created February 6, 2018 20:04
Failure reproduction
export function broken1(callback: (x: any) => void, value1: string) {
return callback(() => console.log(value1))
}
export function broken2(callback: any, value2: string) {
return callback(() => console.log(value2))
}
export function working(callback: (x: () => void) => void, value3: string) {
return callback(() => console.log(value3))
package main
import (
"database/sql"
"encoding/json"
"log"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
import * as sinon from "sinon";
import { Observable } from "../../lib/Rx";
export function doNothing<T>(): T {
const handler = {
get(target, name) {
return () => {};
},
};
return new Proxy({}, handler);