Skip to content

Instantly share code, notes, and snippets.

View mskonovalov's full-sized avatar
:octocat:

Mikhail Konovalov mskonovalov

:octocat:
View GitHub Profile
@mskonovalov
mskonovalov / base64randomstring.go
Created December 2, 2020 03:50
Generate base64 random string
import (
"crypto/rand"
"encoding/base64"
"testing"
"github.com/stretchr/testify/require"
)
// RandomBase64String returns random Base64 string of requested length
// If the specified length cannot be achived the the longest available string will be returned shorter than requested
@mskonovalov
mskonovalov / check_py_lic.sh
Created May 4, 2020 08:08
Script to collect licenses info for python deps for many different envs (like lambdas, etc).
#/bin/bash
for item in `find . -name "requirements.txt"`
do
dir=$(dirname "${item}")
pushd "${dir}" >/dev/null
pwd
python3 -m venv venv
source venv/bin/activate
pip install -U pip-licenses $1 >/dev/null 2>&1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--Created by yFiles for HTML 2.1.0.3-RC3-->
<graphml xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd " xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:demostyle="http://www.yworks.com/yFilesHTML/demos/FlatDemoStyle/1.0" xmlns:bpmn="http://www.yworks.com/xml/yfiles-for-html/bpmn/2.0" xmlns:demotablestyle="http://www.yworks.com/yFilesHTML/demos/FlatDemoTableStyle/1.0" xmlns:uml="http://www.yworks.com/yFilesHTML/demos/UMLDemoStyle/1.0" xmlns:compat="http://www.yworks.com/xml/yfiles-compat-arrows/1.0" xmlns:VuejsNodeStyle="http://www.yworks.com/demos/yfiles-vuejs-node-style/1.0" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/3.0" xmlns:yjs="http://www.yworks.com/xml/yfiles-for-html/2.0/xaml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<key id="d0" for="node" attr.type="boolean" attr.name="Expanded" y:attr.ur
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
using namespace std;
struct sdarr
{
int size;
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
using namespace std;
vector<int> readFromFile(string fileName)
{
vector<int> numbers;
@mskonovalov
mskonovalov / Controller.java
Last active May 10, 2022 10:31
Spring 5.0 web-flux test Java/Kotlin
import lombok.Data;
import org.reactivestreams.Publisher;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@RestController
public class Controller {
@PostMapping("/person")
@mskonovalov
mskonovalov / Either.java
Created March 24, 2017 08:46
Either.java
import java.util.Optional;
import java.util.function.*;
public abstract class Either<A, B> {
public abstract <C> C fold(Function<A, C> fa, Function<B, C> fb);
public <C> C foldLeft(C zero, BiFunction<C, B, C> f) {
return fold(a -> zero, b -> f.apply(zero, b));
}