This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
err_metric_name=docker_logs_services_errors_total | |
warn_metric_name=docker_logs_services_warnings_total | |
collect_metrics() { | |
logs=$(docker ps --format '{{.Names}}' | xargs -L 1 docker logs 2>&1) | |
errors=$(echo "$logs" | grep -ic 'ERROR\|FATAL' | sed "s/.*/# TYPE ${err_metric_name} counter\\n# HELP ${err_metric_name} Errors metric\\n${err_metric_name} \\0/") | |
warnings=$(echo "$logs" | grep -ic 'WARN\(ING\)\?' | sed "s/.*/# TYPE ${warn_metric_name} counter\\n# HELP ${warn_metric_name} Errors metric\\n${warn_metric_name} \\0/") | |
echo "$errors\n$warnings" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Update a DNS record using Cloudflare DDNS service | |
After=network.target | |
[Install] | |
WantedBy=multi-user.target | |
[Service] | |
StandardOutput=journal | |
StandardError=journal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vk | |
from time import sleep | |
from pprint import pprint | |
TOKEN = '<access token>' | |
FIRST_NAMES = ('Imya', 'Имя') | |
LAST_NAMES = ('Familiya', 'Фамилия') | |
FRIENDS_MIN = 100 | |
FRIENDS_MAX = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" SETTINGS """ | |
set smoothscroll " Use smooth scrolling | |
set linkanimations " Show fade effect when link hints open and close | |
set cncpcompletion " Use <C-p> to cycle through completion results (I don't know how to make <C-n> work) | |
""" SEARCH ENGINES """ | |
let searchengine yandex = ['https://yandex.ru', 'https://yandex.ru/search/?text=%s'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.Paths | |
def whatWeSearchingFor = [ | |
'.gradle', | |
'.m2', | |
'.groovy', | |
'.Idea', | |
'.PyCharm', | |
'.eclipse', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args : Array<String>) { | |
listOf("Hello!", "Bye!", "foo bar", "abcdefghijklmno").forEach { | |
val result = switch(it) { | |
case({ it.length > 10 }) { "The string is too long!" } | |
case("Hello!") { println("Hi!") } | |
case("Bye!") { println("See you next time!") } | |
default { "[Unexpected case]" } | |
} |