Skip to content

Instantly share code, notes, and snippets.

@IvanZelenskyy
IvanZelenskyy / script.js
Created July 2, 2020 22:20
izberkom parser
function getDocument(url){ fetch(url).then(function (response) {
// The API call was successful!
// console.log(response);
return response.text();
}).then(function (html) {
// Convert the HTML string into a document object
var parser = new DOMParser();
var doc = parser.parseFromString(html, 'text/html');
if(doc.querySelector('.captcha')){
@IvanZelenskyy
IvanZelenskyy / inner_comm_18_11_19.xml
Last active November 18, 2019 13:06
inner_comm_18_11_19.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
<description></description>
<groupId>02b37c2c-016e-1000-1c03-b5aa55d94a07</groupId>
<name>inner_comm_18_11_19</name>
<snippet>
<controllerServices>
<id>03784c3b-eb78-3673-0000-000000000000</id>
<parentGroupId>b6dcabca-5de0-3c4f-0000-000000000000</parentGroupId>
<bundle>
{"requestId" : "353432", "indicator" : {"id": "M6_6_T1", "data" : [{"firstDayOfPeriod" : "2019-09-01", "periodСode" : "month", "orgId" : 4925, "error" : 0, "errorText" : "", "okved2" : "06", "region" : "87", "workers_average" : "4363.00", "workers_on_payroll_average" : "4363.00", "off_hour_workers_average" : "0.00", "civil_contract_workers_average" : "0.00", "salary_fund" : "421977.40", "on_payroll_salary_fund" : "421545.80", "off_hour_salary_fund" : "60.60", "civil_contracr_salary_fund" : "370.90"}, {"firstDayOfPeriod" : "2019-09-01", "periodСode" : "month", "orgId" : 4925, "error" : 0, "errorText" : "", "okved2" : "09.1", "region" : "87", "workers_average" : "1065.00", "workers_on_payroll_average" : "1064.00", "off_hour_workers_average" : "0.00", "civil_contract_workers_average" : "1.00", "salary_fund" : "142144.60", "on_payroll_salary_fund" : "137783.30", "off_hour_salary_fund" : "9.30", "civil_contracr_salary_fund" : "4352.10"}, {"firstDayOfPeriod" : "2019-09-01", "periodСode" : "month", "orgId" : 4925, "
curl -H 'Content-type: application/json; utf-8' -X POST -d '{"requestId": "123e4567-e89b-12d3-a456-426655440000", "indicator": {"id": "keyf_code1", "data":[{"firstDayOfPeriod": "2019-10-01", "periodСode": "month", "orgId":1083, "attr1": 1, "attr2": "string"}, {"firstDayOfPeriod": "2019-10-01", "periodСode": "month", "orgId":1007, "attr1": 2, "attr2": "string2"}, {"firstDayOfPeriod": "2019-10-01", "periodСode": "month", "orgId":1007, "attr1": 3, "attr2": "string3"} ] } }' http://localhost:9090/integration/lukoil/saveIndicatorData
import java.math.BigDecimal;
import java.math.BigInteger;
public class Binomial {
public BigInteger binomialC(int n, int k){
int m = Math.min(k,n-k); //Optimization based on C[n,k]==C[n,n-k]
BigDecimal res = BigDecimal.valueOf(1d);
for (int i=1; i<=m; ++i)
res = res.multiply(BigDecimal.valueOf(n-m+i)).divide(BigDecimal.valueOf(i)); //res = res * (n-k+i) / i;
@IvanZelenskyy
IvanZelenskyy / Demotomee1Application.java
Last active September 10, 2018 09:12
Simple Spring Boot JMS app
package com.example.demotomee1;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.annotation.JmsListener;
@SpringBootApplication
@IvanZelenskyy
IvanZelenskyy / Demotomee1Application.java
Last active August 1, 2021 09:18
Simple Spring Boot web application
package com.example.demotomee1;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Demotomee1Application {
public static void main(String[] args) {
@IvanZelenskyy
IvanZelenskyy / DemoBootJmsApplication.java
Created September 5, 2018 11:22
Simple Jms ActiveMQ consumer with Spring boot. to test, run ActiveMQ and send any text message to queue://mailbox
package com.example.demobootjms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.annotation.JmsListener;
@SpringBootApplication
@EnableJms
public class DemoBootJmsApplication {
@IvanZelenskyy
IvanZelenskyy / DemoApplication.java
Created February 13, 2018 14:49
Spring boot webflux test1
package com.example.demo;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.reactivestreams.Processor;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@IvanZelenskyy
IvanZelenskyy / demo.kt
Last active September 2, 2017 16:48 — forked from anonymous/demo.kt
Try Kotlin with spring-boot 2.0.0M3
package com.example.demo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.stereotype.Service
import org.springframework.web.bind.annotation.*
@SpringBootApplication