Skip to content

Instantly share code, notes, and snippets.

@levkov
levkov / main.go
Created August 29, 2023 07:18 — forked from slok/main.go
Kubernetes controller that updates annotation on pods with `kooper: test` label
package main
import (
"os"
"path/filepath"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@levkov
levkov / alert.rules
Created July 21, 2022 18:19 — forked from Ebaneck/alert.rules
Alerting for AWS ENA metrics
- alert: Bandwith_In_Allowance_Exceeded
expr: increase(node_ethtool_bw_in_allowance_exceeded{cluster=“my-cluster”}[10m]) > 30000
for: 10m
labels:
severity: warning
annotations:
summary: "{% raw %}Bandwith traffic in for {{ $labels.instance }} is exceeding {% endraw %}"
description: "{% raw %}{{ $labels.instance }} from {{ $labels.cluster }} bandwith exceed{{ $value }} in 10 minutes {% endraw %}"
- alert: Bandwith_Out_Allowance_Exceeded
@levkov
levkov / Powerline.md
Last active September 26, 2020 20:55 — forked from mrkara/Powerline.md
Install Powerline on Debian 9 Stretch
  1. Install pip sudo apt-get install python-pip
  2. Install powerline sudo pip install powerline-status
  3. Install fonts sudo apt-get install fonts-powerline
  4. Add these lines to respective files:

.vimrc > set rtp+=/home/levkov/miniconda3/lib/python3.8/site-packages/powerline/bindings/vim/

@levkov
levkov / GLUSTER_SETUP.sh
Created June 30, 2020 17:19 — forked from smola/GLUSTER_SETUP.sh
Quick and dirty single-node GlusterFS setup
#
# Instructions for quick gluster server (1 node) setup with a volume on LVM.
# No replication, just using localhost.
#
# See https://docs.gluster.org/en/latest/Administrator%20Guide/Brick%20Naming%20Conventions/
#
# Install GlusterFS
add-apt-repository ppa:gluster/glusterfs-4.0
apt-get install glusterfs-server
@levkov
levkov / s3gzip.py
Created October 30, 2019 10:04 — forked from veselosky/s3gzip.py
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@levkov
levkov / ZabbixSender.py
Created December 24, 2017 15:19 — forked from GedowFather/ZabbixSender.py
AWS Lambda python script for sending metric value to zabbix.
#
# For sending metric value to zabbix server.
#
# You must create item as "zabbix trapper" on server.
# Because the server must be connected to agent:10050, if it is selected "zabbix agent".
#
# Usage:
# from modules.ZabbixSender import ZabbixSender
# ZABBIX_HOST = "zabbix.example.com"
# ZABBIX_PORT = 10051
@levkov
levkov / simple_python_datasource.py
Created October 22, 2017 11:49 — forked from linar-jether/simple_python_datasource.py
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@levkov
levkov / getpass.sh
Created March 16, 2016 13:38 — forked from vishvananda/getpass.sh
Script for setting an encrypted password on boot
#!/usr/bin/env bash
SSH_KEYFILE=`tempfile`
SSL_KEYFILE=`tempfile`
if ! curl -s -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > $SSH_KEYFILE; then
echo "Failed to get key"
fi
cat $SSH_KEYFILE
PASSWORD=`openssl rand -base64 48 | tr -d '/+' | cut -c1-16`
sudo usermod ubuntu -p `openssl passwd -1 $PASSWORD`
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "base"
config.vm.customize ["modifyvm", :id, "--memory", 1024]
config.vm.define :haproxy do |haproxy|
haproxy.vm.forward_port 80, 8000
haproxy.vm.network :hostonly, "192.168.1.10"