Skip to content

Instantly share code, notes, and snippets.

View vladimir-ivanov's full-sized avatar

vladimir ivanov vladimir-ivanov

View GitHub Profile
---
- name: This is a hello-world example
vars:
latest_version: "{{ version }}"
hosts: localhost
tasks:
- name: Create a file called '/tmp/testfile.txt' with the content 'hello world'.
copy:
content: hello worldn
dest: /tmp/text.txt
const greatestCommonDivisor(a: number, b: number): number => (b === 0) ? a : greatestCommonDivisor(b, a % b);
const result = [];
const traverse = (obj, path = '', parentRow = {}) => {
let row = { ...parentRow };
Object.entries(obj).forEach(([key, val]) => {
const currentPath = path ? `${path}.${key}` : key;
if (Array.isArray(val) && val.length > 0) {
@vladimir-ivanov
vladimir-ivanov / Example.java
Created September 12, 2018 18:36
solace example
package com.vlad;
import com.solacesystems.jms.SolConnectionFactory;
import com.solacesystems.jms.SolJmsUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;
@vladimir-ivanov
vladimir-ivanov / file-download-blob-example.html
Last active March 21, 2018 11:06
example of file upload, conversion to blob and then download
<html>
<head>
<style>
div {
margin: 20px;
}
</style>
</head>
<body>
<input type="file" id="your-files" multiple>
@vladimir-ivanov
vladimir-ivanov / .z.pm
Last active December 5, 2017 08:51
OPTIONS preflight headers response
.z.pm:{"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: POST, GET, OPTIONS\r\nAccess-Control-Allow-Headers: Content-Type, Authorization\r\nAccess-Control-Max-Age: 86400\r\nVary: Accept-Encoding, Origin\r\nContent-Length: 0\r\nKeep-Alive: timeout=2, max=100\r\nConnection: Keep-Alive\r\nContent-Type: text/plain"}
@vladimir-ivanov
vladimir-ivanov / computer.q
Last active December 3, 2017 21:10
kdb large data
n:1000; timerange:5D; freq:0D00:01; calls:3000;
depts:`finance`packing`logistics`management`hoopjumping`trading`telesales; startcpu:(til n)!25+n?20; fcn:n*fc:`long$timerange%freq;
computer:([]time:(-0D00:00:10 + fcn?0D00:00:20)+fcn#(.z.p - timerange)+freq*til fc; id:raze fc#'key startcpu)
computer:update `g#id from `time xasc update cpu:{100&3|startcpu[first x]+sums(count x)?-2 -1 -1 0 0 1 1 2}[id] by id from computer
/ And generate some random logged calls
calls:([] time:(.z.p - timerange)+asc calls?timerange; id:calls?key startcpu; severity:calls?1 2 3)
computerlookup:([id:key startcpu] dept:n?depts; os:n?`win7`win8`osx`vista)
.z.ws:{0N! x; neg[.z.w] .j.j[select[1000000] from computer]}
@vladimir-ivanov
vladimir-ivanov / gist:6d01723635424d1aae28e24e84da2760
Last active October 21, 2017 22:09
calendar date range random
import {Component, OnInit} from '@angular/core';
import * as moment from 'moment';
import 'rxjs/Rx';
import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';
@Component({
selector: 'app-date-range',
template: `<p-calendar
@vladimir-ivanov
vladimir-ivanov / facebook-api-request.service.ts
Created August 2, 2017 19:27
facebook graph api sdk angular 2 / 4
import {Inject, Injectable, InjectionToken} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {AsyncSubject} from "rxjs/AsyncSubject";
export let FacebookSdk = new InjectionToken<any>("FacebookSdk");
@Injectable()
export class FbRequestService {
constructor(@Inject(FacebookSdk) private facebookSdk) {
}
http://rxmarbles.com/
https://auth0.com/blog/understanding-reactive-programming-and-rxjs/
https://www.learnrxjs.io
https://gist.github.com/btroncone/d6cf141d6f2c00dc6b35
https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
https://rxviz.com/
https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md