Skip to content

Instantly share code, notes, and snippets.

View diolavr's full-sized avatar
😴
AlwayZzz...

Denny Laurier diolavr

😴
AlwayZzz...
View GitHub Profile
@diolavr
diolavr / Golang.Kubernetes.Metrics.Grafana.Dashboard.json
Last active April 4, 2023 14:57
Grafana dashboard for golang service in the Kubernetes
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@diolavr
diolavr / docker-compose.yml
Created November 3, 2022 17:00
Jaeger tracer with Cassandra docker compose
---
version: '3.5'
services:
jaeger-collector:
image: jaegertracing/jaeger-collector
command: [
"--cassandra.keyspace=jaeger_v1_dc1",
"--cassandra.servers=cassandra",
"--sampling.initial-sampling-probability=.5",
#include <stdlib.h>
#include <pthread.h>
#include "logger.h"
#include "queue.h"
static void lock(queue_t *q)
{
pthread_mutex_lock(&(q->mutex));
}
@diolavr
diolavr / Golang_prometheus.md
Last active March 14, 2024 10:54
Golang Prometheus metrics

Prometheus

Для сбора метрик с использованием Golang используются библиотеки из репозитория prometheus

// библиотека со всеми наборами метрик
import "github.com/prometheus/client_golang/prometheus"
  • Counter (счетчик) - хранит значения, которые увеличиваются с течением времени
@diolavr
diolavr / install-instantclient.sh
Last active August 1, 2023 09:49
Oracle instantclient installer
#!/usr/bin/env bash
ROOT=/opt/oracle
if [ ! -e $ROOT ]; then
mkdir -p $ROOT
fi
LIBS=instanclient_basic_lib.zip
if [ ! -e $LIBS ]; then
wget -O $LIBS https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip
sub days_inmonth_inyear {
my ( $x, $y ) = @_;
return 28 + ( ( $x + int( $x / 8 ) ) % 2 ) + 2 % $x + int(
( 1
+ ( 1 - ( $y % 4 + 2 ) % ( $y % 4 + 1 ) )
* ( ( $y % 100 + 2 ) % ( $y % 100 + 1 ) )
+ ( 1 - ( $y % 400 + 2 ) % ( $y % 400 + 1 ) )
) / $x
) + int( 1 / $x ) - int(
( ( 1 - ( $y % 4 + 2 ) % ( $y % 4 + 1 ) )
@diolavr
diolavr / javascript.translit.js
Last active October 30, 2023 20:30
JavaScript translater russian to translit
function rus_to_latin ( str ) {
var ru = {
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',
'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh',
'щ': 'shch', 'ы': 'y', 'э': 'e', 'ю': 'u', 'я': 'ya'
}, n_str = [];
// Before
if ( self.data('branches') ) {
checked_stack.push( this );
} else {
var len = checked_stack.length;
if ( this.checked === true ) {
checked_stack.push( this );