Skip to content

Instantly share code, notes, and snippets.

View hagen1778's full-sized avatar
💭
I may be slow to respond.

Roman Khavronenko hagen1778

💭
I may be slow to respond.
View GitHub Profile
@f41gh7
f41gh7 / README.md
Last active April 21, 2022 09:34
vmagent k8s discovery timings

how to generate load on vmagent

requirements

  • golang
  • python3
  • git

starting

@ihard
ihard / backfill prom metric.txt
Last active December 23, 2021 13:51
backfill prom metric via vmalert
cat <<EOF > rules.yml
---
groups:
- name: main
rules:
EOF
curl -s -g 'http://localhost:9090/api/v1/series?' --data-urlencode 'match[]={job="grafana"}' \
@f41gh7
f41gh7 / victoria_metrics_push_gw.py
Created January 17, 2021 02:08
VictoriaMetrics as push gateway.
from prometheus_client import Counter, start_http_server
from threading import Thread
import requests as re
import time
JOB_NAME = 'test'
INSTANCE = 'localhost'
def scrape_and_send(local_url: str, vm_url: str, scrape_interval: int):
@paolocarrasco
paolocarrasco / README.md
Last active July 23, 2024 14:37
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

create table test(a Int64, b Int64, c Int64, d String)
engine=MergeTree partition by tuple() order by (a,b,c);
insert into test select 1, 0, number, toString(number) from numbers(1000000);
insert into test select 2, 2, number, toString(number) from numbers(100);
insert into test select 3, 3, number, toString(number) from numbers(1000000);
select count() from test where a=2 and c=1;
1 rows in set. Elapsed: 0.002 sec.
@MauricioMoraes
MauricioMoraes / access_postgresql_with_docker.md
Last active June 28, 2024 16:17
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

@troyfontaine
troyfontaine / 1-setup.md
Last active July 23, 2024 23:25
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@maplebed
maplebed / split_logstash.conf
Created November 1, 2016 03:35
Logstash config that sends sampled traffic to Honeycomb and all traffic to stdout
input { stdin { } }
filter {
grok {
match => ["message", "%{HAPROXYHTTP}"]
remove_field => ["message"]
}
mutate {
convert => { "actconn" => "integer"
"backend_queue" => "integer"
"beconn" => "integer"
@alexey-milovidov
alexey-milovidov / rounding_dates.txt
Created June 20, 2016 20:57
Example of using date and datetime functions in ClickHouse.
:) SELECT toMonday(EventDate) AS k, count(), uniq(UserID) FROM hits_layer WHERE CounterID = 29761725 AND EventDate >= '2016-05-01' GROUP BY k ORDER BY k
SELECT
toMonday(EventDate) AS k,
count(),
uniq(UserID)
FROM hits_layer
WHERE (CounterID = 29761725) AND (EventDate >= '2016-05-01')
GROUP BY k
ORDER BY k ASC
@spiette
spiette / jinja_variables_types.yml
Created March 3, 2016 14:52
Test the variables types in jinja2 templates, used here with ansible
---
- hosts: all
gather_facts: no
vars:
string: "string"
list:
- item1
- item2
dict:
key1: value1