Skip to content

Instantly share code, notes, and snippets.

View dmitryk-dk's full-sized avatar
:octocat:
Coding

Dmytro Kozlov dmitryk-dk

:octocat:
Coding
View GitHub Profile
{
"parser": "babel-eslint",
"plugins": [
"react"
],
"env": {
"browser": true,
"node": true,
@dmitryk-dk
dmitryk-dk / samsung test
Created May 10, 2017 20:01
Samsung Test (parse image and get audio)
(function () {
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext("2d");
const input = document.querySelector('.js-button-click');
const buttonPlay = document.querySelector('.js-play-button');
buttonPlay.setAttribute('disabled', 'disabled');
const buttonReadData = document.querySelector('.js-read-button');
var img = null;
var radius = null;
var angle = 0;
@dmitryk-dk
dmitryk-dk / Template for samsung test
Created May 10, 2017 20:02
Template for samsung test
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
const promiseTimeout = (ms, promise) => {
// Create a promise that rejects in <ms> milliseconds
const timeout = new Promise((reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject('Server return error');
}, ms);
});
// Returns a race between our timeout and the passed in promise
@dmitryk-dk
dmitryk-dk / setup-vmalert-managed-vm.md
Last active February 24, 2023 13:47
How to setup vmalert with managed VictoriaMetrics

If you want to use vmalert with managed VictoriaMetrics, you should take the next steps:

  1. You can build it from the source.
git clone https://github.com/VictoriaMetrics/VictoriaMetrics
cd VictoriaMetrics
make vmalert

or you can download it from the RELEASES page

{% package main %}
{% import (
"time"
"sort"
"net/http"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/tpl"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier"